Need a bit of help trying to figure out how to keep my kitchen lights sync automation from being triggered by another automation.
Tried to configure it so only a manual/physical turning on or off of the switch activates it, but obviously something is not quite right.
I can see this sync automation happening exactly 1 second after the first automation runs.
alias: Kitchen lights sync
description: Syncs down lights with physical switch interaction
triggers:
- trigger: state
entity_id: light.kitchen_lights_2
from: "off"
to: "on"
id: turn_on
- trigger: state
entity_id: light.kitchen_lights_2
from: "on"
to: "off"
id: turn_off
conditions:
- condition: template
value_template: |
{{ trigger.to_state.context.id is not none and
trigger.to_state.context.parent_id is none and
trigger.to_state.context.user_id is none }}
actions:
- choose:
- conditions:
- condition: trigger
id: turn_on
sequence:
- choose:
- conditions:
- condition: or
conditions:
- condition: time
after: "18:30:00"
- condition: time
before: "07:00:00"
sequence:
- action: light.turn_on
target:
entity_id:
- light.kitchen_lights_2
- light.kitchen_down_lights_2
data:
brightness_pct: 1
default:
- action: light.turn_on
target:
entity_id: light.kitchen_lights_2
data:
brightness_pct: 100
- action: light.turn_on
target:
entity_id: light.kitchen_down_lights_2
data:
brightness_pct: 33
- conditions:
- condition: trigger
id: turn_off
sequence:
- action: light.turn_off
target:
entity_id: light.kitchen_down_lights_2
alias: Kitchen Lighting Sequence
description: >-
Manual override, morning/evening ramps, and weekend transitions with manual
fades.
triggers:
- trigger: time
at: "05:20:00"
id: time_0520
weekday:
- mon
- tue
- wed
- thu
- fri
- trigger: time
at: "05:50:00"
id: time_0550
weekday:
- mon
- tue
- wed
- thu
- fri
- trigger: time
at: "06:45:00"
id: time_0645
weekday:
- mon
- tue
- wed
- thu
- fri
- trigger: time
at: "18:30:00"
id: time_1830
- trigger: time
at: "19:30:00"
id: time_1930
- trigger: time
at: "07:50:00"
id: weekend_0750
actions:
- choose:
- conditions:
- condition: trigger
id: time_0520
sequence:
- action: light.turn_on
target:
entity_id:
- light.kitchen_lights_2
- light.kitchen_down_lights_2
data:
brightness_pct: 1
- conditions:
- condition: trigger
id: time_0550
sequence:
- parallel:
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) < 84 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_down_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) + 5) | clamp(0, 84) }}
- delay:
seconds: 5
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_lights_2', 'brightness') |
int(0) < 128 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_lights_2', 'brightness')
| int(0) + 5) | clamp(0, 128) }}
- delay:
seconds: 5
- conditions:
- condition: trigger
id: time_0645
sequence:
- sequence:
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_lights_2', 'brightness') |
int(0) < 255 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_lights_2', 'brightness')
| int(0) + 5) | clamp(0, 255) }}
- delay:
seconds: 5
- conditions:
- condition: trigger
id: time_1830
- condition: state
entity_id: light.kitchen_lights_2
state: "on"
sequence:
- parallel:
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) > 3 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_down_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) - 5) | clamp(3, 255) }}
- delay:
seconds: 2
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_lights_2', 'brightness') |
int(0) > 128 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_lights_2', 'brightness')
| int(0) - 5) | clamp(128, 255) }}
- delay:
seconds: 2
- conditions:
- condition: trigger
id: time_1930
- condition: state
entity_id: light.kitchen_lights_2
state: "on"
sequence:
- parallel:
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_lights_2', 'brightness') |
int(0) > 3 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_lights_2', 'brightness')
| int(0) - 5) | clamp(3, 255) }}
- delay:
seconds: 2
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) > 3 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_down_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) - 5) | clamp(3, 255) }}
- delay:
seconds: 2
- conditions:
- condition: trigger
id: weekend_0750
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: light.kitchen_lights_2
state: "on"
sequence:
- parallel:
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) < 84 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_down_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_down_lights_2',
'brightness') | int(0) + 5) | clamp(0, 84) }}
- delay:
seconds: 2
- repeat:
while:
- condition: template
value_template: >-
{{ state_attr('light.kitchen_lights_2', 'brightness') |
int(0) < 255 }}
sequence:
- action: light.turn_on
target:
entity_id: light.kitchen_lights_2
data:
brightness: >-
{{ (state_attr('light.kitchen_lights_2', 'brightness')
| int(0) + 5) | clamp(0, 255) }}
- delay:
seconds: 2
mode: restart