Commandarray not executed

Moderator: leecollings

Post Reply
Tinfinity
Posts: 6
Joined: Sunday 28 October 2018 11:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Commandarray not executed

Post by Tinfinity »

Hi Everyone,
Already for 2 years I'm facing a very annoying issue with my domoticz installation.
0.1% of all commands are simply not executed for some reason, and I have no clue why.

An example from today:
In one of my device-scripts I have the following if-statement:

Image
'Alle woonkamerverlichting' is a selector switch.

Today at 12:33 the device 'donker' went off, because I opened the curtains.
This is confirmed in the log of the device:

Image

However, the big problem is that the selector switch 'Alle woonkamerverlichting' was not turned off. the log of the device shows nothing at 12:33.

This happens only a few times per week and most of the times I don't notice it of course. I wonder what could be happening??

In the log there are no errors.
So either the device-changed trigger is somehow 'missed' by domoticz or the commandarray to turn of the selector switch is not executed.
or could it be that domoticz gets overwhelmed if there are multipe triggers or incoming mqqt messages (from sensors) at the same time?

Many thanks in advance!!

For me its a big issue because I can't rely on domoticz anymore. I have to write my scripts now in such a way that commands are always executed multiple times...
User avatar
jvdz
Posts: 2335
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Commandarray not executed

Post by jvdz »

Do you have any message in the domoticz.log for that script?
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Tinfinity
Posts: 6
Joined: Sunday 28 October 2018 11:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Commandarray not executed

Post by Tinfinity »

No nothing unusual.

The switch 'donker' went from On to Off.
And nothing happend with the selector switch 'Alle woonkamerverlichting' while actually it should go from On to Off.

The issue is not related to this script. I have this issue with all of my scripts. Sometimes the commandarray simply seems not to be executed without any message or error.
User avatar
bewo
Posts: 74
Joined: Monday 13 July 2015 12:27
Target OS: Linux
Domoticz version: 2021.1
Location: Bavaria - Germany
Contact:

Re: Commandarray not executed

Post by bewo »

Hi Tinfinity,

are you sure your example-script ist working sometimes? :shock: I think it will work never. :?

The state "Off" isn't normally available in an selector switch. You should work with the levels in your selector switch.
So your code should be something like:

Code: Select all

if devicechanged['Donker'] == 'Off' then
    commandArray[#commandArray+1] = {['Alle woonkamerverlichting'] = "Set Level 0" }
end
The level numbers are 0, 10, 20, 30 and so on. You can find it in the switch options.
Individual projects:
Domoticz on a Intel Xeon Server | AeonLabs Z-Wave Gen.5 | RFXCOM RFXtrx433E USB | ESP-Wifi-Modules | Shellys
Wall-mounted 22" Touch Control Display (self construct) | LUA wind monitor| LUA heating control | and many many more :)
Tinfinity
Posts: 6
Joined: Sunday 28 October 2018 11:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Commandarray not executed

Post by Tinfinity »

Hi. Thanks for your message.
The script is working fine for many years.
Selector switches indeed need a 'Set Level' command but the Off command is also supported. I use it a lot and works fine.
Toulon7559
Posts: 859
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Commandarray not executed

Post by Toulon7559 »

From own experience:
the method of opening and closing of the command array has effects on it's operation.
Not visible in your script-segment:
how/where do you open and close the command array?
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Tinfinity
Posts: 6
Joined: Sunday 28 October 2018 11:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Commandarray not executed

Post by Tinfinity »

Toulon7559 wrote: Saturday 04 September 2021 10:47 From own experience:
the method of opening and closing of the command array has effects on it's operation.
Not visible in your script-segment:
how/where do you open and close the command array?
Ok interesting. Well ?I just open it at the start of the script with: commandArray = {}
And I close it with: return commandArray (at the end of the script)

I think this is the standard way? is there a better way to do it?
Toulon7559
Posts: 859
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Commandarray not executed

Post by Toulon7559 »

Just check & recheck, because ;) sometimes obvious aspects are missed .......

Some people prefer to open and close the command-array closer before and closer behind the script-segment dealing with the command-array, like shown in the wiki.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Tinfinity
Posts: 6
Joined: Sunday 28 October 2018 11:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Commandarray not executed

Post by Tinfinity »

I only know that way to open and close the command-array.
Is there another way?
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest