Seems to be solved in 2021.1
[/EDIT]
Sometimes lines put into the commandarray are not executed.
Because I suspected the array was not always executed, I created two scripts, devicebased and a time based (acting as a watchdog)
The idea is that tWakeupAssist is triggered using a timer. This works fine.
Next, when the tWakeupAssist is set 'on' it should be set 'off' and some actions are triggered (indicated by "...some other actions are triggered...")
The timebased script, tests if the tWakeupAssist is 'on' for more than 2 minutes.
If the device is still on, the devicebased script has probably failed to run. So, tWakeupAssist is triggered again.
I checked the error-log, but it shows no errors.
The script fails approx. once or twice a month. De device is triggered every day.
Who could give me a suggestion to fix this failing script?
Devicebased lua script:
Code: Select all
if (deviceName=='tWakeupAssist') then
if deviceValue == "On" then
commandArray[#commandArray + 1] = {['tWakeupAssist'] = "Off"}
end
...some other actions are triggered...
end
Code: Select all
---------------------------------------------
-- WakeUpAssistant Check trigger
---------------------------------------------
if otherdevices['tWakeupAssist']=='On' then
difference = timedifference(otherdevices_lastupdate['tWakeupAssist'])
if difference >= 2 then
commandArray[#commandArray + 1] = {['SendNotification']='WakeUpAssistant Trigger Failed'}
commandArray[#commandArray + 1] = {['tWakeupAssist'] = 'On'}
end
end