Problem with timer since 2021.1 update  [Solved]

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

Moderator: leecollings

Post Reply
dlube
Posts: 29
Joined: Tuesday 31 March 2020 19:29
Target OS: -
Domoticz version:
Location: France

Problem with timer since 2021.1 update

Post by dlube »

Not sure that it's a dzvents problem...
At 00:30, depending on the water temperature I set the timer (API Json) of the switch (enocean) of the pump.
The steps are these ones:
- Clear the timer
- Add timer to start the pump
- Add timer to stop the pump

Before the last update of Domoticz my script was working fine.
Today, sometimes it works and sometimes I have only the timer to stop the pump or nothing.
There is nothing in the logs which show something wrong.
Do you have any idea of the source of the problem?
Raspbian Buster on Raspberry pi 3 B+ Domoticz Version: 2023.2 (build 15474)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Problem with timer since 2021.1 update

Post by waaren »

dlube wrote: Saturday 08 May 2021 18:57 Before the last update of Domoticz my script was working fine.
You refer to a possible problem in a dzVents script. To understand what could be the issue it would be helpful to see the script.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dlube
Posts: 29
Joined: Tuesday 31 March 2020 19:29
Target OS: -
Domoticz version:
Location: France

Re: Problem with timer since 2021.1 update

Post by dlube »

This simple script does not work all the time.

Code: Select all

domoticz.openURL({url = domoticz.settings['url']..'/json.htm?type=command&param=cleartimers&idx=001})
domoticz.openURL({url = domoticz.settings['url']..'/json.htm?type=command&param=addtimer&idx=001&active=true&timertype=3&hour=6&min=0&randomness=false&command=0&days=1234567'})
domoticz.openURL({url = domoticz.settings['url']..'/json.htm?type=command&param=addtimer&idx=001&active=true&timertype=3&hour=0&min=0&randomness=false&command=1&days=1234567'})

I have the feeling that each openURL are not done in this order.
Sometimes I have both timer 'On and 'Off', sometimes only the 'Off' and sometimes nothing.
However, the log file looks correct.
I'm currently testing a callback in the clearTimer URL and to execute 'On' and 'Off' settings in the HttpResponse.
Last edited by dlube on Tuesday 11 May 2021 11:34, edited 1 time in total.
Raspbian Buster on Raspberry pi 3 B+ Domoticz Version: 2023.2 (build 15474)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Problem with timer since 2021.1 update  [Solved]

Post by waaren »

dlube wrote: Tuesday 11 May 2021 9:52 This simple script does not work all the time.
I have the feeling that each openURL are not done in this order.
The order in which commands from Lua / dzVents script will be executed is not guaranteed.
Also: domoticz.openURL() commands are in recent versions executed in separate threads, making the execution order even more unpredictable.
What you could do to improve the predictability is using the .afterSec() option.

e.g.

Code: Select all

domoticz.openURL(domoticz.settings['url']..'/json.htm?type=command&param=cleartimers&idx=001')
domoticz.openURL(url = domoticz.settings['url']..'/json.htm?type=command&param=addtimer&idx=001&active=true&timertype=3&hour=6&min=0&randomness=false&command=0&days=1234567').afterSec(2)
domoticz.openURL(url = domoticz.settings['url']..'/json.htm?type=command&param=addtimer&idx=001&active=true&timertype=3&hour=0&min=0&randomness=false&command=1&days=1234567').afterSec(4)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dlube
Posts: 29
Joined: Tuesday 31 March 2020 19:29
Target OS: -
Domoticz version:
Location: France

Re: Problem with timer since 2021.1 update

Post by dlube »

It's important that the cleartimer is executed first.
This is the reason why I added a callBack which seems working fine.
Thank you
Raspbian Buster on Raspberry pi 3 B+ Domoticz Version: 2023.2 (build 15474)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest