Stairs: motion sensor and a light

Hi, I have a , I think, a typical situation:

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),

What is a solution?

2 movement sensors?

mmhhh, and how?

How would be the programming?

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

mmhh but when you go from up to down, when you arrive down it will triger the light on …?

So it only triggers when I go from down to up after sunset.

sorry I don’t get it
basement_motion_sensor_5_0 is down
and
stairwell_motion_sensor_4_0 is up?

if you go from down to up, it will turn on only when you arrive on top … no?

Correct:

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 :slight_smile: .

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.

basically the stairwell should be half way … for me is fine, I do have some light down. Will try tonight. Thanks!

I get it but , is not working …

EDIT: is working

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.

1 Like

which sensor do you have?

I have the xiaomi and the reset time is 60 seconds, so really no risk of resetting (actually would like to hack it and make it less)

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.

40 bucks!!!

Mine is 10!

I have the Ecolink sensor and have it set for test. Test is 10 seconds. After a year, my battery level is at 80%.

What sensor are you using?

they are perfect so far, and very very small

http://www.gearbest.com/smart-light-bulb/pp_257678.html?wid=21

How do you connect these?

you need the xiaomi gateway (around 35$)

and then in HA