Fix incorrect light value changes

Using the force-off of light_off during presence detection change would
sometimes cause the response LEDs to disable prematurely, since the
on_state can trigger seemingly at random. Switch to using a separate
handler for this, which will instead execute after a hold ends (and both
our responses leverage holds so this works in all cases).
This commit is contained in:
2025-10-05 02:31:16 -04:00
parent a8499a27b2
commit 565dac1946

View File

@@ -165,6 +165,20 @@ globals:
initial_value: '"mww_computer"' initial_value: '"mww_computer"'
script: script:
- id: presence_light_on
then:
if:
condition:
- switch.is_on: enable_presence_led
- light.is_off: output_led
then:
- light.turn_on:
id: output_led
brightness: 25%
red: 1
green: 1
blue: 1
transition_length: 1s
- id: light_off - id: light_off
then: then:
if: if:
@@ -817,7 +831,7 @@ binary_sensor:
device_class: occupancy device_class: occupancy
on_state: on_state:
then: then:
- script.execute: light_off - script.execute: presence_light_on
- platform: gpio - platform: gpio
name: "PIR GPIO" name: "PIR GPIO"