Hi all,
Seeking assistance on an automation I use for a bedroom headboard that uses a WLED strip.
It is used in my daughters bedroom and relies on a PIR signal to turn the headboard on with a white light if it is before midnight and then with a low brightness red light if triggered after midnight.
I’m a novice so I know this code will not be good.
It works fine for the use above however my daughter uses the WLED app on her phone also. So often she will manually adjust the color of the WLED and also wants it to stay on.
With the automation it ‘overrides’ anything she does on her app on the phone so it will turn the WLEDS off if automation finished. Or she moves and the PIR detects her and changes the WLED colour to white or red.
Is there a way to avoid this so that if the WLED is set via the WLED app the automation does not run?
I hope that makes sense.
Code is
alias: Motion - Bedroom Headboard PIR
description: ""
mode: restart
triggers:
- entity_id:
- binary_sensor.pir_bedroom
to: "on"
trigger: state
conditions:
- condition: state
state: "off"
entity_id: light.wled_headboard
actions:
- choose:
- conditions:
- condition: and
conditions:
- condition: time
before: "23:59:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
- condition: sun
after: sunset
after_offset: "-00:30:00"
sequence:
- target:
entity_id: light.wled_headboard
data: {}
action: light.turn_on
- data:
option: White
enabled: true
target:
entity_id: select.wled_headboard_preset
action: select.select_option
- wait_for_trigger:
- entity_id:
- binary_sensor.pir_bedroom
to: "off"
trigger: state
- delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- data: {}
target:
entity_id: light.wled_headboard
action: light.turn_off
alias: "Option 1: White LED"
- conditions:
- condition: and
conditions:
- condition: sun
before: sunrise
- condition: time
after: "00:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
sequence:
- target:
entity_id: light.wled_headboard
data: {}
action: light.turn_on
- data:
option: Night
enabled: true
target:
entity_id: select.wled_headboard_preset
action: select.select_option
- wait_for_trigger:
- entity_id:
- binary_sensor.pir_bedroom
to: "off"
trigger: state
- delay:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
- data: {}
target:
entity_id: light.wled_headboard
action: light.turn_off
alias: "Option 2: Red LED"