So I have the P2 motion sensor hooked up to a H2 Light switch. is there a way to have the light stay on for about 30 mins? or turn off if no motion is dected for about 10 mins? M3 Hub and Homekit and Home Assistant available for automation. I am not sure what I am doing wrong I have tried it a couple different ways. nothing seems to work out.
1 Like
Hi, I have done something similar in Home Assistant. This is the logic that I would try to implement:
- You have a timer that lasts 10 minutes.
- This timer remembers how much time is left even if Home Assistant restarts.
- It’s the “countdown” for how long the light should stay on.
- Automation 1 – Starting or resetting the timer:
-
If someone presses the Zigbee switch or motion is detected:
- Turn the light on (just in case it isn’t already).
- Start the 10-minute timer, or reset it back to 10 minutes if it’s already running.
- Automation 2 – Turning the light off:
-
When the 10-minute timer finishes counting down:
- Turn the light off.
- Optional Automation – Cleaning up:
-
If the light is turned off manually before the timer ends:
- Cancel the timer so it’s not sitting there waiting to turn off a light that’s already off.
Result
- A switch press or motion always ensures the light is on and gives it a fresh 10-minute “stay on” window.
- Motion keeps resetting that countdown, so the light stays on as long as the room is active.
- When nobody’s there for 10 minutes, the light turns off.
- This works even after a Home Assistant reload, because the timer’s state is restored.
1 Like