NodeRed: Triggering lights after two motion sensors are active within 60 seconds of each other

I have 4 outdoor motion sensors and I want to only trigger the outdoor lights when two of them have been triggered within 60 seconds of each other - this should prevent moths and other insects from triggering the lights in the night.

This is beyond my nodered expertise, I've don't lots of nodered so I get most of the basic concepts but I need a pointer on how to solve this is someone is able to help?

Solving my own issue :slight_smile:

node-red-multi-sensor (node) - Node-RED (nodered.org)

2 Likes

You can do this quite easily in RM too using wait for events. I find it easier to do this and then feed the output via a virtual motion sensor to NR.

Yeah, I used to use an App in HE but I've moved all rules to NR leaving HE just to look after Zig/Z-Wave management.

3 Likes

That looks like a handy node...

edit: Maybe you could also have used a Finite State Machine node but the MS node looks more tailored to your situation..

1 Like

:+1:

Or even one of the Boolean nodes.

Or even string the motion sensor nodes together, where only the first one can send events, while the state of the second is checked.

2 Likes

That's how I would have done it. But I am very picky about keeping my palette as lean and mean as possible, so tend to do as much as possible in the built-in nodes. The built-in nodes are guaranteed to be supported and updated node-red release to release, and node.js release to release... User ones - well, not so much.

3 Likes

That's what I do. Keeps it simpler as well.

1 Like

Yeah that seems to be a very sensible approach.. I probably need to be more vigilant about that. I do tend to encapsulate 3rd party stuff in subflows where feasible which allows me to easily tweak things and provide consistent behaviors across flows/sequences. I did get a burned on the "Unsafe Function Node" behavior diverging from the system one after a few updates and had to swap it out.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.