Scripting Execution Queue issue  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Scripting Execution Queue issue

Post by emme »

Ciao,

this is specially directed to @wareen but this issue cover the whole Domoticz System....

I had this issue before, than I fixed it by deleting the db and recreating it again, put back (reconfigured) all devices and script... and the issue came back!
Now I know what happened but don't know how to debut it and how to fix it....

the scenario is:
More devices that uses the same script (a python one in my case) for on/off Action with different parameters will crash the domoticz command queue.

Demonstration:
I have 3 Meross power stripe that Domoticz can command using the script /home/pi/Meross/MSS.py <device idx> <Device CH> <on/off>
every power stripe has 4 channels: 3 plugs, a USB bridge.
for a total of 12 devices
Each device is configured with the on/of action to call the python script correctly configured.

Those devices are powered up and down depending on presence detection (which is another script that works fine)
When everybody left the house, those plugs will be powered off, when someone arrives, they go back on.

the script works fine for few days (max 2 power cycles per day), then... something happened....
the scripting system works fine, BUT devices/variables/groups/scenarios command are not executed.

My intention is to understand (if there is one) what's happened to the command queue in domoticz... if there is something stucked or a subsystem has crashed for some reason, but don't know where to have a look at....
ciao
M
The most dangerous phrase in any language is:
"We always done this way"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scripting Execution Queue issue

Post by waaren »

emme wrote: Tuesday 16 July 2019 17:20 the scenario is: More devices that uses the same script (a python one in my case) for on/off Action with different parameters will crash the domoticz command queue.
If I understand your setup and script triggering correctly (by looking at one of your previous postings) the python script is triggered by the "On / Off action:" fields in the edit screen of the switches tab.

Can you activate some logging in the python script to see if / when this script is triggered and compare that with the domoticz logging of the device being switched ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Scripting Execution Queue issue

Post by emme »

Cia waaren, thanks!

I use to log to console from the python script.
Script runs correctly: it logs the connection to the remote cloud, list the devices and confirm activation.

I run all with no error, not in domoticz, nor in python...
it... simply... quit to execute commands...
The most dangerous phrase in any language is:
"We always done this way"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scripting Execution Queue issue

Post by waaren »

emme wrote: Wednesday 17 July 2019 7:55 Cia waaren, thanks!

I use to log to console from the python script.
Script runs correctly: it logs the connection to the remote cloud, list the devices and confirm activation.

I run all with no error, not in domoticz, nor in python...
it... simply... quit to execute commands...
If I understand your problem description and answer correctly;
if the device in domoticz is switched to On, the python script is triggered with the right parms.

I must overlook something then because I don't see any link with the domoticz event system / dzVents in this.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Scripting Execution Queue issue

Post by emme »

yes, that's correct...
for instance: to switch on the power plug 1 on device idx 0 the script execute as on/off action:
/home/pi/Meross/meross.py 0 1 1
to switch it off
/home/pi/Meross/meross.py 0 1 0

the only "link" in scripting could be a line in which I issue a dz.devices("MerossPlug1").switchOn()
The most dangerous phrase in any language is:
"We always done this way"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scripting Execution Queue issue

Post by waaren »

emme wrote: Wednesday 17 July 2019 8:25 the only "link" in scripting could be a line in which I issue a dz.devices("MerossPlug1").switchOn()
But does this command switches the device to On and is the Python script then triggered ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Scripting Execution Queue issue

Post by emme »

yes it does
manual switch act correctly
by script no command is executed.

Once the situation happen NONE command are execute anymore via script... also normal command (like zwave device or a simple variable update) are no longer executed

that's why I was thinking about a command queue subsystem....
The most dangerous phrase in any language is:
"We always done this way"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scripting Execution Queue issue

Post by waaren »

emme wrote: Wednesday 17 July 2019 8:57 Once the situation happen NONE command are execute anymore via script... also normal command (like zwave device or a simple variable update) are no longer executed
I am confused about the terms you use. If you say NONE commands are executed anymore via script...

are you referring to the OS python script, or the dzVents script issuing the dz.devices("MerossPlug1").switchOn() command, or do you mean all dzVents scripts?

How do you get out of this situation ? Is a domoticz restart enough or do you have to take other measures.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Scripting Execution Queue issue

Post by emme »

I'm referring to scripting command.... both dzvents or lua or whatever
scripts runs correctly... but if in the script you have a device/variable update, this is not committed
I can print, notify on log debug and everything else.... but... I cannot change device state nor variables.

To recover this I have to restart the domoticz service.
than it runs correctly for few days and back...
The most dangerous phrase in any language is:
"We always done this way"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scripting Execution Queue issue

Post by waaren »

emme wrote: Wednesday 17 July 2019 10:48 ..To recover this I have to restart the domoticz service.
than it runs correctly for few days and back...
OK. Think I have the picture now.

Would it be an option to enable debug logging on dzVents and domoticz ? I would also make a copy of your database before restarting domoticz when you encounter problem. Maybe there is something there that could help identifying the root cause.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Scripting Execution Queue issue  [Solved]

Post by emme »

ok,
I'll start re-simulate this evening, as soon as the problem will arrive I'll provide you log, debug and db :P
thanks
ciao
M
The most dangerous phrase in any language is:
"We always done this way"
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest