I have a light strip containing warm leds and cold leds. Unfortunately the driver does not allow me to combine the two color temps as one light so I can easily set the color temp of the light strip as one. Is there a way to combine these two lights as one (with a light template or light group)? I tried my best but I can’t find a solution…
Still searching for a way to do this, maybe with a “light template” to create a third light out of these two?
I tried something like that a while ago. I don’t think I ever made it work really well, only sort of. I found some old config. But I warn you, it might be total trash ^^.
configuration.yaml
Summary
light:
- platform: template
lights:
test_n_w_lights:
level_template: "{{ (state_attr('light.light_29', 'brightness'), state_attr('light.light_3_2', 'brightness')) | max }}"
value_template: "{{ states('light.corner_lights') }}"
temperature_template: >-
{% if state_attr('light.light_3_2', 'brightness')|int == 0
and state_attr('light.light_29', 'brightness')|int > 0 %}
370
{% elif state_attr('light.light_3_2', 'brightness')|int > 0
and state_attr('light.light_29', 'brightness')|int == 0 %}
161
{% elif state_attr('light.light_3_2', 'brightness')|int > 0
and state_attr('light.light_29', 'brightness')|int > 0 %}
{{ ((
(state_attr('light.light_3_2', 'brightness')|int / 255*100) | round(0) | int
/ ((state_attr('light.light_29', 'brightness')|int / 255*100) | round(0) | int
+ (state_attr('light.light_3_2', 'brightness')|int / 255*100) | round(0) | int)
) * 161
+
(
(state_attr('light.light_29', 'brightness')|int / 255*100) | round(0) | int
/ ((state_attr('light.light_29', 'brightness')|int / 255*100) | round(0) | int
+ (state_attr('light.light_3_2', 'brightness')|int / 255*100) | round(0) | int)
) * 370) | round(0)
}}
{% endif %}
turn_on:
service: light.turn_on
data:
entity_id: light.corner_lights
turn_off:
service: light.turn_off
data:
entity_id: light.corner_lights
set_level:
service: script.corner_lights_level
data_template:
brightness: "{{ brightness | int }}"
set_temperature:
service: input_number.set_value
data_template:
value: "{{ color_temp }}"
entity_id: input_number.temperature_input
scripts.yaml
Summary
corner_lights_level:
sequence:
- service: light.turn_on
data_template:
entity_id: light.light_29
brightness: >-
{% if state_attr('light.test_n_w_lights', 'color_temp')|int > 265 %}
{{ brightness }}
{% else %}
{{ ((161*(brightness|int) - state_attr('light.test_n_w_lights', 'color_temp') * (brightness|int) )
/ (state_attr('light.test_n_w_lights', 'color_temp') - 370) ) | round(0) }}
{% endif %}
- service: light.turn_on
data_template:
entity_id: light.light_3_2
brightness: >-
{% if state_attr('light.test_n_w_lights', 'color_temp')|int <= 265 %}
{{ brightness }}
{% else %}
{{ ((370*(brightness|int) - state_attr('light.test_n_w_lights', 'color_temp') * (brightness|int) )
/ (state_attr('light.test_n_w_lights', 'color_temp') - 161) ) | round(0) }}
{% endif %}
# - service: input_number.set_value
# data_template:
# entity_id: input_number.corner_light_brightness
# value: "{{ brightness }}"
# - service: input_number.set_value
# data_template:
# entity_id: input_number.corner_light_brightness2
# value: "{{ ((370*(brightness|int) - state_attr('light.test_n_w_lights', 'color_temp') * (brightness|int) )
# / (state_attr('light.test_n_w_lights', 'color_temp') - 161) ) | round(0) }}"
# - service: input_number.set_value
# data_template:
# entity_id: input_number.corner_light_brightness3
# value: "{{ ((161*(brightness|int) - state_attr('light.test_n_w_lights', 'color_temp') * (brightness|int) )
# / (state_attr('light.test_n_w_lights', 'color_temp') - 370) ) | round(0) }}"