From 8724cece26c9e86d551a350c6d92364d40a66e42 Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Fri, 30 Aug 2024 15:25:52 +0100 Subject: [PATCH] bathroom_light: trust switchbot if more recently updated --- modules/services/homeassistant.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/homeassistant.nix b/modules/services/homeassistant.nix index 575eaec..3ac4620 100644 --- a/modules/services/homeassistant.nix +++ b/modules/services/homeassistant.nix @@ -115,7 +115,7 @@ in lights = { bathroom_light = { unique_id = "87a4cbb5-e5a7-44fd-9f28-fec2d6a62538"; - value_template = "{{ states('sensor.bathroom_motion_sensor_illuminance_lux') | int > 500 }}"; + value_template = "{{ false if state_attr('script.bathroom_light_switch_if_on', 'last_triggered') > states.sensor.bathroom_motion_sensor_illuminance_lux.last_reported else states('sensor.bathroom_motion_sensor_illuminance_lux') | int > 500 }}"; turn_on = { service = "script.noop"; }; turn_off = { service = "script.bathroom_light_switch_if_on"; }; };