Sonoff motion sensor automation

Good morning,

I am using Zigbee2MQTT, and I have two Sonoff motion sensors connected to it. One motion sensor is mounted above the door at the entrance, and the other is located upstairs by the staircase. On the top floor, there is only the bathroom. To avoid walking in the dark on the stairs, I created two separate motion automations.

When I walk from the hallway to go upstairs (to the bathroom), the light in the hallway turns on and stays on for two minutes. Then I proceed up the stairs, and the other motion sensor detects my movement. However, when I walk back downstairs, the hallway light turns off, leaving me to descend the stairs in the dark. How is this possible? The motion sensor on the stairs detected me, right? Why does the first motion sensor override my movement and still turn the hallway light off after two minutes?

I also tried linking both motion sensors in the same blueprint, but I still didn’t get the desired result.

My specific question: how can I ensure that the motion sensor on the stairs (or vice versa) always sends the last update to the light, and from that point, the light stays on for two minutes before turning off? Instead of the light turning off two minutes after the first detection?

You should also post the automations you have coded so far which are not working as expected to let the community have a look at them to be able to support you.

Without seeing what you have done so far all support attempts are just shots in the dark.

Home Assistant is event driven. Your two automations have no idea what the other is doing, or that it even exists. Your automations are more than likely only set up to turn on the light when it first detects motion, but that doesn’t mean they will forcefully keep the light on (unless you explicit write your automation to accomplish that).

For the same reason you cannot simply add two motion sensors to the trigger of the automation. That way the light would turn on when either sensor detects motion, but they would also turn off when either sensor stops detecting motion, even if the other sensor is still detecting motion. The solution is to add a condition so that lights turn on when either motion sensor activates, but lights turn off only when both sensors are off.

Or if you prefer, make a helper that combines the state of both motion sensors.