谢谢你 再官网论坛找到一个配置
你需要:
逻辑的灯光模板并作为最终的 CCT 灯光实体
三个辅助变量
计算的 CCT 亮度 > input_number.kuche_arbeitslicht_helligkeit
值范围 0-255
计算的 CCT 色温 > input_number.kuche_arbeitslicht_farbtemperatur
当您想保留原始颜色值时,将 K 中的条纹范围转换为 MIRED(例如 2700-6500 K 等于 153-370 MIRED)
当您想在 Lovelace 中使用完整滑块范围时,请使用 153 至500
计算出的 CW 和 WW 输入之间的 CCT 色彩比 > input_number.kuche_arbeitslicht_cw_ww
值范围 0-100(百分比)
下面是配置
- platform: template
lights:
kuche_arbeitslight_cct:
friendly_name: "Küche Arbeitslicht"
level_template: "{{ ( states('input_number.kuche_arbeitslicht_helligkeit' ) | int(0) ) }}"
temperature_template: "{{ ( states('input_number.kuche_arbeitslicht_farbtemperatur' ) | int(0) ) }}"
value_template: >
{% if is_state('light.tai_deng_l1', 'on' ) + is_state('light.tai_deng_l2', 'on' ) > 0 %}
on
{% else %}
off
{% endif %}
turn_off:
service: light.turn_off
data: {}
target:
entity_id:
- light.tai_deng_l1
- light.tai_deng_l2
turn_on:
service: light.turn_on
data: {}
target:
entity_id:
- light.tai_deng_l1
- light.tai_deng_l2
set_temperature:
- service: input_number.set_value
data:
value: "{{ color_temp }}"
# with original color values set lower and upper limits: "{{ [ [ color_temp, 200 ] | max, 370 ] | min }}"
entity_id: input_number.kuche_arbeitslicht_farbtemperatur
- service: input_number.set_value
data:
value: "{{ [ [ ( -1/347 * states( 'input_number.kuche_arbeitslicht_farbtemperatur' ) | int + 500 / 347 ) * 100, 0 ] | max, 100 ] | min }}"
# with original color values: replace 500 with upper limit, replace 347 with upper limit minus lower limit (e.g. 370-200 = 170)
entity_id: input_number.kuche_arbeitslicht_cw_ww
- service: light.turn_on
data:
brightness: "{{ ( this.attributes.brightness | int(0) ) * states( 'input_number.kuche_arbeitslicht_cw_ww' ) | int / 100 }}"
entity_id: light.tai_deng_l1
- service: light.turn_on
data:
brightness: "{{ ( this.attributes.brightness | int(0) ) * ( 1 - states( 'input_number.kuche_arbeitslicht_cw_ww' ) | int / 100 ) }}"
entity_id: light.tai_deng_l2
set_level:
- service: input_number.set_value
data:
value: "{{ brightness }}"
entity_id: input_number.kuche_arbeitslicht_helligkeit
- service: light.turn_on
data:
brightness: "{{ brightness * states( 'input_number.kuche_arbeitslicht_cw_ww' ) | int / 100}}"
entity_id: light.tai_deng_l1
- service: light.turn_on
data:
brightness: "{{ brightness * ( 1 - states( 'input_number.kuche_arbeitslicht_cw_ww' ) | int / 100 ) }}"
entity_id: light.tai_deng_l2
|