Page 1 of 1

Reset a timing event

Posted: Thursday 09 November 2017 22:01
by dpcreel
I have a question that has been asked before but I don't think it has been answered - viewtopic.php?f=31&t=19255&p=149148&hil ... in#p149148. It has to do with resetting a timed event. Example if I write

Code: Select all

switchOff().afterMin(10) and not(domoticz.devices('motion sensor').bState)
it will activate a switch OFF after 30 min if there is no motion. However if sometime during that 10 min period motion is detected and I want to keep the light ON, the light will still shut OFF after 10 min no matter the status of the motion sensor. No matter if I switchOn().

Is there a way to reset a timed event?

To get around this I have used a function that gets the current time in minutes, add a delay number to it and compare that to the current time in minutes. It can be easily reset at any time unlike afterMin().

Am I missing something? Anything easier?

Re: Reset a timing event

Posted: Friday 10 November 2017 8:27
by dannybloe
Yeah, wait for dzVents 2.4.0 (it is in the making now) and it will have a .cancelQueuedCommands() method.
In the meantime, afaik, any new command will also remove the queued commands. So you can try to send a .setState(myDevice.state). That should reset it as well.

Re: Reset a timing event

Posted: Friday 10 November 2017 8:30
by BakSeeDaa
Great news @dannybloe

dzVents keeps getting better and better all the time :)

Re: Reset a timing event

Posted: Friday 10 November 2017 22:08
by dpcreel
Ditto, thanks.