I am attempting to use Node-RED for door monitoring in my workshop. I am fairly new to Node-RED, and HA for that matter.
What I would like to have happen is as follows (most of this works):
When the door is opened, check to see if the shop lights are currently on.
If the lights are on, speak a welcome message through the Amazon Echo Dot in the shop. (This works)
If the lights are not on, send a notification to my mobile, speak a different message through the Echo Dot, and turn on the shop lights. This also works.
What I want to also happen is for a message to be spoken if the door has been open for x amount of time - I.E. after 2 minutes say something like ‘the door has been left open’ or whatever I decide upon. It is this 2 minute delay that I am struggling with. What I want to happen is, when the door is opened a timer starts. If the door is closed before it expires, the timer is stopped and reset until the next time the door is open. If the timer expires, then I want the door ajar message to be spoken.
At this stage, I am still learning how to get things linked together. I worked out what I have so far through searches and reading the assorted documents. This time thing has me stumped. I thought the delay function might be what I need, but it only seems to delay the passing of the message/signal. I need a simple resettable timer that can be stopped.
Here is what I currently have:
(Edited to clarify the timer line at the end)
