What are thoughts around using two open closed sensors (storm door and regular door) to determine which way you are going through a door. Could you do it if you used time as the primary determinant in the rule?
The use case is the screen door opens then the regular door opens turn on the room light in the house, going the other way turns on the garage lights.
In my case the hub would be less than 10 get from the sensors, so I'm guessing that the network speed shouldn't be a huge factor.
That sounds interesting.. maybe store a timestamp of each contact "open" event in a global and always compare the 2 to see which one is greater given a certain time limit - that could get you a "direction" possibly.. the issue though would be how would you handle the edge cases like someone coming in and someone going out nearly at the same time?
Yeah I changed it to "open" after thinking about it.. there are many ways to handle this.. but was thinking global (or flow) vars might be an easy way.
note: there are likely much better ways than my 5 second solution. A Function node could probably simplify stuff etc. Those last grey nodes on the right are just NOOP placeholder nodes.
As an aside - being able to do quick mockups is yet another reason I love the visual aspect of Node-RED.
If you really wanted to have fun then in place of those NOOP nodes you could use the LinkIn/Out Nodes to connect to other sequences anywhere.
OR
You could publish the result to an MQTT server via the "MQTT Out" node and trap a direction "event" by using the "MQTT In" node similar to the way you would use the HE Device node.. the "MQTT in" node could then be used in any sequence you want.
There is a simple MQTT server in the palette you can use for this purpose called "node-red-contrib-aedes" - runs locally easy to set up.
Thank you for your ideas. I'm going to play around a little with it to see if this will be quicker than the motion sensors I'm using currently, or some combination so the lights get turned on quicker.