Timer issues in Node-RED

I have setup several timers (e.g. Light timers) but having a few challenges

  1. Timer finished - This event is never reaching Node-RED. The state changes from active -> idle which is the same behavior when timer is cancelled
  2. Due to above, my light is switching-off whenever the light timer is changing from active->idle … causing below issue
  3. Timer reset - I want to reset an active timer to its start period (e.g. Reset light timer to 5min whenever a motion sensor was triggered) … unfortunately I have to cancel the timer and than start the timer (will switch-off the lights :weary: before timer restarts)

Is there a way to reset a timer maintaining the active status ?

check this node: node-red-contrib-stoptimer
This is what I use for my motion sensor.

yes, I have a similar solution by using a delay of 3-5sec as a workaround, and it works in 90% of all situations but occasionally the delay/stop-timer is not enough (due to other activities in Node-RED).

A real timer-reset (without setting state = idle) would be great.

In automation-mode I could distinguish Canceled/Finished timer by their state (idle/finished) but this is not detected in Node-RED

Just add another node after the timer node that checks status of the motion sensor. If the motion sensor is on connect it to the timer node - it will restart the counter.

The problem is not the restart of the timer … When the timer is finished I use the timer-trigger to switch off the lights.

This is resulting that the timer-trigger is getting to IDLE… switching off the lights … and the timer-reset is resetting the light-timer … but the light has already gone out instead of keeping switched on for the timer duration

@xx_Nexus_xx are you creating timers in HA and then reacting on them in NR? Have you tried trigger node (node-red built-in trigger not home-assistant trigger-state) ?

I’ve found this method works well, use the “Event: all” node with the event type of “timer.finished”. After this use a “Switch” node to filter which timer has finished.

1 Like

I’m nut using the HA timer anymore and have moved my entire automation into NR as there are much more functionalities and flexibilities available.

I’m using HA primarily for the Lovlace Interface to provide status updates these days

This fixed the issue for me.

I am having the same issue that the event -> timer from node-red does not catch the timer.finished . But this solution with event all and timer finished worked for me.

Sounds like you need the Trigger node. Set it to reset on a “True” input… note that that node is kinda drunk… It needs to be set to “True” for its reset… not “true”. even though “true” it what is in the payload that hits it. the offwhite trigger nodes reset every time the light is turned on or motion is detected. time window block determines whether it is a 10 or 25 min delay.

1 Like

Sorry, I know its an old topic. But the answer works.
(Altough I wish there was a more elegant node type that could filter on entity attributes directly)

For the benefit of other noobs like me (who struggle with the switch node)

The Switch_node has:
Property msg.payload.entity_id
== timer.mytimer

And Thanks Dave