Resetting a NodeRed Time Delay node in a sequence

So, what I want to do, is to reset the time in a “DELAY” node. Right now, when I toggle, a Sonoff ON, the NodeRed sequence that has a 20 minute delay, turns OFF, 20 minutes later.

The following is the code for the above sequence.

[{"id":"7feb05f2.e27b3c","type":"server-state-changed","z":"c43dc3f2.667b","name":"Toggle Sonoff T1","server":"66f9160a.09b8e8","entityidfilter":"switch.sonoff_switch_t1","entityidfiltertype":"substring","haltifstate":"","x":160,"y":80,"wires":[["65129506.c20bbc"]]},{"id":"679a54b1.3783fc","type":"api-call-service","z":"c43dc3f2.667b","name":"Turn Off Sonoff T1","server":"66f9160a.09b8e8","service_domain":"switch","service":"turn_off","data":"{\"entity_id\":\"switch.sonoff_switch_t1\"}","mergecontext":"","x":690,"y":80,"wires":[[]]},{"id":"65129506.c20bbc","type":"switch","z":"c43dc3f2.667b","name":"switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":80,"wires":[["421e8a8c.a45ca4"],[]]},{"id":"421e8a8c.a45ca4","type":"delay","z":"c43dc3f2.667b","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":480,"y":80,"wires":[["679a54b1.3783fc"]]},{"id":"66f9160a.09b8e8","type":"server","z":"","name":"Home Assistant","url":"https://MyDomain.duckdns.org:8123","pass":"xyz123abc456"}]

With the 20 minute delay, if I toggle the Sonoff ON, and about 15 minutes later, I were to toggle the Sonoff OFF then back ON. 5 minutes later the Sonoff would turn OFF. What I would like, is when I Toggle the Sonoff, OFF then ON, 15 minutes later, the timer to reset back to “0”. So the Sonoff take another 20 minutes before it turns OFF.

Can someone show me what I need to add, that will cause the “Delay” node to restart the it’s timer.

Use the BigTimer node. To turn it on for 20-minutes, just send a message of “1200” to the input. (To turn it off, send “0”).

When you get a “Toggle Sonoff T1”, use a function or change node to send “1200” to bigtimer, and that resets it to 1200 seconds (20*60).

A little quirk in bigtimer, set the start and end times to 00:00, and put anything you want for the latitude and longitude, even 0,0, or bigtimer won’t deploy.

Sig

Thanks, I will check it out.

I’m using the node myTimer … works perfect

image