mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 21:36:52 +00:00
Add icon template instructions (#2629)
Propose adding icon template instructions to this and the template switch docs.
This commit is contained in:
parent
969ebecc66
commit
4e7bbfad66
@ -92,3 +92,17 @@ binary_sensor:
|
||||
- sensor.kitchen_co_status
|
||||
- sensor.wardrobe_co_status
|
||||
```
|
||||
### {% linkable_title Change the icon %}
|
||||
|
||||
This example shows how to change the icon based on the day/night cycle.
|
||||
|
||||
```yaml
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
day_night:
|
||||
friendly_name: 'Day/Night'
|
||||
value_template: {% raw %}'{% if is_state("sun.sun", "above_horizon") %}Day{% else %}Night{% endif %}'{% endraw %}
|
||||
icon_template: {% raw %}'{% if is_state("sun.sun", "above_horizon") %}mdi:weather-sunny{% else %}mdi:weather-night{% endif %}'{% endraw %}
|
||||
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user