mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-17 14:26:51 +00:00
Add color to light template (#11958)
This commit is contained in:
parent
f90b6c7433
commit
f3006f1a3e
@ -28,6 +28,7 @@ light:
|
|||||||
level_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int }}"
|
level_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int }}"
|
||||||
value_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int > 0 }}"
|
value_template: "{{ state_attr('sensor.theater_brightness', 'lux')|int > 0 }}"
|
||||||
temperature_template: "{{states('input_number.temperature_input') | int}}"
|
temperature_template: "{{states('input_number.temperature_input') | int}}"
|
||||||
|
color_template: "({{states('input_number.h_input') | int}}, {{states('input_number.s_input') | int}})"
|
||||||
turn_on:
|
turn_on:
|
||||||
service: script.theater_lights_on
|
service: script.theater_lights_on
|
||||||
turn_off:
|
turn_off:
|
||||||
@ -41,6 +42,15 @@ light:
|
|||||||
data_template:
|
data_template:
|
||||||
value: "{{ color_temp }}"
|
value: "{{ color_temp }}"
|
||||||
entity_id: input_number.temperature_input
|
entity_id: input_number.temperature_input
|
||||||
|
set_color:
|
||||||
|
- service: input_number.set_value
|
||||||
|
data_template:
|
||||||
|
value: "{{ h }}"
|
||||||
|
entity_id: input_number.h_input
|
||||||
|
- service: input_number.set_value
|
||||||
|
data_template:
|
||||||
|
value: "{{ s }}"
|
||||||
|
entity_id: input_number.s_input
|
||||||
```
|
```
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
@ -74,6 +84,11 @@ light:
|
|||||||
required: false
|
required: false
|
||||||
type: template
|
type: template
|
||||||
default: optimistic
|
default: optimistic
|
||||||
|
color_template:
|
||||||
|
description: Defines a template to get the color of the light. Must render a tuple (hue, saturation)
|
||||||
|
required: false
|
||||||
|
type: template
|
||||||
|
default: optimistic
|
||||||
icon_template:
|
icon_template:
|
||||||
description: Defines a template for an icon or picture, e.g. showing a different icon for different states.
|
description: Defines a template for an icon or picture, e.g. showing a different icon for different states.
|
||||||
required: false
|
required: false
|
||||||
@ -99,6 +114,10 @@ light:
|
|||||||
description: Defines an action to run when the light is given a color temperature command.
|
description: Defines an action to run when the light is given a color temperature command.
|
||||||
required: false
|
required: false
|
||||||
type: action
|
type: action
|
||||||
|
set_color:
|
||||||
|
description: Defines an action to run when the light is given a color command.
|
||||||
|
required: false
|
||||||
|
type: action
|
||||||
{% endconfiguration %}
|
{% endconfiguration %}
|
||||||
|
|
||||||
## Considerations
|
## Considerations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user