From 06415a6cfa9778f74ce1e526f1b664375005f942 Mon Sep 17 00:00:00 2001 From: PhracturedBlue Date: Mon, 5 Jun 2017 02:28:10 -0700 Subject: [PATCH] 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 --- source/_components/switch.template.markdown | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/_components/switch.template.markdown b/source/_components/switch.template.markdown index 542362f757e..d53b6881316 100644 --- a/source/_components/switch.template.markdown +++ b/source/_components/switch.template.markdown @@ -115,13 +115,17 @@ switch: This example shows how to change the icon based on the day/night cycle. ```yaml -sensor: +switch: - 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 %} - + switches: + garage: + value_template: {% raw %}"{{ is_state(cover.garage_door', 'on') }}"{% endraw %} + turn_on: + 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 %} ```