So I wrote a .yaml automation to synchronize a lamp to another lamp last night. There is no external data to just use instead because said source lamp is gets its data from some closed source code that is running on a seperate device. The source light is also a lot smaller than the target lamp that's why I divide the brightness by 4.
triggers:
- entity_id: light.source
for:
milliseconds: 100
trigger: state
conditions:
- condition: template
value_template: >
{% set new_brightness =
(state_attr('light.source', 'brightness') | int /
4.0) | round(0) | int %} {% set new_hs_color =
state_attr('light.source', 'hs_color') %} {{
new_brightness != state_attr('light.target_a', 'brightness') | int or
new_hs_color != state_attr('light.target_a', 'hs_color') or
new_brightness != state_attr('light.target_b', 'brightness') | int or
new_hs_color != state_attr('light.target_b', 'hs_color') }}
actions:
- target:
entity_id:
- light.target_a
- light.target_b
data:
brightness: >-
{{ (state_attr('light.source', 'brightness') |
int / 4.0) | round(0) | int }}
hs_color: "{{ state_attr('light.source', 'hs_color') }}"
action: light.turn_on
mode: restart