Pass2PHP

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Sunday 08 January 2017 21:40

I don't know what to say. My lua starts 3msecs after the line of a pir (for ex).
The whole thing is done in 19/20 msecs.

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: RE: Re: LUA Pass2php

Postby sincze » Sunday 08 January 2017 22:36

Egregius wrote:I don't know what to say. My lua starts 3msecs after the line of a pir (for ex).
The whole thing is done in 19/20 msecs.

I Cleared up all unused devices. Idx currently at 1030. Hopefully the database is okay :).
Maybe delete disabled events as well. Really don't know

Sent from my SM-G925F using Tapatalk

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: LUA Pass2php

Postby sincze » Monday 09 January 2017 21:14

I did the following: copy db to spare machine and removed all disabled db events.

Code: Select all

2017-01-09 18:57:39.456 User: Admin initiated a switch command (621/ZonweringAuto/On)
2017-01-09 18:57:39.483 LUA: 1. Encoding started at time: 4.21
2017-01-09 18:57:39.486 LUA: 2. Encoding finished at time: 4.21
2017-01-09 18:57:39.497 LUA: 3. Curl finished at time: 4.21


Now.... i disabled several hardware devices in domoticz:

Code: Select all

2017-01-09 19:10:24.503 User: Admin initiated a switch command (621/ZonweringAuto/On)
2017-01-09 19:10:24.510 LUA: 1. Encoding started at time: 2.30
2017-01-09 19:10:24.512 LUA: 2. Encoding finished at time: 2.30
2017-01-09 19:10:24.517 LUA: 3. Curl finished at time: 2.30


And I have a speed advantage.... :D

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: LUA Pass2php

Postby sincze » Monday 09 January 2017 21:18

mmm something wrong?? opcache should be running however this says.. it's not I think.
opcache.PNG
opcache.PNG (35.68 KiB) Viewed 397 times

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Tuesday 10 January 2017 0:30

37msecs with disabled events and 27msecs without events? Strange, you would expect no such difference.
Same goes for disabled hardware. I only have dummy, rfxcom and zwave.

I think your opcode isn't enabled in one of the php.ini files, you should search in wich it's set.

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: LUA Pass2php

Postby sincze » Tuesday 10 January 2017 13:32

Egregius wrote:37msecs with disabled events and 27msecs without events? Strange, you would expect no such difference.
Same goes for disabled hardware. I only have dummy, rfxcom and zwave.

I think your opcode isn't enabled in one of the php.ini files, you should search in wich it's set.


You would guess it is configured okay ? Right.? my .opcache directory is populated. :D
2. Opcache.JPG
2. Opcache.JPG (28.12 KiB) Viewed 380 times

Opcache-1.JPG
Opcache-1.JPG (24.59 KiB) Viewed 380 times


Strange strange strange. If we could just get the first 30ms off ;-) from switching the switch to calling the php.
That would be amazing. However don't have a clue on how to achieve this.

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Tuesday 10 January 2017 13:53

If "LUA: 1. Encoding started" is the first line of your lua script you wont get that time off, that's in Domoticz.
If that's after the loading of the cb-json thing you could benefit from my concatenate stuff as that doesn't need to load anything external.
If you then have the system so that you only require the devicechanged table the encoding should be finished in less than 1 msec after the script is triggered.

I do see a difference in your opcode settings:
Image

Seems that your's is set to use file cache instead of memory.

These are my settings:

Code: Select all

; configuration for php opcache module
; priority=10
zend_extension=opcache.so

[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 32
opcache.interned_strings_buffer = 4
opcache.max_accelerated_files = 20000
opcache.max_wasted_percentage = 5
opcache.use_cwd = 1
opcache.validate_timestamps = 0
opcache.revalidate_freq = 2
opcache.revalidate_path = 0
opcache.save_comments = 1
opcache.load_comments = 1
opcache.fast_shutdown = 0
opcache.enable_file_override = 0
opcache.optimization_level = "0xffffffff"
opcache.inherited_hack = 1
opcache.dups_fix = 0
opcache.blacklist_filename = /dontcache.txt
opcache.max_file_size = 0
opcache.consistency_checks = 0
opcache.force_restart_timeout = 180
opcache.error_log =
opcache.log_verbosity_level = 1
opcache.preferred_memory_model =
opcache.protect_memory = 0
opcache.mmap_base =
opcache.restrict_api =

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: LUA Pass2php

Postby sincze » Tuesday 10 January 2017 15:21

3. opcache.JPG
3. opcache.JPG (59.04 KiB) Viewed 368 times

Damn.... missed that one..

Code: Select all

; Enables or disables opcode caching in shared memory.
opcache.file_cache_only=0

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Tuesday 10 January 2017 16:23

And still there's something wrong I think. You're at 0 misses and memory is at 0 bytes.
Should be like this:
Image
On my system it was an improvement of approx 40 msec.
Or do you already see a speed improvement now?

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: LUA Pass2php

Postby sincze » Tuesday 10 January 2017 16:33

Ah, I had to invalidate the entries... then they showed up like so.
4.opcache.JPG
4.opcache.JPG (30.2 KiB) Viewed 350 times


Let me check the speed advantages ;-)

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: LUA Pass2php

Postby sincze » Tuesday 10 January 2017 21:28

And the speedtest
Pretty stable at around 140-142.
We indeed loose 40ms during start :x

Code: Select all

..   2017-01-10 20:20:12.366 User: Admin initiated a switch command (621/ZonweringAuto/On)
..   2017-01-10 20:20:12.368 (Virtual Device) Light/Switch (ZonweringAuto)
40   2017-01-10 20:20:12.406 LUA: 1. Encoding started at time: -39.29
 3   2017-01-10 20:20:12.409 LUA: 2. Encoding finished at time: -39.29
12   2017-01-10 20:20:12.421 LUA: 3. Curl finished at time: -39.28
   2017-01-10 20:20:12.486 --->> SETLEVEL 100
   2017-01-10 20:20:12.490 User: Admin initiated a switch command (531/Lamp (CV Ruimte) (RF)/Set Level)
71   2017-01-10 20:20:12.492 RFLink Sending: 10;NewKaku;ba1e09;a;15



Code: Select all

2017-01-10 20:23:35.326 User: Admin initiated a switch command (621/ZonweringAuto/Off)
   2017-01-10 20:23:35.327 (Virtual Device) Light/Switch (ZonweringAuto)
42   2017-01-10 20:23:35.368 LUA: 1. Encoding started at time: -21.46
 3   2017-01-10 20:23:35.371 LUA: 2. Encoding finished at time: -21.45
12   2017-01-10 20:23:35.383 LUA: 3. Curl finished at time: -21.45
   2017-01-10 20:23:35.449 --->> SWITCH Off
   2017-01-10 20:23:35.452 User: Admin initiated a switch command (531/Lamp (CV Ruimte) (RF)/Off)
71   2017-01-10 20:23:35.454 RFLink Sending: 10;NewKaku;ba1e09;a;OFF

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Tuesday 10 January 2017 22:24

Encoding started is the first line of the lua script? Before the include/require thing?

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: LUA Pass2php

Postby sincze » Tuesday 10 January 2017 22:57

I added step 0 to show it more clearly ;-0

2017-01-10 21:52:28.134 User: Admin initiated a switch command (621/ZonweringAuto/On)
2017-01-10 21:52:28.135 (Virtual Device) Light/Switch (ZonweringAuto)
2017-01-10 21:52:28.181 LUA: 0. just before cb64json
2017-01-10 21:52:28.184 LUA: 1. encoding started
2017-01-10 21:52:28.187 LUA: 2. encoding finished
2017-01-10 21:52:28.205 LUA: 3. curl finished
2017-01-10 21:52:28.302 --->> SETLEVEL 100
2017-01-10 21:52:28.305 User: Admin initiated a switch command (531/Lamp (CV Ruimte) (RF)/Set Level)
2017-01-10 21:52:28.306 RFLink Sending: 10;NewKaku;ba1e09;a;15

And off.. just to give an overview of the log filling up

2017-01-10 21:55:20.935 User: Admin initiated a switch command (621/ZonweringAuto/Off)
2017-01-10 21:55:20.936 LUA: 1. encoding started
2017-01-10 21:55:20.949 LUA: 2. encoding finished
2017-01-10 21:55:21.009 LUA: 3. curl finished
2017-01-10 21:55:21.158 LUA: 0. just before cb64json
2017-01-10 21:55:21.187 LUA: 1. encoding started
2017-01-10 21:55:21.225 LUA: 2. encoding finished
2017-01-10 21:55:21.256 LUA: 3. curl finished
2017-01-10 21:55:21.307 LUA: 0. just before cb64json
2017-01-10 21:55:21.309 LUA: 1. encoding started
2017-01-10 21:55:21.319 LUA: 2. encoding finished
2017-01-10 21:55:21.343 LUA: 3. curl finished
2017-01-10 21:55:21.260 (Virtual Device) Light/Switch (ZonweringAuto)
2017-01-10 21:55:21.438 LUA: 0. just before cb64json
2017-01-10 21:55:21.446 LUA: 1. encoding started
2017-01-10 21:55:21.451 LUA: 2. encoding finished
2017-01-10 21:55:21.495 LUA: 3. curl finished
2017-01-10 21:55:21.591 --->> SWITCH Off
2017-01-10 21:55:21.598 User: Admin initiated a switch command (531/Lamp (CV Ruimte) (RF)/Off)
2017-01-10 21:55:21.602 RFLink Sending: 10;NewKaku;ba1e09;a;OFF

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Tuesday 10 January 2017 23:28

Of course, only use that for debug/analyze. Otherwise disable as much as possible.
As I see it there's only 6 msecs left to gain, by replacing the json thing. Don't know what else I can say.

sincze
Posts: 565
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: RE: Re: LUA Pass2php

Postby sincze » Tuesday 10 January 2017 23:42

Egregius wrote:Of course, only use that for debug/analyze. Otherwise disable as much as possible.
As I see it there's only 6 msecs left to gain, by replacing the json thing. Don't know what else I can say.

So we are on our way :) nice. I will check is hardware device 'ping' maybe is causing some delay. Needs to be converted to pass2php

Sent from my SM-G925F using Tapatalk

ropske
Posts: 141
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi
Domoticz version: V3_6235
Location: Rumbeke,Belgium
Contact:

Re: LUA Pass2php

Postby ropske » Friday 13 January 2017 22:29

Egregius: is it possible to give some information about your heating script: __verwarming.php please?
for example, what is heating and what is brander?

you are also switching for heating with a relay i believe? is this one 'heating' or 'brander' ?

like these devices below, are these real devices or are they variables?
$heating=apcu_fetch('sheating');
$weg=apcu_fetch('sweg');
$slapen=apcu_fetch('sslapen');
$brander=apcu_fetch('sbrander');
$buiten_temp=apcu_fetch('buiten_temp');

thank you!

ropske
Posts: 141
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi
Domoticz version: V3_6235
Location: Rumbeke,Belgium
Contact:

Re: LUA Pass2php

Postby ropske » Saturday 14 January 2017 0:02

btw, you also have some Thermostaatkraan Popp i believe? or LC13?
https://www.robbshop.nl/radiator-thermostaat-popp

how long you have them and you an idea how long the batteries are going?

I have 1 popp now (ordered for testing, and i'm feeling good with it), i'm planning to order now for all rooms.
just want some information about 'an expert' ;)

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Saturday 14 January 2017 6:48

My heating script is quite complex :P
Also changed yesterday that all my dummy devices are now only in apcu cache. I figured why set a switch in Domoticz that just sets a cache variable? So now I only set the variable and removed my dummy hardware.
Anyway, functionnallity stays the same as they are threaded like 'normal' on/off switches.

heating=switch that defines if the whole heating system needs to be active. This is automatically on whenever we're at home. As soon as we leave the home it's set to off. 'Weg' is Dutch for 'Away', 'slapen' for 'sleeping', explains themself I guess.
The extra 'heating' switch provides the possibility to activate the heating while away, on our way home for example. Once activated it triggers the rest of the heating script. If activated for more than one hour and still not home it's switched back off.
'Brander' is the heater, the gas burner that is switched by a regular relay.
'buiten_temp' is external temperature, grabbed from wunderground.

About the Danfoss LC13: biggest disadventage is the lack of report of battery status. I use Eneloop rechargeable batteries so the battery low indicater on the valve is always on. Battery status isn't in Domoticz so I have no idea when they will be empty.
For that I created something that notifies me whenever one of the valves hasn't updated in the last hour. Unfortunally that doesn't work. Already had multiple times that the valve still connects and updates but doesn't have enough power to close the radiator, resulting in a hot radiator with a open window. I'm now thinking of placing 24V valves directly on the manifold, at least for the living room. I can't do that easy for the bedrooms as there are 2 radiotors on one pipe there. So, that's still something that needs improvement.
For now, I just replace the batteries every first weekend of the month. They are rechargeable and I have hundreds of them in the house.
I guess it's hard to say how long they'll last as that's very dependent on how you use them. I don't use them as a 'thermostatic' valve but rather as a open/close valve.

ropske
Posts: 141
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi
Domoticz version: V3_6235
Location: Rumbeke,Belgium
Contact:

Re: LUA Pass2php

Postby ropske » Saturday 14 January 2017 11:14

Thanks ;)
Im just thinking, instead of ordering more popp valves with batteries, i better order something like this?
http://www.popp.eu/products/actuators/flow-stop/
And place them between my pipes? Ive got pipes from every room going to my collecteur.

So livingZ and livingZZ are danfoss valves?
Im trying to understand your program so i 'convert' it to my house :D

Egregius
Posts: 2008
Joined: Thursday 09 April 2015 12:19
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Beitem, BE
Contact:

Re: LUA Pass2php

Postby Egregius » Saturday 14 January 2017 23:13

Yes, everything ending with capital Z is a danfoss valve.
Don't know if those popps are good for heating pipes...


Return to “LUA”

Who is online

Users browsing this forum: Egregius and 0 guests