Hello,
Any way to optimise this automation?
I have a 3-gang switch in each room, where one is main track light and the other is ambient.
I would like to turn off the ambient light if the track light is on and vice versa.
alias: 'Light: Ambient vs Tracklight -1'
description: ''
trigger:
- platform: device
type: turned_on
entity_id: switch.living_tracklight
domain: switch
id: living-track-on
for:
hours: 0
minutes: 0
seconds: 10
- platform: device
type: turned_on
entity_id: switch.dining_tracklight
domain: switch
id: dining-track-on
for:
hours: 0
minutes: 0
seconds: 10
- platform: device
type: turned_on
entity_id: switch.living_ambient_light
domain: switch
for:
hours: 0
minutes: 0
seconds: 10
id: living-ambi-on
- platform: device
type: turned_on
entity_id: switch.dining_ambient
domain: switch
for:
hours: 0
minutes: 0
seconds: 10
id: dining-ambi-on
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: dining-track-on
sequence:
- if:
- condition: device
type: is_on
entity_id: switch.dining_ambient
domain: switch
then:
- type: turn_off
entity_id: switch.dining_ambient
domain: switch
- conditions:
- condition: trigger
id: living-track-on
sequence:
- if:
- condition: device
type: is_on
entity_id: switch.living_ambient_light
domain: switch
then:
- type: turn_off
entity_id: switch.living_tracklight
domain: switch
- conditions:
- condition: trigger
id: dining-ambi-on
sequence:
- if:
- condition: device
type: is_on
entity_id: switch.dining_tracklight
domain: switch
then:
- type: turn_off
entity_id: switch.dining_ambient
domain: switch
- conditions:
- condition: trigger
id: living-ambi-on
sequence:
- if:
- condition: device
type: is_on
entity_id: switch.living_tracklight
domain: switch
then:
- type: turn_off
entity_id: switch.living_tracklight
domain: switch
default: []
mode: restart