I have an event that when a certain temp sensor is >= X then it sends an switchOff().afterSec(900) command. So when the value reaches X, I want to send the OFF command to the device 900 seconds later.
But the temp sensor gets updates every approx 60 seconds. Eventually the OFF command is never sent as I expect that the next minute the afterSec() command will overwrite the previous queue command. Eventually the OFF command is always scheduled, net never met.
Is there a function to solve this? I can create a dummy device and set the 'new' value and only send the switchOff().afterSec(900) command when the dummy value is not off, but this is not a nice solution.
Is there a way to read the queue and if there is already a switchOff() command in the queue, then ignore, if there's nothing in the queue, then schedule the command.
afterSec() cancels previous afterSec()
Moderator: leecollings
- waltervl
- Posts: 5732
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: afterSec() cancels previous afterSec()
In the script, the first time the sensor >=X set a variable to true after you have set the switchOff().afterSec(900) . Also do the switchOff().afterSec(900) only when >=X and variable is false (set it to false on setup).
Set the variable to false when <X
Set the variable to false when <X
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Re: afterSec() cancels previous afterSec()
Yes that is what I've meant with my first option as a workaround, use a helper variable. But it doesn't feel nice and I was wondering if there is a way to not overwrite the queue, but either read the queue (and then don't overwrite it in the script) or simply add a command to the queue
- waltervl
- Posts: 5732
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: afterSec() cancels previous afterSec()
I do not think there is another way. See also https://www.domoticz.com/wiki/DzVents:_ ... ggering.29
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Re: afterSec() cancels previous afterSec()
Ok I'll implemented it with using a helper variable
Who is online
Users browsing this forum: No registered users and 1 guest