Skip to content

Instantly share code, notes, and snippets.

@hunterjm
Created June 29, 2021 01:13
Show Gist options
  • Save hunterjm/77bc1f9edfb3a833263ea7adf9326da7 to your computer and use it in GitHub Desktop.
Save hunterjm/77bc1f9edfb3a833263ea7adf9326da7 to your computer and use it in GitHub Desktop.
# Mirror on/off & brightness for dimmer <-> light bulb(s)
- id: 23ef3887-7eb4-4496-8ba5-54f7d0a7be2d
alias: Mirror Downstairs Hallway Lights
mode: single
max_exceeded: silent
variables:
light_1: light.downstairs_hallway_light
light_2: light.downstairs_hallway_dimmer
trigger:
- platform: state
entity_id:
- light.downstairs_hallway_light
- light.downstairs_hallway_dimmer
action:
- variables:
target: "{{ light_2 if trigger.entity_id == light_1 else light_1 }}"
- choose:
conditions: "{{ trigger.to_state.state == 'on' }}"
sequence:
- service: "light.turn_on"
target:
entity_id: "{{target}}"
data:
transition: 0
brightness: "{{trigger.to_state.attributes.brightness}}"
default:
- service: light.turn_off
target:
entity_id: "{{target}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment