From 50db58a3c968cf3c74d469d9353494608e3eccb6 Mon Sep 17 00:00:00 2001 From: tetienne Date: Mon, 27 Jan 2020 14:27:33 +0100 Subject: [PATCH] Add temperature to light template (#11678) --- source/_integrations/light.template.markdown | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/source/_integrations/light.template.markdown b/source/_integrations/light.template.markdown index b8088833327..903f04caa62 100644 --- a/source/_integrations/light.template.markdown +++ b/source/_integrations/light.template.markdown @@ -25,8 +25,9 @@ light: lights: theater_lights: friendly_name: "Theater Lights" - level_template: "{{ sensor.theater_brightness.attributes.lux|int }}" - value_template: "{{ sensor.theater_brightness.attributes.lux|int > 0 }}" + level_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int }}" + value_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int > 0 }}" + temperature_template: "{{states('input_number.temperature_input') | int}}" turn_on: service: script.theater_lights_on turn_off: @@ -35,6 +36,11 @@ light: service: script.theater_lights_level data_template: brightness: "{{ brightness }}" + set_temperature: + service: input_number.set_value + data_template: + value: "{{ color_temp }}" + entity_id: input_number.temperature_input ``` {% endraw %} @@ -63,6 +69,11 @@ light: required: false type: template default: optimistic + temperature_template: + description: Defines a template to get the color temperature of the light. + required: false + type: template + default: optimistic icon_template: description: Defines a template for an icon or picture, e.g. showing a different icon for different states. required: false @@ -84,6 +95,10 @@ light: description: Defines an action to run when the light is given a brightness command. required: false type: action + set_temperature: + description: Defines an action to run when the light is given a color temperature command. + required: false + type: action {% endconfiguration %} ## Considerations