Not sure this is a nodered answer (as thats the tag on the post) but if it helps here is a script I use to copy one bulb to another with various colour and brightness changes (to create different lighting effects), I use it to copy my hue ceiling bulb settings (when they change state, hue or brightness) to two tp_link lamps in the room corners - so similar problem.
alias: Copy Bulb
sequence:
- variables:
src_state: "{{ states(from) }}"
- if:
- condition: template
value_template: "{{ src_state == 'off' }}"
then:
- service: light.turn_off
data: {}
target:
entity_id: "{{ to }}"
else:
- variables:
src_hs: "{{ state_attr(from, 'hs_color') }}"
src_br: "{{ state_attr(from, 'brightness') }}"
h_mode: "{{ hue_mode if hue_mode is defined else \"none\" }}"
s_mode: "{{ sat_mode if sat_mode is defined else \"none\" }}"
b_mode: "{{ brightness_mode if brightness_mode is defined else \"none\" }}"
rl: "{{ range_low if range_low is defined else \"30\" }}"
rh: "{{ range_high if range_high is defined else \"60\" }}"
dst_br: >-
{%- macro b_random_dimmer(c,l,h) -%} {{- (c * ((range(l,h) | random)
/ 100)) | round(3) | float -}} {%- endmacro -%} {%- macro
b_random_brighter(c,l,h) -%} {{- (c + ((255 - c) * ((range(l,h) |
random) / 100))) | round(3) -}} {%- endmacro -%} {%- if b_mode ==
"brighter" -%}
{{- b_random_brighter(src_br, rl, rh) -}}
{%- elif b_mode == "dimmer" -%}
{{- b_random_dimmer(src_br, rl, rh) -}}
{%- else -%}
{{- src_br -}}
{%- endif -%}
dst_h: >-
{%- macro h_complementary(c) -%} {{- ((c + 180) % 360) | round(3)
-}} {%- endmacro -%} {%- macro h_random_analogous(c) -%} {{- ((c +
([-30, 30] | random)) % 360) | round(3) -}} {%- endmacro -%} {%-
macro h_random_triadic(c) -%} {{- ((c + 120 * ([1, 2] | random)) %
360) | round(3) -}} {%- endmacro -%} {%- macro h_random_tetradic(c)
-%} {{- ((c + 90 * ([1, 2, 3] | random)) % 360) | round(3) -}} {%-
endmacro -%} {%- if h_mode == "complementary" -%}
{{- h_complementary(src_hs[0])|float -}}
{%- elif h_mode == "analogous" -%}
{{- h_random_analogous(src_hs[0])|float -}}
{%- elif h_mode == "triadic" -%}
{{- h_random_triadic(src_hs[0])|float -}}
{%- elif h_mode == "tetradic" -%}
{{- h_random_tetradic(src_hs[0])|float -}}
{%- else -%}
{{- src_hs[0] -}}
{%- endif -%}
dst_s: >-
{%- macro s_random_desat(c,l,h) -%} {{- (c * ((range(l,h) | random)
/ 100)) | round(3) | float -}} {%- endmacro -%} {%- macro
s_random_resat(c,l,h) -%} {{- (c + ((100 - c) * ((range(l,h) |
random) / 100))) | round(3) -}} {%- endmacro -%} {%- if s_mode ==
"desaturate" -%}
{{- s_random_desat(src_hs[1],rl,rh)|float -}}
{%- elif s_mode == "resaturate" -%}
{{- s_random_resat(src_hs[1],rl,rh)|float -}}
{%- else -%}
{{- src_hs[1] -}}
{%- endif -%}
- service: light.turn_on
data:
hs_color: ({{ dst_h }}, {{ dst_s }})
brightness: "{{ dst_br }}"
target:
entity_id: "{{ to }}"
mode: parallel
icon: mdi:lightbulb-multiple
max: 30
You can call it like this - this call copies the colour and increases the colour saturation by a random amount (30-60% by default):
- service: script.copy_bulb
data:
from: light.fhl2
to: light.fhlp1
sat_mode: resaturate
or desaturate and make it dimmer:
- service: script.copy_bulb
data:
from: light.fhr1
to: light.fhlp2
sat_mode: desaturate
brightness_mode: dimmer
The script takes the following options, miss any out to just copy from one bulb to another without change:
sat_mode: desaturate or saturate
brightness_mode: brighter or dimmer
hue_mode: complementary, analogous, triadic, or tetradic
range_low: 0-100 (defaults to 30) - lower bound of randomness applied
range_high: 0-100 (defaults to 60) - upper bound of randomness applied
To copy my hue ceiling lights (light.fhl2 and light.fhr1) settings to the tp_link lamps (light.fhlp1 and light.fhlp2) in the same room I use this automation (copies the ceiling bulb to the nearest lamp but marginally more saturated so the room looks better ):
alias: Hall Copy to Lamps
description: Copy lighting triggered by attribute change of corner ceiling bulbs to corner lamps
trigger:
- platform: state
entity_id:
- light.fhl2
- light.fhr1
attribute: hs_color
- platform: state
entity_id:
- light.fhl2
- light.fhr1
attribute: brightness
condition: []
action:
- parallel:
- service: script.copy_bulb
data:
from: light.fhl2
to: light.fhlp1
sat_mode: resaturate
- service: script.copy_bulb
data:
from: light.fhr1
to: light.fhlp2
sat_mode: resaturate
mode: restart