Garage door and motion sensor working together

Hi,

Have a problem what I don't know how to resolve.
So I have a garage door with contact sensor Open/Close state.
Near this door have a motion sensor.
My problem is that the motion sensor see that the garage door is opening and send a message: "motion is detected" what I don't need it between opening situation.
I want that if the door is opening the motion sensor not do anything for about 1 minute.
After that time when the door is opened start working the motion sensor.
When the garage door closed stop the motion sensor message if detect any motion.

Thank You.

So you need a "gate" style interaction. Where 1 variable is used to check whether or not an event is passed through.

I think that one of the Finite State Machine nodes such as the DSM node may be easiest to deal with. Otherwise you can do it "manually".

When the door starts to open, send a signal which NR translates to updating a variable - say to TRUE - which is kept in a context store. In your motion sensor flow, check that variable before allowing the motion to be passed on to any other nodes.

Use a trigger node after the receipt of the door opening event so that the variable gets set to false after 1 minute:

Here is what I have now:


Motion detected then if the door open ring the doorbell and turn on gateway light.
But I don't need doorbell ring and light when the door opening in that minute. So how can I change it?
I'm a beginner so please if you can give step by step instruction. Thank You. :slight_smile:

As @TotallyInformation suggests, the key is to use a trigger node to send a pair of messages one minute apart when the door opens. There are many ways to use those messages to block signals from the motion sensor. I think that for a beginner the simplest way is to use the gate node (node-red-contrib-simple-gate). This flow should give you the general idea:

[{"id":"5e6daaca.bb46bc","type":"inject","z":"6d60db6b.03942c","name":"door opens","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":640,"wires":[["636503b1.bd70a4"]]},{"id":"636503b1.bd70a4","type":"change","z":"6d60db6b.03942c","name":"topic='control'","rules":[{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":640,"wires":[["b5c599d0.be505"]]},{"id":"b5c599d0.be505","type":"trigger","z":"6d60db6b.03942c","op1":"close","op2":"open","op1type":"str","op2type":"str","duration":"10","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":470,"y":640,"wires":[["3a37877e.e1f3f"]]},{"id":"3a37877e.e1f3f","type":"gate","z":"6d60db6b.03942c","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":630,"y":700,"wires":[["f2ea7904.9bac7"]]},{"id":"6d1db02e.e470c","type":"inject","z":"6d60db6b.03942c","name":"motion sensed","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":460,"y":700,"wires":[["3a37877e.e1f3f"]]},{"id":"f2ea7904.9bac7","type":"debug","z":"6d60db6b.03942c","name":"motion detected","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":780,"y":700,"wires":[]}]

The contact and motion sensors are simulated by inject nodes, and the time between messages is set to 10 seconds instead of one minute for the demonstration.

Perfect, I think now it's working. Will test it.

Thank You Both!

1 Like

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