How are folks handling motion-based automations that require knowledge of the direction of the motion? Closets and rooms are easy; if there is motion - turn the light on. I’m running into trouble in hallways and stairs. If I’m going down the stairs, I want to turn on the downstairs hallway light. If I’m going up the stairs, I want the upstairs hallway light to go on and the downstairs one to go off.
It works well for me to have detectors in each area, and individual Smart Lighting automations which shut the light back off after a few minutes of no motion. It doesn’t work great with rooms where you might have trouble getting full coverage with the sensor, but for a hallway I would expect it to be sufficient.
To detect direction you would need two motion detectors covering each stairway, and either a bunch of virtual switches and automations or some WebCore code to process it.
You can set up an instance of this app for just those two lights. I use this app for a mode when I’m the only person home. Basically only one light in the group can be on at a time. My existing motion rules stay in effect but this app shuts the lights off behind me faster than the normal motion timeout.
I see. For me, it might be tricky to place aim multiple motion sensors properly on these stairs. I might just use the time of day to guess the motion. i.e. in the morning, motion on the stairs should turn on the downstairs light and then let “goodbye” routines turn off the upstairs lights when I leave. Thanks for the suggestions!
Use webCoRE and use logic like below:
Assuming motion 1 is at the bottom of the stairs and motion 2 is at the top…
If motion 1 changes to active
And
Motion 2 is inactive
Then set Variable {goingup} to true
If motion 2 changes to active
And
Motion 1 is inactive
Then set Variable {goingup} to false
If Motion 1 and 2 are inactive
Then set Variable {goingup} to waiting
The Variable will indicate direction. Now you can use it in your rule.
If Variable {goingup} changes to true
And
Time is between x and y
And
Upsatais light is off
Then with upstairs light
Turn on
With downstairs light
Wait 10 seconds
Turn off
If Variable {goingup} changes to false
And
Time is between x and y
And
Downstairs light is off
Then with downstairs light
Turn on
With upstairs light
Wait 10 seconds
Turn off
Of course tweak as you see fit and add some fail safes!
The Piston example below is different from your scenario but give you a starting point: