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:
@@ -165,6 +165,20 @@ globals:
|
||||
initial_value: '"mww_computer"'
|
||||
|
||||
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
|
||||
then:
|
||||
if:
|
||||
@@ -817,7 +831,7 @@ binary_sensor:
|
||||
device_class: occupancy
|
||||
on_state:
|
||||
then:
|
||||
- script.execute: light_off
|
||||
- script.execute: presence_light_on
|
||||
|
||||
- platform: gpio
|
||||
name: "PIR GPIO"
|
||||
|
Reference in New Issue
Block a user