Update icon_template docs for switch template (#2735)

* Update icon_template docs for switch template

* use {% raw %} and {% endraw %}as requested

* typo in raw/endraw
This commit is contained in:
PhracturedBlue 2017-06-05 02:28:10 -07:00 committed by Fabian Affolter
parent 6d4129c551
commit 06415a6cfa

View File

@ -115,13 +115,17 @@ switch:
This example shows how to change the icon based on the day/night cycle. This example shows how to change the icon based on the day/night cycle.
```yaml ```yaml
sensor: switch:
- platform: template - platform: template
sensors: switches:
day_night: garage:
friendly_name: 'Day/Night' value_template: {% raw %}"{{ is_state(cover.garage_door', 'on') }}"{% endraw %}
value_template: {% raw %}'{% if is_state("sun.sun", "above_horizon") %}Day{% else %}Night{% endif %}'{% endraw %} turn_on:
icon_template: {% raw %}'{% if is_state("sun.sun", "above_horizon") %}mdi:weather-sunny{% else %}mdi:weather-night{% endif %}'{% endraw %} service: cover.open_cover
entity_id: cover.garage_door
turn_off:
service: cover.close_cover
entity_id: cover.garage_door
icon_template: {% raw %}"{% if is_state('cover.garage_door', 'open') %}mdi:garage-open{% else %}mdi:garage{% endif %}"{% endraw %}
``` ```