Hi,
I’m struggling to work out how to get a sequence to trigger again after x minutes.
Senario:
When it is dark and I take the dog out before bed, between 21:00 & 23:00, as I open the back door, I want the back door light to come on only.
When I come in after ~5 minutes, I want the light to go out.
If it is dark and I need to go into the garden after 23:00, I want all garden lights to come on.
When I come in after ~5 minutes, I want the lights to go out.
- Door opens (and closes)
- If the time is between 21:30 & 23:00
- Sun is below the horizon (dark)
- Turn on the garden light A
- Wait for 1 minute
- Door opens after 1 minute but less than 30 minutes
- Turn off light A.
- Time is not between 21:30 & 23:00
- It is dark
- Door is opened
- Turn on all garden lights.
- Wait for 1 minute
- Door opens after 1 minute but less than 30 minutes
- Turn off all garden lights.
This is what I have so far:
(I have a temporary UI button for testing the binary door monitor)
The main difficulty is working out which type of event node I need to detect the door has been opened again. I looked at a pole node, but it appears it only runs every x seconds and if the door isn’t opened at exactly that moment it won’t fire as the binary sensor only changes state as the door makes or breaks contact.
I feel what would help is a state change node that allows input. I could then hook up delay to Door opened, but I guess there’s a reason why some nodes don’t allow input and I need to go down a different path.
Another idea is perhaps some sort of variable that logs the first occurrence of the door opening and then starts a pole at 1-second intervals to detect the second occurrence of the door opening. But, I notice the Pole state node doesn’t accept inputs either, so I don’t know how the Delay can hook into it.
A bit of a waffle, but I guess there’s some logic to Node-Red that I haven’t clocked on to yet, so any pointers would be gratefully received.
T. I. A.