diff --git a/source/_integrations/light.template.markdown b/source/_integrations/light.template.markdown index c4ccc917c21..92cf57d5a71 100644 --- a/source/_integrations/light.template.markdown +++ b/source/_integrations/light.template.markdown @@ -29,6 +29,7 @@ light: value_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int > 0 }}" temperature_template: "{{states('input_number.temperature_input') | int}}" color_template: "({{states('input_number.h_input') | int}}, {{states('input_number.s_input') | int}})" + effect_list_template: "{{ state_attr('light.led_strip', 'effect_list') }}" turn_on: service: script.theater_lights_on turn_off: @@ -56,6 +57,21 @@ light: data: value: "{{ s }}" entity_id: input_number.s_input + - service: light.turn_on + data_template: + entity_id: + - light.led_strip + transition: "{{ transition | float }}" + hs_color: + - "{{ hs[0] }}" + - "{{ hs[1] }}" + set_effect: + - service: light.turn_on + data_template: + entity_id: + - light.led_strip + effect: "{{ effect }}" + supports_transition_template: "{{ true }}" ``` {% endraw %} @@ -99,6 +115,31 @@ light: required: false type: template default: optimistic + supports_transition_template: + description: Defines a template to get if light supports transition. Should return boolean value (True/False). If this value is `True` transition parameter in a turn on or turn off call will be passed as a named parameter `transition` to either of the scripts. + required: false + type: template + default: false + effect_list_template: + description: Defines a template to get the list of supported effects. Must render a list + required: inclusive + type: template + default: optimistic + effect_template: + description: Defines a template to get the effect of the light. + required: inclusive + type: template + default: optimistic + min_mireds_template: + description: Defines a template to get the min mireds value of the light. + required: false + type: template + default: optimistic + max_mireds_template: + description: Defines a template to get the max mireds value 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 @@ -117,7 +158,7 @@ light: required: true type: action set_level: - description: Defines an action to run when the light is given a brightness command. + description: Defines an action to run when the light is given a brightness command. The script will only be called if the `turn_on` call only has brightness, and optionally transition. required: false type: action set_temperature: @@ -132,6 +173,10 @@ light: description: Defines an action to run when the light is given a color command. required: false type: action + set_effect: + description: Defines an action to run when the light is given a effect command. + required: inclusive + type: action {% endconfiguration %} ## Considerations @@ -145,6 +190,9 @@ For example, you would replace with this equivalent that returns `true`/`false` and never gives an unknown result: {% raw %}`{{ is_state('switch.source', 'on') }}`{% endraw %} +Transition doesn't have its own script, it will instead be passed as a named parameter `transition` to the `turn_on`, `turn_off`, `brightness`, `color_temp`, `effect`, `hs_color` or `white_value` scripts. +Brightness will be passed as a named parameter `brightness` to either of `turn_on`, `color_temp`, `effect`, `hs_color` or `white_value` scripts if the corresponding parameter is also in the call. In this case the brightness script (`set_level`) will not be called. +If only brightness is passed to `light.turn_on` service call then `set_level` script is called. ## Examples