Skip to content

Instantly share code, notes, and snippets.

@thiswillbeyourgithub
Last active May 19, 2025 09:25
Show Gist options
  • Select an option

  • Save thiswillbeyourgithub/5471d6a48648a8b83020150cad66b8b6 to your computer and use it in GitHub Desktop.

Select an option

Save thiswillbeyourgithub/5471d6a48648a8b83020150cad66b8b6 to your computer and use it in GitHub Desktop.
# inspirations:
# https://community.home-assistant.io/t/synchronize-the-on-off-state-and-brightness-of-two-lights/525423/6
# which linked to those gists:
# https://gist.github.com/creedda/31d391e007b978aed3879fcc1d0fb22c
# https://github.com/iqubik/synclamp/blob/14bb88c8b92219b5243a6a31eae07c0b6ee11fc1/syncthelamp.yaml
# https://gist.github.com/creedda/31d391e007b978aed3879fcc1d0fb22c
blueprint:
name: Slave lights
description: |
Mirror the first light onto other lights. In effect the on/off state, brightness, xy_color and color_temp are mirrored.
domain: automation
input:
master_entity:
name: Master light
selector:
entity:
domain: light
multiple: false
secondary_entities:
name: Slave lights
selector:
entity:
domain: light
multiple: true
source_url: https://gist.github.com/thiswillbeyourgithub/5471d6a48648a8b83020150cad66b8b6
mode: queued
max_exceeded: warn # silent/warn/error/skip
variables:
master_entity: !input master_entity
secondary_entities: !input secondary_entities
trigger:
- platform: state
entity_id: !input master_entity
- platform: state
entity_id: !input master_entity
attribute: brightness
- platform: state
entity_id: !input master_entity
attribute: color_temp
- platform: state
entity_id: !input master_entity
attribute: xy_color
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: '{{ is_state(trigger.to_state.entity_id, "on") }}'
sequence:
- service: light.turn_on
data: >
{
{% if state_attr(trigger.to_state.entity_id, "brightness") is not none %}
"brightness": {{ state_attr(trigger.to_state.entity_id, "brightness") }},
{% endif %}
{% if state_attr(trigger.to_state.entity_id, "color_temp") is not none %}
"color_temp": {{ state_attr(trigger.to_state.entity_id, "color_temp") }}
{% endif %}
{% if state_attr(trigger.to_state.entity_id, "xy_color") is not none
and not state_attr(trigger.to_state.entity_id, "color_temp") %}
"xy_color": {{ state_attr(trigger.to_state.entity_id, "xy_color") }}
{% endif %}
}
target:
entity_id: "{{ secondary_entities }}"
- conditions:
- condition: template
value_template: '{{ is_state(trigger.to_state.entity_id, "off") }}'
sequence:
- service: light.turn_off
target:
entity_id: "{{ secondary_entities }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment