From f674f61b8d65f61b1b88255c47a8f4919db2f9d4 Mon Sep 17 00:00:00 2001 From: Bastian de Byl Date: Mon, 28 Sep 2026 11:32:24 -0400 Subject: [PATCH] fix(hass): don't fire on-off automations when a device reconnects The Bedroom Light HS200 dropped off Wi-Fi for 5 s at 03:01 and came back reporting "on"; the Bedroom On device trigger treated unavailable -> on as someone flipping the switch and lit the bedroom Hue lamps at 100%. Bedroom On/Off and TV On/Off now use state triggers with not_from unavailable/unknown, so reconnects and HA restarts no longer count as a flip. The driveway's switch-reconnect catch-up is dropped for the same reason (it would undo a manual off); the HA-restart catch-up stays. Co-Authored-By: Claude Opus 5.5 --- .../roles/podman/files/hass/automations.yaml | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/ansible/roles/podman/files/hass/automations.yaml b/ansible/roles/podman/files/hass/automations.yaml index 13969e0..aee6a0b 100644 --- a/ansible/roles/podman/files/hass/automations.yaml +++ b/ansible/roles/podman/files/hass/automations.yaml @@ -195,11 +195,12 @@ description: TV mode on; once it's dark, dim the living room and turn off the lights that glare on the TV triggers: - - type: turned_on - device_id: 18a9bb7a2a32be4371da447767ef50a9 - entity_id: c05688f2610e27e2d86380e2945ceae5 - domain: remote - trigger: device + - trigger: state + entity_id: remote.samsung_tv + to: 'on' + not_from: + - unavailable + - unknown conditions: [] actions: - action: input_boolean.turn_on @@ -232,11 +233,12 @@ scheduled level; late night (23:30 to sunrise) only turns off the TV glow; daytime leaves the lights alone triggers: - - type: turned_off - device_id: 18a9bb7a2a32be4371da447767ef50a9 - entity_id: c05688f2610e27e2d86380e2945ceae5 - domain: remote - trigger: device + - trigger: state + entity_id: remote.samsung_tv + to: 'off' + not_from: + - unavailable + - unknown conditions: [] actions: - action: input_boolean.turn_off @@ -268,7 +270,7 @@ - id: driveway_lights_on alias: Driveway String Lights On description: On 1 hour before sunset whether or not the TV is on. Also catches - up if Home Assistant restarts or the switch reconnects before the 23:00 off + up if Home Assistant restarts before the 23:00 off triggers: - trigger: sun event: sunset @@ -276,10 +278,6 @@ id: sunset - trigger: homeassistant event: start - - trigger: state - entity_id: switch.driveway_string_lights - from: unavailable - to: 'off' conditions: - condition: state entity_id: switch.driveway_string_lights @@ -399,11 +397,12 @@ alias: Bedroom On description: '' triggers: - - type: turned_on - device_id: afb9734fe9b187ab6881a64d24e1c2f5 - entity_id: 27efa149b9ebb388e7c21ba89e671b42 - domain: switch - trigger: device + - trigger: state + entity_id: switch.bedroom_light + to: 'on' + not_from: + - unavailable + - unknown conditions: [] actions: - action: light.turn_on @@ -417,11 +416,12 @@ alias: Bedroom Off description: '' triggers: - - type: turned_off - device_id: afb9734fe9b187ab6881a64d24e1c2f5 - entity_id: 27efa149b9ebb388e7c21ba89e671b42 - domain: switch - trigger: device + - trigger: state + entity_id: switch.bedroom_light + to: 'off' + not_from: + - unavailable + - unknown conditions: [] actions: - action: light.turn_off