I rebooted HA when automation was running and lamp was on and never goes off. I activated automation with motion sensor and it’s still running.
It stuck at waiting for 1 trigger:
- wait_for_trigger:
- entity_id:
- binary_sensor.lumi_lumi_sensor_motion_aq2_motion
to: "off"
for:
hours: 0
minutes: 0
seconds: 30
trigger: state
from: null
update: after some time it recovered itself
I wonder what if create 2 automations: first automation to turn lamp on trigger and second automation to turn off lamp ![]()
I see the problem is aqara motion sensor, it stuck in Motion: Detected state after HA restart for about 10 minutes that’s why my automation doesn’t work.
I did another test, I rebooted HA when state was Motion: Clear and after reboot it worked right away!
Is there a way to set or reset item state on boot maybe?
Update 2: I set python_script integration and now can set state for motion sensor when HA starts.
I also now have two automations: first automation to turn lamp on trigger and second automation to turn off lamp.
The reason I need a second automation because I need to constantly monitor duration of Clear state, without dealing with states transition (from detected to clear).
alias: turn off lamp
description: ""
triggers:
- type: no_motion
device_id: <id_here>
entity_id: <id_here>
domain: binary_sensor
trigger: device
for:
hours: 0
minutes: 0
seconds: 10
conditions: []
actions:
- type: turn_off
device_id: <id_here>
entity_id: <id_here>
domain: light
enabled: true
mode: single
This trigger type: no_motion should turn off lamp after HA restart if its on.
In my testing trigger based on state changes doesn’t work for some reason.
Update 3: I rebooted HA and lamp was on and sensor state was clear. My automation failed.
I guess I need to create automation to turn off lamp when HA starts and go back to my original automation…