Reset a timing event

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

Moderator: leecollings

Post Reply
dpcreel
Posts: 44
Joined: Friday 25 November 2016 14:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Reset a timing event

Post 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?
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Reset a timing event

Post 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.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Reset a timing event

Post by BakSeeDaa »

Great news @dannybloe

dzVents keeps getting better and better all the time :)
dpcreel
Posts: 44
Joined: Friday 25 November 2016 14:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Reset a timing event

Post by dpcreel »

Ditto, thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest