This is my first attempt with blueprints. I use it with my bathroom lights. I have the main light and the mirror light and use this to turn on the primary(main) light when the secondary(mirror) is turned on and turn off the secondary(mirror) light when the primary(main) is turned off.
blueprint:
name: Synchronize Primary and Secondary Lights
description: Turn on the primary light when the secondary is turned on and turn off the secondary light when the primary is turned off.
domain: automation
input:
primary_light:
name: Main light
description: This is the primary light, will be turned on when the secondary light is turned on.
selector:
target:
entity:
domain: light
secondary_light:
name: Mirror light
description: This is the secondary light, will be turned off when the primary light is turned off.
selector:
target:
entity:
domain: light
trigger:
- platform: state
entity_id: !input primary_light
to: "on"
- platform: state
entity_id: !input secondary_light
to: "off"
action:
choose:
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'on' }}"
sequence:
- service: light.turn_on
entity_id: !input secondary_light
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'off' }}"
sequence:
- service: light.turn_off
entity_id: !input primary_light
default: []