Stairs connecting living room (below) to night room (above).
My goal is the following: turn on upstairs lights when I go up (at night); turn off upstairs lights when I go down.
If I use a movement sensor it will not work well (the sensor does not know if I go down or up),
For example:
case a) Below sensor activated (and is night), ok turn on upstairs light (but only if above sensor previously activated, otherwise it will turn light on also when I go down …)
case b) Above sensor activated, ok turn off (but only if previously the below sensor was not activated, otherwise it will turn off the light when I go from down to up, and I am in the middle of the stairs probably …)
I have the same use case - no switch by the stairs coming up from the basement, so used to play blind-mans-bluff when I came home. Here is my automation. The basement sensor is gets tripped before you go up the stairs.
# Turns on lights at sunset
- alias: 'Rule 3 Welcome Home light in kitchen'
trigger:
platform: state
entity_id: binary_sensor.stairwell_motion_sensor_4_0
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.basement_motion_sensor_5_0
state: 'on'
- condition: sun
after: sunset
action:
service: light.turn_on
entity_id: light.kitchen_dimmer_level_9_0
The basement sensor is at the bottom of the stairs pointing into the basement,
the stairwell sensor is partway up the stairs. When I come into the house, the basement sensor is tripped and if I continue on to the stairs, the stairwell sensor is tripped. This works because the sensors reset after some relatively short period. It can get confused if we are crossing paths on the stairs .
So, if you look at the automation… when the stairwell sensor changes from off to on, AND the basement sensor is still on AND it is after sunset, the action (turn on kitchen light) is executed.
When you go down the stairs, the basement sensor is off, so the action is not executed.
I tested this without the sunset criteria first, just to get the syntax figured out, then added the second criteria.
I don’t think the location is too picky. You just have to ensure that there is no overlap in the field of view for the two motion sensors. So in my case I have the basement sensor on the outside of the stairwell wall, and the stairwell sensor on the inside of the stairwell under the railing, not too far from the bottom. That way I ensure that the basement sensor is tripped when I head for the stairwell but there isn’t enough time for the sensor to reset before I trip the one in the stairwell.
Ecolink Z-Wave PIR Motion Detector, Pet Immune (PIRZWAVE2-ECO)
I don’t recall what the default reset time is, but that sounds about right. There is a jumper to put it into test mode, which resets much faster, but I suspect that would impact the battery life.