Site updated at 2017-09-23 00:58:45 UTC

This commit is contained in:
Travis CI 2017-09-23 00:58:45 +00:00
parent 68f6da8d25
commit a675f41451
95 changed files with 698 additions and 440 deletions

View file

@ -4,7 +4,7 @@
<title><![CDATA[Home Assistant]]></title>
<link href="https://home-assistant.io/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Announcements | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/announcements/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Community | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/community/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Device-Tracking | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/device-tracking/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: ESP8266 | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/esp8266/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: How-To | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/how-to/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: iBeacons | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/ibeacons/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Internet-of-Things | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/internet-of-things/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: IoT-Data | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/iot-data/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Media | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/media/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Merchandise | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/merchandise/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Micropython | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/micropython/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: MQTT | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/mqtt/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Organisation | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/organisation/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: OwnTracks | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/owntracks/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Presence-Detection | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/presence-detection/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Public-Service-Announcement | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/public-service-announcement/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Release-Notes | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/release-notes/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Survey | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/survey/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Talks | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/talks/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Technology | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/technology/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: User-Stories | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/user-stories/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Video | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/video/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: Website | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/website/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2017-09-21T14:45:33+00:00</updated>
<updated>2017-09-23T00:52:15+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>

View file

@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Template Binary Sensor - Home Assistant</title>
<meta name="author" content="Home Assistant">
<meta name="description" content="Instructions how to integrate Template binary sensors into Home Assistant.">
<meta name="description" content="Instructions how to integrate Template Binary Sensors into Home Assistant.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://home-assistant.io/components/binary_sensor.template/">
<meta property="fb:app_id" content="338291289691179">
@ -16,12 +16,12 @@
<meta property="og:site_name" content="Home Assistant">
<meta property="og:url" content="https://home-assistant.io/components/binary_sensor.template/">
<meta property="og:type" content="article">
<meta property="og:description" content="Instructions how to integrate Template binary sensors into Home Assistant.">
<meta property="og:description" content="Instructions how to integrate Template Binary Sensors into Home Assistant.">
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@home_assistant">
<meta name="twitter:title" content="Template Binary Sensor">
<meta name="twitter:description" content="Instructions how to integrate Template binary sensors into Home Assistant.">
<meta name="twitter:description" content="Instructions how to integrate Template Binary Sensors into Home Assistant.">
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
@ -74,125 +74,167 @@
</h1>
</header>
<hr class="divider">
<p>The <code class="highlighter-rouge">template</code> platform supports sensors which breaks out the <code class="highlighter-rouge">state</code> and <code class="highlighter-rouge">state_attributes</code> from other entities. The state of a template binary sensor can only be <code class="highlighter-rouge">on</code> or <code class="highlighter-rouge">off</code>.</p>
<p>To enable template binary sensors in your installation, add the following to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
<p>The <code class="highlighter-rouge">template</code> platform supports sensors which breaks out the <code class="highlighter-rouge">state</code> and
<code class="highlighter-rouge">state_attributes</code> from other entities. The state of a Template Binary Sensor
can only be <code class="highlighter-rouge">on</code> or <code class="highlighter-rouge">off</code>.</p>
<p>To enable Template Binary Sensors in your installation, add the following to
your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">binary_sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">sun_up</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sun.sun.attributes.elevation</span><span class="nv"> </span><span class="s">&gt;</span><span class="nv"> </span><span class="s">0}}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Sun</span><span class="nv"> </span><span class="s">is</span><span class="nv"> </span><span class="s">up'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Sun</span><span class="nv"> </span><span class="s">is</span><span class="nv"> </span><span class="s">up"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{{ states.sun.sun.attributes.elevation|float &gt; 0 }}</span>
</code></pre>
</div>
<p>Configuration variables:</p>
<ul>
<li><strong>sensors</strong> array (<em>Required</em>): List of your sensors.
<ul>
<li><strong>friendly_name</strong> (<em>Optional</em>): Name to use in the Frontend.</li>
<li><strong>device_class</strong> (<em>Optional</em>): The <a href="/components/binary_sensor/">type/class</a> of the sensor to set the icon in the frontend.</li>
<li><strong>value_template</strong> (<em>Optional</em>): Defines a <a href="/topics/templating/">template</a> to extract a value from the payload.</li>
<li><strong>entity_id</strong> (<em>Optional</em>): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update its state.</li>
<li><strong>on_delay</strong> (<em>Optional</em>): The amount of time the template state must be met before this sensor will switch to on.</li>
<li><strong>off_delay</strong> (<em>Optional</em>): The amount of time the template state must be not met before this sensor will switch to off.</li>
</ul>
</li>
</ul>
<div class="config-vars">
<h3><a class="title-link" name="configuration-variables" href="#configuration-variables"></a> Configuration Variables</h3>
<dl class="">
<dt><a class="title-link" name="sensors" href="#sensors"></a> sensors</dt>
<dd>
<p class="desc"><span class="type">(<span class="map">map</span>)</span><span class="required">(Required)</span><span class="description">List of your sensors.</span></p>
</dd>
<dd>
<dl class="nested">
<dt><a class="title-link" name="friendly_name" href="#friendly_name"></a> friendly_name</dt>
<dd>
<p class="desc"><span class="type">(<span class="string">string</span>)</span><span class="required">(Optional)</span><span class="description">Name to use in the frontend.</span></p>
</dd>
<dt><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</dt>
<dd>
<p class="desc"><span class="type">(<span class="string, list">string | list</span>)</span><span class="required">(Optional)</span><span class="description">Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update its state.</span></p>
</dd>
<dt><a class="title-link" name="device_class" href="#device_class"></a> device_class</dt>
<dd>
<p class="desc"><span class="type">(<span class="device_class"><a href="/components/binary_sensor/#device_class">device_class</a></span>)</span><span class="required">(Optional)</span><span class="description">The type/class of the sensor to set the icon in the frontend.</span></p>
<p class="default">Default value: None</p>
</dd>
<dt><a class="title-link" name="value_template" href="#value_template"></a> value_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Required)</span><span class="description">Defines a template to set the state of the sensor.</span></p>
</dd>
<dt><a class="title-link" name="on_delay" href="#on_delay"></a> on_delay</dt>
<dd>
<p class="desc"><span class="type">(<span class="time">time</span>)</span><span class="required">(Optional)</span><span class="description">The amount of time the template state must be <strong><em>met</em></strong> before this sensor will switch to <code class="highlighter-rouge">on</code>.</span></p>
</dd>
<dt><a class="title-link" name="off_delay" href="#off_delay"></a> off_delay</dt>
<dd>
<p class="desc"><span class="type">(<span class="time">time</span>)</span><span class="required">(Optional)</span><span class="description">The amount of time the template state must be <strong><em>not met</em></strong> before this sensor will switch to <code class="highlighter-rouge">off</code>.</span></p>
</dd>
</dl>
</dd>
</dl>
</div>
<h2><a class="title-link" name="considerations" href="#considerations"></a> Considerations</h2>
<p>If you are using the state of a platform that takes extra time to load, the
Template Binary Sensor may get an <code class="highlighter-rouge">unknown</code> state during startup. This results
in error messages in your log file until that platform has completed loading.
If you use <code class="highlighter-rouge">is_state()</code> function in your template, you can avoid this situation.
For example, you would replace
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">states.switch.source.state</span><span class="w"> </span><span class="err">==</span><span class="w"> </span><span class="err">'on'</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code>
with this equivalent that returns <code class="highlighter-rouge">true</code>/<code class="highlighter-rouge">false</code> and never gives an unknown
result:
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">is_state('switch.source',</span><span class="w"> </span><span class="err">'on')</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code></p>
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
<p>In this section you find some real life examples of how to use this sensor.</p>
<h3><a class="title-link" name="sensor-threshold" href="#sensor-threshold"></a> Sensor threshold</h3>
<p>This example indicates true if a sensor is above a given threshold. Assuming a sensor of <code class="highlighter-rouge">furnace</code> that provides a current reading for the fan motor, we can determine if the furnace is running by checking that it is over some threshold:</p>
<h3><a class="title-link" name="sensor-threshold" href="#sensor-threshold"></a> Sensor Threshold</h3>
<p>This example indicates true if a sensor is above a given threshold. Assuming a
sensor of <code class="highlighter-rouge">furnace</code> that provides a current reading for the fan motor, we can
determine if the furnace is running by checking that it is over some threshold:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">furnace_on</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">{{</span> <span class="nv">states.sensor.furnace.state &gt; 2.5</span> <span class="pi">}}</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Furnace</span><span class="nv"> </span><span class="s">Running'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Furnace</span><span class="nv"> </span><span class="s">Running"</span>
<span class="s">device_class</span><span class="pi">:</span> <span class="s">heat</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states('sensor.furnace')|float</span><span class="nv"> </span><span class="s">&gt;</span><span class="nv"> </span><span class="s">2.5</span><span class="nv"> </span><span class="s">}}"</span>
</code></pre>
</div>
<h3><a class="title-link" name="switch-as-sensor" href="#switch-as-sensor"></a> Switch as sensor</h3>
<p>Some movement sensors and door/window sensors will appear as a switch. By using a template binary sensor, the switch can be displayed as a binary sensors. The original switch can then be hidden by <a href="/getting-started/customizing-devices/">customizing.</a></p>
<h3><a class="title-link" name="switch-as-sensor" href="#switch-as-sensor"></a> Switch as Sensor</h3>
<p>Some movement sensors and door/window sensors will appear as a switch. By using
a Template Binary Sensor, the switch can be displayed as a binary sensors. The
original switch can then be hidden by
<a href="/getting-started/customizing-devices/">customizing</a>.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">binary_sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">movement</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.switch.movement.state</span><span class="nv"> </span><span class="s">==</span><span class="nv"> </span><span class="s">'on'</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">device_class</span><span class="pi">:</span> <span class="s">motion</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state('switch.movement',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">door</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.switch.door.state</span><span class="nv"> </span><span class="s">==</span><span class="nv"> </span><span class="s">'on'</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">device_class</span><span class="pi">:</span> <span class="s">opening</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state('switch.door',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
</code></pre>
</div>
<h3><a class="title-link" name="combining-multiple-sensors-and-using-entity_id" href="#combining-multiple-sensors-and-using-entity_id"></a> Combining multiple sensors, and using entity_id:</h3>
<h3><a class="title-link" name="combining-multiple-sensors-and-using-entity_id" href="#combining-multiple-sensors-and-using-entity_id"></a> Combining Multiple Sensors, and Using <code class="highlighter-rouge">entity_id</code></h3>
<p>This example combines multiple CO sensors into a single overall
status. When using templates with binary sensors, you need to return
<code class="highlighter-rouge">True</code> or <code class="highlighter-rouge">False</code> explicitly. <code class="highlighter-rouge">entity_id</code> is used to limit which
<code class="highlighter-rouge">true</code> or <code class="highlighter-rouge">false</code> explicitly. <code class="highlighter-rouge">entity_id</code> is used to limit which
sensors are being monitored to update the state, making computing this
sensor far more efficient.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">binary_sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">co</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">CO'</span>
<span class="s">device_class</span><span class="pi">:</span> <span class="s1">'</span><span class="s">gas'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">CO"</span>
<span class="s">device_class</span><span class="pi">:</span> <span class="s">gas</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">sensor.bedroom_co_status</span>
<span class="pi">-</span> <span class="s">sensor.kitchen_co_status</span>
<span class="pi">-</span> <span class="s">sensor.wardrobe_co_status</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{%- if is_state("sensor.bedroom_co_status", "Ok")</span>
<span class="no">and is_state("sensor.kitchen_co_status", "Ok")</span>
<span class="no">and is_state("sensor.wardrobe_co_status", "Ok") -%}</span>
<span class="no">False</span>
<span class="no">{%- else -%}</span>
<span class="no">True</span>
<span class="no">{%- endif %}</span>
<span class="no">entity_id:</span>
<span class="no">- sensor.bedroom_co_status</span>
<span class="no">- sensor.kitchen_co_status</span>
<span class="no">- sensor.wardrobe_co_status</span>
<span class="no">{{ is_state('sensor.bedroom_co_status', 'Ok')</span>
<span class="no">and is_state('sensor.kitchen_co_status', 'Ok')</span>
<span class="no">and is_state('sensor.wardrobe_co_status', 'Ok') }}</span>
</code></pre>
</div>
<h3><a class="title-link" name="washing-machine-running" href="#washing-machine-running"></a> Washing Machine Running</h3>
<p>This example creates a washing machine “load running” sensor by monitoring an energy meter connected to the washer. During the washers operation, the energy meter will fluctuate wildly, hitting zero frequently even before the load is finished. By utilizing <code class="highlighter-rouge">off_delay</code>, we can have this sensor only turn off if there has been no washer activity for 5 minutes.</p>
<p>This example creates a washing machine “load running” sensor by monitoring an
energy meter connected to the washer. During the washers operation, the energy
meter will fluctuate wildly, hitting zero frequently even before the load is
finished. By utilizing <code class="highlighter-rouge">off_delay</code>, we can have this sensor only turn off if
there has been no washer activity for 5 minutes.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Determine when the washing machine has a load running.</span>
<span class="s">binary_sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">name</span><span class="pi">:</span> <span class="s">Washing Machine</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sensor.washing_machine_power.state</span><span class="nv"> </span><span class="s">&gt;</span><span class="nv"> </span><span class="s">0</span><span class="nv"> </span><span class="s">}}'</span>
<span class="s">off_delay</span><span class="pi">:</span>
<span class="s">minutes</span><span class="pi">:</span> <span class="s">5</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">washing_machine</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Washing</span><span class="nv"> </span><span class="s">Machine"</span>
<span class="s">off_delay</span><span class="pi">:</span>
<span class="s">minutes</span><span class="pi">:</span> <span class="s">5</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{{ states('sensor.washing_machine_power')|float &gt; 0 }}</span>
</code></pre>
</div>
<h3><a class="title-link" name="is-anyone-home" href="#is-anyone-home"></a> Is anyone home?</h3>
<h3><a class="title-link" name="is-anyone-home" href="#is-anyone-home"></a> Is Anyone Home?</h3>
<p>This example is determining if anyone is home based on the combination
of device tracking and motion sensors. Its extremely useful if you
have kids/baby sitter/ grand parents who might still be in your
have kids/baby sitter/grand parents who might still be in your
house that arent represented by a trackable device in home
assistant. This is providing a composite of wifi based device tracking
and z-wave multisensor presence sensors.</p>
assistant. This is providing a composite of WiFi based device tracking
and Z-Wave multisensor presence sensors.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">binary_sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">people_home</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">device_tracker.sean</span>
<span class="pi">-</span> <span class="s">device_tracker.susan</span>
<span class="pi">-</span> <span class="s">binary_sensor.office_124</span>
<span class="pi">-</span> <span class="s">binary_sensor.hallway_134</span>
<span class="pi">-</span> <span class="s">binary_sensor.living_room_139</span>
<span class="pi">-</span> <span class="s">binary_sensor.porch_ms6_1_129</span>
<span class="pi">-</span> <span class="s">binary_sensor.family_room_144</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{%- if is_state("device_tracker.sean", "home")</span>
<span class="no">or is_state("device_tracker.susan", "home")</span>
<span class="no">or is_state("binary_sensor.office_124", "on")</span>
<span class="no">or is_state("binary_sensor.hallway_134", "on")</span>
<span class="no">or is_state("binary_sensor.living_room_139", "on")</span>
<span class="no">or is_state("binary_sensor.porch_ms6_1_129", "on")</span>
<span class="no">or is_state("binary_sensor.family_room_144", "on")</span>
<span class="no">-%}</span>
<span class="no">True</span>
<span class="no">{%- else -%}</span>
<span class="no">False</span>
<span class="no">{%- endif %}</span>
<span class="no">entity_id:</span>
<span class="no">- device_tracker.sean</span>
<span class="no">- device_tracker.susan</span>
<span class="no">- binary_sensor.office_124</span>
<span class="no">- binary_sensor.hallway_134</span>
<span class="no">- binary_sensor.living_room_139</span>
<span class="no">- binary_sensor.porch_ms6_1_129</span>
<span class="no">- binary_sensor.family_room_144</span>
<span class="no">{{ is_state('device_tracker.sean', 'home')</span>
<span class="no">or is_state('device_tracker.susan', 'home')</span>
<span class="no">or is_state('binary_sensor.office_124', 'on')</span>
<span class="no">or is_state('binary_sensor.hallway_134', 'on')</span>
<span class="no">or is_state('binary_sensor.living_room_139', 'on')</span>
<span class="no">or is_state('binary_sensor.porch_ms6_1_129', 'on')</span>
<span class="no">or is_state('binary_sensor.family_room_144', 'on') }}</span>
</code></pre>
</div>
</article>
@ -204,6 +246,12 @@ and z-wave multisensor presence sensors.</p>
<div class='brand-logo-container section'>
<img src='/images/supported_brands/home-assistant.png' />
</div>
<div class='section'>
IoT class<sup><a href='/blog/2016/02/12/classifying-the-internet-of-things/#classifiers'><i class="icon-info-sign"></i></a></sup>: Local Push
</div>
<div class='section'>
Introduced in release: 0.12
</div>
<div class='section'>
This is a platform for
<a href='/components/binary_sensor/'>the Binary Sensor component</a>.
@ -221,7 +269,7 @@ and z-wave multisensor presence sensors.</p>
Template Sensor
</a></li>
<li><a href='/components/switch.template/'>
Template switch
Template Switch
</a></li>
</ul>
</div>

View file

@ -74,7 +74,7 @@
</h1>
</header>
<hr class="divider">
<p>To get your ZigBee binary sensors working with Home Assistant, follow then instructions for the general <a href="/components/zha/">ZigBee Home Automationcomponent</a>.</p>
<p>To get your ZigBee binary sensors working with Home Assistant, follow the instructions for the general <a href="/components/zha/">ZigBee Home Automation component</a>.</p>
</article>
</div>
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">

View file

@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Template Cover - Home Assistant</title>
<meta name="author" content="Home Assistant">
<meta name="description" content="Instructions how to integrate Template covers into Home Assistant.">
<meta name="description" content="Instructions how to integrate Template Covers into Home Assistant.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://home-assistant.io/components/cover.template/">
<meta property="fb:app_id" content="338291289691179">
@ -16,12 +16,12 @@
<meta property="og:site_name" content="Home Assistant">
<meta property="og:url" content="https://home-assistant.io/components/cover.template/">
<meta property="og:type" content="article">
<meta property="og:description" content="Instructions how to integrate Template covers into Home Assistant.">
<meta property="og:description" content="Instructions how to integrate Template Covers into Home Assistant.">
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@home_assistant">
<meta name="twitter:title" content="Template Cover">
<meta name="twitter:description" content="Instructions how to integrate Template covers into Home Assistant.">
<meta name="twitter:description" content="Instructions how to integrate Template Covers into Home Assistant.">
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
@ -74,15 +74,18 @@
</h1>
</header>
<hr class="divider">
<p>The <code class="highlighter-rouge">template</code> platform can create covers that combine components and provides the ability to run scripts or invoke services for each of the open, close, stop, position, and tilt commands of a cover.</p>
<p>To enable Template covers in your installation, add the following to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
<p>The <code class="highlighter-rouge">template</code> platform can create covers that combine components and provides
the ability to run scripts or invoke services for each of the open, close,
stop, position, and tilt commands of a cover.</p>
<p>To enable Template Covers in your installation, add the following to your
<code class="highlighter-rouge">configuration.yaml</code> file:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">cover</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">covers</span><span class="pi">:</span>
<span class="s">garage_door</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Garage</span><span class="nv"> </span><span class="s">Door"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">'{{is_state('sensor.garage_door</span><span class="nv"> </span><span class="s">&gt;</span><span class="nv"> </span><span class="s">0'}}'"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states('sensor.garage_door')|float</span><span class="nv"> </span><span class="s">&gt;</span><span class="nv"> </span><span class="s">0</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">open_cover</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">script.open_garage_door</span>
<span class="s">close_cover</span><span class="pi">:</span>
@ -91,55 +94,127 @@
<span class="s">service</span><span class="pi">:</span> <span class="s">script.stop_garage_door</span>
</code></pre>
</div>
<p>Configuration variables:</p>
<ul>
<li><strong>covers</strong> array (<em>Required</em>): List of your coverss.
<ul>
<li><strong>open_cover</strong> (<em>Optional</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the cover is opened. If <code class="highlighter-rouge">open_cover</code> is specified, <code class="highlighter-rouge">close_cover</code> must also be specified. At least one of <code class="highlighter-rouge">open_cover</code> and <code class="highlighter-rouge">set_cover_position</code> must be specified.</li>
<li><strong>close_cover</strong> (<em>Optional</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the cover is closed.</li>
<li><strong>stop_cover</strong> (<em>Optional</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the cover is stopped.</li>
<li><strong>set_cover_position</strong> (<em>Optional</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the cover is set to a specific value (between 0 and 100).</li>
<li><strong>set_cover_tilt_position</strong> (<em>Optional</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the cover tilt is set to a specific value (between 0 and 100).</li>
<li><strong>value_template</strong> (<em>Optional</em>): Defines a <a href="/topics/templating/">template</a> to get the state of the cover. Valid values are open/true or closed/false. <code class="highlighter-rouge">value_template</code> and <code class="highlighter-rouge">position_template</code> cannot be specified concurrently.</li>
<li><strong>position_template</strong> (<em>Optional</em>): Defines a <a href="/topics/templating/">template</a> to get the state of the cover. Legal values are numbers between 0 (closed) and 100 (open). <code class="highlighter-rouge">value_template</code> and <code class="highlighter-rouge">position_template</code> cannot be specified concurrently.</li>
<li><strong>tilt_template</strong> (<em>Optional</em>): Defines a <a href="/topics/templating/">template</a> to get the tilt state of the cover. Legal values are numbers between 0 (closed) and 100 (open).</li>
<li><strong>optimistic</strong> (<em>Optional</em>): Force cover position to use optimistic mode. Value is either <code class="highlighter-rouge">true</code> or <code class="highlighter-rouge">false</code>. <a href="#optimistic-mode">See below</a> for more details.</li>
<li><strong>tilt_optimistic</strong> (<em>Optional</em>): Force cover tilt position to use optimistic mode. Value is either <code class="highlighter-rouge">true</code> or <code class="highlighter-rouge">false</code>. <a href="#optimistic mode">See below</a> for more details.</li>
<li><strong>icon_template</strong> (<em>Optional</em>): Defines a <a href="/topics/templating/">template</a> to specify which icon to use. Either <code class="highlighter-rouge">value_template</code> or <code class="highlighter-rouge">position_template</code> must be specified.</li>
<li><strong>friendly_name</strong> (<em>Optional</em>): Name to use in the frontend.</li>
<li><strong>entity_id</strong> (<em>Optional</em>): Add a list of entity IDs so the switch only reacts to state changes of these entities. This will reduce the number of times the cover will try to update its state.</li>
</ul>
</li>
</ul>
<h2><a class="title-link" name="optitmistic-mode" href="#optitmistic-mode"></a> Optitmistic Mode</h2>
<p>In optmistic mode, the cover position state is maintained internally. This mode is automatically enabled if neither <code class="highlighter-rouge">value_template</code> or <code class="highlighter-rouge">position_template</code> are sepcified. Note that this is unlikely to be very reliable without some feedback mechanism, since there is otherwise no way to know if the cover is moving properly. The cover can be forced into optimistic mode by using the <code class="highlighter-rouge">optimistic</code> attribute. There is an equivalent mode for tilt-position that is enabled when <code class="highlighter-rouge">tilt_template</code> is not specified or when the <code class="highlighter-rouge">tilt-optimistic</code> attribute is used.</p>
<div class="config-vars">
<h3><a class="title-link" name="configuration-variables" href="#configuration-variables"></a> Configuration Variables</h3>
<dl class="">
<dt><a class="title-link" name="covers" href="#covers"></a> covers</dt>
<dd>
<p class="desc"><span class="type">(<span class="map">map</span>)</span><span class="required">(Required)</span><span class="description">List of your covers.</span></p>
</dd>
<dd>
<dl class="nested">
<dt><a class="title-link" name="friendly_name" href="#friendly_name"></a> friendly_name</dt>
<dd>
<p class="desc"><span class="type">(<span class="string">string</span>)</span><span class="required">(Optional)</span><span class="description">Name to use in the frontend.</span></p>
</dd>
<dt><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</dt>
<dd>
<p class="desc"><span class="type">(<span class="string list">string | list</span>)</span><span class="required">(Optional)</span><span class="description">Add a list of entity IDs so the switch only reacts to state changes of these entities. This will reduce the number of times the cover will try to update its state.</span></p>
</dd>
<dt><a class="title-link" name="value_template" href="#value_template"></a> value_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Exclusive)</span><span class="description">Defines a template to get the state of the cover. Valid values are <code class="highlighter-rouge">open</code>/<code class="highlighter-rouge">true</code> or <code class="highlighter-rouge">closed</code>/<code class="highlighter-rouge">false</code>. <a href="#value_template"><code class="highlighter-rouge">value_template</code></a> and <a href="#position_template"><code class="highlighter-rouge">position_template</code></a> cannot be specified concurrently.</span></p>
</dd>
<dt><a class="title-link" name="position_template" href="#position_template"></a> position_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Exclusive)</span><span class="description">Defines a template to get the state of the cover. Legal values are numbers between <code class="highlighter-rouge">0</code> (closed) and <code class="highlighter-rouge">100</code> (open). <a href="#value_template"><code class="highlighter-rouge">value_template</code></a> and <a href="#position_template"><code class="highlighter-rouge">position_template</code></a> cannot be specified concurrently.</span></p>
</dd>
<dt><a class="title-link" name="icon_template" href="#icon_template"></a> icon_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines a template to specify which icon to use.</span></p>
</dd>
<dt><a class="title-link" name="open_cover" href="#open_cover"></a> open_cover</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Inclusive)</span><span class="description">Defines an action to run when the cover is opened. If <a href="#open_cover"><code class="highlighter-rouge">open_cover</code></a> is specified, <a href="#close_cover"><code class="highlighter-rouge">close_cover</code></a> must also be specified. At least one of <a href="#open_cover"><code class="highlighter-rouge">open_cover</code></a> and <a href="#set_cover_position"><code class="highlighter-rouge">set_cover_position</code></a> must be specified.</span></p>
</dd>
<dt><a class="title-link" name="close_cover" href="#close_cover"></a> close_cover</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Inclusive)</span><span class="description">Defines an action to run when the cover is closed.</span></p>
</dd>
<dt><a class="title-link" name="stop_cover" href="#stop_cover"></a> stop_cover</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines an action to run when the cover is stopped.</span></p>
</dd>
<dt><a class="title-link" name="set_cover_position" href="#set_cover_position"></a> set_cover_position</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines an action to run when the cover is set to a specific value (between <code class="highlighter-rouge">0</code> and <code class="highlighter-rouge">100</code>).</span></p>
</dd>
<dt><a class="title-link" name="set_cover_tilt_position" href="#set_cover_tilt_position"></a> set_cover_tilt_position</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines an action to run when the cover tilt is set to a specific value (between <code class="highlighter-rouge">0</code> and <code class="highlighter-rouge">100</code>).</span></p>
</dd>
<dt><a class="title-link" name="optimistic" href="#optimistic"></a> optimistic</dt>
<dd>
<p class="desc"><span class="type">(<span class="bool">bool</span>)</span><span class="required">(Optional)</span><span class="description">Force cover position to use <a href="#optimistic-mode">optimistic mode</a>.</span></p>
<p class="default">Default value: false</p>
</dd>
<dt><a class="title-link" name="tilt_optimistic" href="#tilt_optimistic"></a> tilt_optimistic</dt>
<dd>
<p class="desc"><span class="type">(<span class="bool">bool</span>)</span><span class="required">(Optional)</span><span class="description">Force cover tilt position to use <a href="#optimistic-mode">optimistic mode</a>.</span></p>
<p class="default">Default value: false</p>
</dd>
<dt><a class="title-link" name="tilt_template" href="#tilt_template"></a> tilt_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines a template to get the tilt state of the cover. Legal values are numbers between <code class="highlighter-rouge">0</code> (closed) and <code class="highlighter-rouge">100</code> (open).</span></p>
</dd>
</dl>
</dd>
</dl>
</div>
<h2><a class="title-link" name="considerations" href="#considerations"></a> Considerations</h2>
<p>If you are using the state of a platform that takes extra time to load, the
Template Cover may get an <code class="highlighter-rouge">unknown</code> state during startup. This results
in error messages in your log file until that platform has completed loading.
If you use <code class="highlighter-rouge">is_state()</code> function in your template, you can avoid this situation.
For example, you would replace
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">states.switch.source.state</span><span class="w"> </span><span class="err">==</span><span class="w"> </span><span class="err">'on'</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code>
with this equivalent that returns <code class="highlighter-rouge">true</code>/<code class="highlighter-rouge">false</code> and never gives an unknown
result:
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">is_state('switch.source',</span><span class="w"> </span><span class="err">'on')</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code></p>
<h2><a class="title-link" name="optimistic-mode" href="#optimistic-mode"></a> Optimistic Mode</h2>
<p>In optimistic mode, the cover position state is maintained internally. This
mode is automatically enabled if neither <a href="#value_template"><code class="highlighter-rouge">value_template</code></a> or
<a href="#position_template"><code class="highlighter-rouge">position_template</code></a> are specified. Note that this is
unlikely to be very reliable without some feedback mechanism, since there is
otherwise no way to know if the cover is moving properly. The cover can be
forced into optimistic mode by using the <a href="#optimistic"><code class="highlighter-rouge">optimistic</code></a>
attribute. There is an equivalent mode for <code class="highlighter-rouge">tilt_position</code> that is enabled
when <a href="#tilt_template"><code class="highlighter-rouge">tilt_template</code></a> is not specified or when the
<a href="#tilt_optimistic"><code class="highlighter-rouge">tilt_optimistic</code></a> attribute is used.</p>
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
<p>In this section you will find some real life examples of how to use this cover.</p>
<h3><a class="title-link" name="garage-door" href="#garage-door"></a> Garage Door</h3>
<p>This example converts a garage door with a controllable switch and position sensor into a cover.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code>
<span class="s">cover</span><span class="pi">:</span>
<p>This example converts a garage door with a controllable switch and position
sensor into a cover.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">cover</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">covers</span><span class="pi">:</span>
<span class="s">garage_door</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Garage</span><span class="nv"> </span><span class="s">Door'</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">sensor.garage_door</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Garage</span><span class="nv"> </span><span class="s">Door"</span>
<span class="s">position_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states('sensor.garage_door')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">open_cover</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_on</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.garage_door</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.garage_door</span>
<span class="s">close_cover</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_off</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.garage_door</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.garage_door</span>
<span class="s">stop_cover</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_on</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.garage_door</span>
<span class="s">icon_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{%</span><span class="nv"> </span><span class="s">if</span><span class="nv"> </span><span class="s">not</span><span class="nv"> </span><span class="s">is_state('sensor.garage_door',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">%}mdi:garage-open{%</span><span class="nv"> </span><span class="s">else</span><span class="nv"> </span><span class="s">%}mdi:garage{%</span><span class="nv"> </span><span class="s">endif</span><span class="nv"> </span><span class="s">%}"</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.garage_door</span>
<span class="s">icon_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{% if states('sensor.garage_door')|float &gt; 0 %}</span>
<span class="no">mdi:garage-open</span>
<span class="no">{% else %}</span>
<span class="no">mdi:garage</span>
<span class="no">{% endif %}</span>
</code></pre>
</div>
<h3><a class="title-link" name="multi-covers" href="#multi-covers"></a> Multi Covers</h3>
<h3><a class="title-link" name="multiple-covers" href="#multiple-covers"></a> Multiple Covers</h3>
<p>This example allows you to control two or more covers at once.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code>
<span class="s">homeassistant</span><span class="pi">:</span>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">homeassistant</span><span class="pi">:</span>
<span class="s">customize</span><span class="pi">:</span>
<span class="s">all_covers</span><span class="pi">:</span>
<span class="s">assume_state</span><span class="pi">:</span> <span class="s">true</span>
@ -148,7 +223,7 @@
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">covers</span><span class="pi">:</span>
<span class="s">all_covers</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">All</span><span class="nv"> </span><span class="s">Covers'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">All</span><span class="nv"> </span><span class="s">Covers"</span>
<span class="s">open_cover</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">script.cover_all_open</span>
<span class="s">close_cover</span><span class="pi">:</span>
@ -158,30 +233,23 @@
<span class="s">set_cover_position</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">script.cover_all_set_position</span>
<span class="s">data_template</span><span class="pi">:</span>
<span class="s">position</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">position</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;</span>
<span class="no">{% if is_state('sensor.all_covers', 'open') %}</span>
<span class="no">open</span>
<span class="no">{% else %}</span>
<span class="no">closed</span>
<span class="no">{% endif %}</span>
<span class="s">icon_template</span><span class="pi">:</span> <span class="pi">&gt;</span>
<span class="s">position</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">position</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state('sensor.all_covers',</span><span class="nv"> </span><span class="s">'open')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">icon_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{% if is_state('sensor.all_covers', 'open') %}</span>
<span class="no">mdi:window-open</span>
<span class="no">{% else %}</span>
<span class="no">mdi:window-closed</span>
<span class="no">{% endif %}</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">cover.livingroom</span>
<span class="no">entity_id:</span>
<span class="no">- cover.bedroom</span>
<span class="no">- cover.livingroom</span>
<span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">all_covers</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{% if is_state('cover.bedroom', 'open') %}</span>
<span class="no">open</span>
<span class="no">{% elif is_state('cover.livingroom', 'open') %}</span>
@ -189,52 +257,52 @@
<span class="no">{% else %}</span>
<span class="no">closed</span>
<span class="no">{% endif %}</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">cover.livingroom</span>
<span class="no">entity_id:</span>
<span class="no">- cover.bedroom</span>
<span class="no">- cover.livingroom</span>
<span class="s">script</span><span class="pi">:</span>
<span class="s">cover_all_open</span><span class="pi">:</span>
<span class="s">sequence</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.open_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.open_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.livingroom</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">cover.livingroom</span>
<span class="s">cover_all_stop</span><span class="pi">:</span>
<span class="s">sequence</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.stop_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.stop_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.livingroom</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">cover.livingroom</span>
<span class="s">cover_all_close</span><span class="pi">:</span>
<span class="s">sequence</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.close_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.close_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.livingroom</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">cover.livingroom</span>
<span class="s">cover_all_set_position</span><span class="pi">:</span>
<span class="s">sequence</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.set_cover_position</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.bedroom</span>
<span class="s">data_template</span><span class="pi">:</span>
<span class="s">position</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">position</span><span class="nv"> </span><span class="s">}}"</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.set_cover_position</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.livingroom</span>
<span class="s">data_template</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">cover.bedroom</span>
<span class="pi">-</span> <span class="s">cover.livingroom</span>
<span class="s">position</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">position</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">automation</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">alias</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Close</span><span class="nv"> </span><span class="s">covers</span><span class="nv"> </span><span class="s">at</span><span class="nv"> </span><span class="s">night'</span>
<span class="pi">-</span> <span class="s">alias</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Close</span><span class="nv"> </span><span class="s">covers</span><span class="nv"> </span><span class="s">at</span><span class="nv"> </span><span class="s">night"</span>
<span class="s">trigger</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">sun</span>
<span class="s">event</span><span class="pi">:</span> <span class="s">sunset</span>
<span class="s">offset</span><span class="pi">:</span> <span class="s1">'</span><span class="s">+00:30:00'</span>
<span class="s">action</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">cover.set_cover_position</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.all_covers</span>
<span class="s">data_template</span><span class="pi">:</span>
<span class="s">position</span><span class="pi">:</span> <span class="s">25</span>
<span class="pi">-</span> <span class="s">service</span><span class="pi">:</span> <span class="s">cover.set_cover_position</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.all_covers</span>
<span class="s">position</span><span class="pi">:</span> <span class="s">25</span>
</code></pre>
</div>
</article>
@ -269,7 +337,7 @@
Template Sensor
</a></li>
<li><a href='/components/switch.template/'>
Template switch
Template Switch
</a></li>
</ul>
</div>

View file

@ -783,11 +783,11 @@ var allComponents = [
{url:"/components/switch.tellduslive/", title:"Telldus Live Switch", cat:"switch", featured: false, v: "0.0", logo: "telldus.png"},
{url:"/components/sensor.tellduslive/", title:"Telldus Live sensor", cat:"sensor", featured: false, v: "0.0", logo: "telldus.png"},
{url:"/components/notify.telstra/", title:"Telstra", cat:"notifications", featured: false, v: "0.31", logo: "telstra.png"},
{url:"/components/binary_sensor.template/", title:"Template Binary Sensor", cat:"binary-sensor", featured: false, v: "0.0", logo: "home-assistant.png"},
{url:"/components/binary_sensor.template/", title:"Template Binary Sensor", cat:"binary-sensor", featured: false, v: "0.12", logo: "home-assistant.png"},
{url:"/components/cover.template/", title:"Template Cover", cat:"cover", featured: false, v: "0.48", logo: "home-assistant.png"},
{url:"/components/light.template/", title:"Template Light", cat:"light", featured: false, v: "0.46", logo: "home-assistant.png"},
{url:"/components/sensor.template/", title:"Template Sensor", cat:"sensor", featured: false, v: "0.12", logo: "home-assistant.png"},
{url:"/components/switch.template/", title:"Template switch", cat:"switch", featured: false, v: "0.13", logo: "home-assistant.png"},
{url:"/components/switch.template/", title:"Template Switch", cat:"switch", featured: false, v: "0.13", logo: "home-assistant.png"},
{url:"/components/device_tracker.tesla/", title:"Tesla", cat:"presence-detection", featured: false, v: "0.53", logo: "tesla.png"},
{url:"/components/tesla/", title:"Tesla", cat:"hub", featured: false, v: "0.53", logo: "tesla.png"},
{url:"/components/binary_sensor.tesla/", title:"Tesla Binary Sensor", cat:"binary-sensor", featured: false, v: "0.53", logo: "tesla.png"},
@ -1722,7 +1722,7 @@ allComponents.pop(); // remove placeholder element at the end
<li><a href='/components/cover.template/'>Template Cover</a></li>
<li><a href='/components/light.template/'>Template Light</a></li>
<li><a href='/components/sensor.template/'>Template Sensor</a></li>
<li><a href='/components/switch.template/'>Template switch</a></li>
<li><a href='/components/switch.template/'>Template Switch</a></li>
<li><a href='/components/device_tracker.tesla/'>Tesla</a></li>
<li><a href='/components/tesla/'>Tesla</a></li>
<li><a href='/components/binary_sensor.tesla/'>Tesla Binary Sensor</a></li>

View file

@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Template Light - Home Assistant</title>
<meta name="author" content="Home Assistant">
<meta name="description" content="Instructions how to integrate Template lights into Home Assistant.">
<meta name="description" content="Instructions how to integrate Template Lights into Home Assistant.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://home-assistant.io/components/light.template/">
<meta property="fb:app_id" content="338291289691179">
@ -16,12 +16,12 @@
<meta property="og:site_name" content="Home Assistant">
<meta property="og:url" content="https://home-assistant.io/components/light.template/">
<meta property="og:type" content="article">
<meta property="og:description" content="Instructions how to integrate Template lights into Home Assistant.">
<meta property="og:description" content="Instructions how to integrate Template Lights into Home Assistant.">
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@home_assistant">
<meta name="twitter:title" content="Template Light">
<meta name="twitter:description" content="Instructions how to integrate Template lights into Home Assistant.">
<meta name="twitter:description" content="Instructions how to integrate Template Lights into Home Assistant.">
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
@ -74,15 +74,19 @@
</h1>
</header>
<hr class="divider">
<p>The <code class="highlighter-rouge">template</code> platform creates lights that combine components and provides the ability to run scripts or invoke services for each of the on, off, and brightness commands of a light.</p>
<p>To enable Template lights in your installation, add the following to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
<p>The <code class="highlighter-rouge">template</code> platform creates lights that combine components and provides the
ability to run scripts or invoke services for each of the on, off, and
brightness commands of a light.</p>
<p>To enable Template Lights in your installation, add the following to your
<code class="highlighter-rouge">configuration.yaml</code> file:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">light</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">lights</span><span class="pi">:</span>
<span class="s">theater_lights</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Theater</span><span class="nv"> </span><span class="s">Lights"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{is_state('sensor.theater_brightness.attributes.lux</span><span class="nv"> </span><span class="s">&gt;</span><span class="nv"> </span><span class="s">0'}}"</span>
<span class="s">level_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">sensor.theater_brightness.attributes.lux|int</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">sensor.theater_brightness.attributes.lux|int</span><span class="nv"> </span><span class="s">&gt;</span><span class="nv"> </span><span class="s">0</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">turn_on</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">script.theater_lights_on</span>
<span class="s">turn_off</span><span class="pi">:</span>
@ -90,48 +94,85 @@
<span class="s">set_level</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">script.theater_lights_level</span>
<span class="s">data_template</span><span class="pi">:</span>
<span class="s">brightness</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{brightness}}"</span>
<span class="s">level_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{is_state('sensor.theater_brightness.attributes.lux'}}"</span>
<span class="s">brightness</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">brightness</span><span class="nv"> </span><span class="s">}}"</span>
</code></pre>
</div>
<p>Configuration variables:</p>
<ul>
<li><strong>lights</strong> array (<em>Required</em>): List of your lights.
<ul>
<li><strong>friendly_name</strong> (<em>Optional</em>): Name to use in the Frontend.</li>
<li><strong>value_template</strong> (<em>Optional</em>): Defines a <a href="/topics/templating/">template</a> to get the state of the light. If not provided the component defaults to optimisitc state determination.</li>
<li><strong>turn_on</strong> (<em>Required</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the light is turned on.</li>
<li><strong>turn_off</strong> (<em>Required</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the light is turned off.</li>
<li><strong>set_level</strong> (<em>Optional</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the light is given a brightness command.</li>
<li><strong>level_template</strong> (*Optional): Defines a <a href="/topics/templating/">template</a> to get the brightness of the light. If not provided the component defaults to optimisitc brightness determination.</li>
<li><strong>entity_id</strong> (<em>Optional</em>): Add a list of entity IDs so the switch only reacts to state changes of these entities. This will reduce the number of times the light will try to update its state.</li>
</ul>
</li>
</ul>
<div class="config-vars">
<h3><a class="title-link" name="configuration-variables" href="#configuration-variables"></a> Configuration Variables</h3>
<dl class="">
<dt><a class="title-link" name="switches" href="#switches"></a> switches</dt>
<dd>
<p class="desc"><span class="type">(<span class="map">map</span>)</span><span class="required">(Required)</span><span class="description">List of your lights.</span></p>
</dd>
<dd>
<dl class="nested">
<dt><a class="title-link" name="friendly_name" href="#friendly_name"></a> friendly_name</dt>
<dd>
<p class="desc"><span class="type">(<span class="string">string</span>)</span><span class="required">(Optional)</span><span class="description">Name to use in the frontend.</span></p>
</dd>
<dt><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</dt>
<dd>
<p class="desc"><span class="type">(<span class="string list">string | list</span>)</span><span class="required">(Optional)</span><span class="description">Add a list of entity IDs so the switch only reacts to state changes of these entities. This will reduce the number of times the light will try to update its state.</span></p>
</dd>
<dt><a class="title-link" name="value_template" href="#value_template"></a> value_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines a template to get the state of the light.</span></p>
<p class="default">Default value: optimistic</p>
</dd>
<dt><a class="title-link" name="level_template" href="#level_template"></a> level_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines a template to get the brightness of the light.</span></p>
<p class="default">Default value: optimistic</p>
</dd>
<dt><a class="title-link" name="turn_on" href="#turn_on"></a> turn_on</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Required)</span><span class="description">Defines an action to run when the light is turned on.</span></p>
</dd>
<dt><a class="title-link" name="turn_off" href="#turn_off"></a> turn_off</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Required)</span><span class="description">Defines an action to run when the light is turned off.</span></p>
</dd>
<dt><a class="title-link" name="set_level" href="#set_level"></a> set_level</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines an action to run when the light is given a brightness command.</span></p>
</dd>
</dl>
</dd>
</dl>
</div>
<h2><a class="title-link" name="considerations" href="#considerations"></a> Considerations</h2>
<p>If you are using the state of a platform that takes extra time to load, the template light may get an unknown state during startup. This results in error messages in your log file until that platform has completed loading. If you use is_state() function in your template, you can avoid this situation. For example, you would replace {{ states.switch.source.state }} with this equivalent that returns true/false and never gives an unknown result:
{{ is_state(switch.source, on) }}</p>
<p>If you are using the state of a platform that takes extra time to load, the
Template Light may get an <code class="highlighter-rouge">unknown</code> state during startup. This results
in error messages in your log file until that platform has completed loading.
If you use <code class="highlighter-rouge">is_state()</code> function in your template, you can avoid this situation.
For example, you would replace
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">states.switch.source.state</span><span class="w"> </span><span class="err">==</span><span class="w"> </span><span class="err">'on'</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code>
with this equivalent that returns <code class="highlighter-rouge">true</code>/<code class="highlighter-rouge">false</code> and never gives an unknown
result:
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">is_state('switch.source',</span><span class="w"> </span><span class="err">'on')</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code></p>
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
<p>In this section you will find some real life examples of how to use this light.</p>
<h3><a class="title-link" name="theater-volume-control" href="#theater-volume-control"></a> Theater Volume Control</h3>
<p>This example shows a light that is actually a home theaters volume. This component gives you the flexibility to provide whatever youd like to send as the payload to the consumer including any scale conversions you may need to make; the media_player component needs a floating point percentage value 0.0-1.0</p>
<p>This example shows a light that is actually a home theaters volume. This
component gives you the flexibility to provide whatever youd like to send as
the payload to the consumer including any scale conversions you may need to
make; the <a href="/components/media_player/">Media Player component</a> needs a floating
point percentage value from <code class="highlighter-rouge">0.0</code> to <code class="highlighter-rouge">1.0</code>.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">light</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">lights</span><span class="pi">:</span>
<span class="s">theater_volume</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Receiver</span><span class="nv"> </span><span class="s">Volume'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Receiver</span><span class="nv"> </span><span class="s">Volume"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no"> </span>
<span class="no">{%- if is_state("media_player.receiver", "on") -%}</span>
<span class="no">{%- if states.media_player.receiver.attributes.is_volume_muted -%}</span>
<span class="no">off</span>
<span class="no">{%- else -%}</span>
<span class="no">on</span>
<span class="no">{%- endif -%}</span>
<span class="no">{%- else -%}</span>
<span class="no">{% if is_state('media_player.receiver', 'on') %}</span>
<span class="no">{% if states.media_player.receiver.attributes.is_volume_muted %}</span>
<span class="no">off</span>
<span class="no">{% else %}</span>
<span class="no">on</span>
<span class="no">{% endif %}</span>
<span class="no">{% else %}</span>
<span class="no">off</span>
<span class="no">{%- endif -%}</span>
<span class="no"> </span>
<span class="no">{% endif %}</span>
<span class="no">turn_on:</span>
<span class="no">service: media_player.volume_mute</span>
<span class="no">data:</span>
@ -144,18 +185,15 @@
<span class="no">is_volume_muted: true</span>
<span class="no">set_level:</span>
<span class="no">service: media_player.volume_set</span>
<span class="no">data:</span>
<span class="no">entity_id: media_player.receiver</span>
<span class="no">data_template:</span>
<span class="no">volume_level: '{{((brightness / 255 * 100) | int)/100}}'</span>
<span class="no">entity_id: media_player.receiver</span>
<span class="no">volume_level: "{{ (brightness / 255 * 100)|int / 100 }}"</span>
<span class="no">level_template: &gt;-</span>
<span class="no"> </span>
<span class="no">{%- if is_state("media_player.receiver", "on") -%}</span>
<span class="no">{{(255 * states.media_player.receiver.attributes.volume_level) | int}}</span>
<span class="no">{%- else -%}</span>
<span class="no">{% if is_state('media_player.receiver', 'on') %}</span>
<span class="no">{{ (states.media_player.receiver.attributes.volume_level|float * 255)|int }}</span>
<span class="no">{% else %}</span>
<span class="no">0</span>
<span class="no">{%- endif -%}</span>
<span class="no"> </span>
<span class="no">{% endif %}</span>
</code></pre>
</div>
</article>
@ -190,7 +228,7 @@
Template Sensor
</a></li>
<li><a href='/components/switch.template/'>
Template switch
Template Switch
</a></li>
</ul>
</div>

View file

@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Template Sensor - Home Assistant</title>
<meta name="author" content="Home Assistant">
<meta name="description" content="Instructions how to integrate Template sensors into Home Assistant.">
<meta name="description" content="Instructions how to integrate Template Sensors into Home Assistant.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://home-assistant.io/components/sensor.template/">
<meta property="fb:app_id" content="338291289691179">
@ -16,12 +16,12 @@
<meta property="og:site_name" content="Home Assistant">
<meta property="og:url" content="https://home-assistant.io/components/sensor.template/">
<meta property="og:type" content="article">
<meta property="og:description" content="Instructions how to integrate Template sensors into Home Assistant.">
<meta property="og:description" content="Instructions how to integrate Template Sensors into Home Assistant.">
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@home_assistant">
<meta name="twitter:title" content="Template Sensor">
<meta name="twitter:description" content="Instructions how to integrate Template sensors into Home Assistant.">
<meta name="twitter:description" content="Instructions how to integrate Template Sensors into Home Assistant.">
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
@ -74,119 +74,173 @@
</h1>
</header>
<hr class="divider">
<p>The <code class="highlighter-rouge">template</code> platform supports sensors which break out <code class="highlighter-rouge">state_attributes</code> from other entities.</p>
<p>To enable Template sensors in your installation, add the following to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
<p>The <code class="highlighter-rouge">template</code> platform supports sensors which break out <code class="highlighter-rouge">state_attributes</code>
from other entities.</p>
<p>To enable Template Sensors in your installation, add the following to your
<code class="highlighter-rouge">configuration.yaml</code> file:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">solar_angle</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sun.sun.attributes.elevation</span><span class="nv"> </span><span class="s">}}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Sun</span><span class="nv"> </span><span class="s">angle'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Sun</span><span class="nv"> </span><span class="s">angle"</span>
<span class="s">unit_of_measurement</span><span class="pi">:</span> <span class="s1">'</span><span class="s">degrees'</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sun.sun.attributes.elevation</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">sunrise</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sun.sun.attributes.next_rising</span><span class="nv"> </span><span class="s">}}'</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sun.sun.attributes.next_rising</span><span class="nv"> </span><span class="s">}}"</span>
</code></pre>
</div>
<p>Configuration variables:</p>
<ul>
<li><strong>sensors</strong> array (<em>Required</em>): List of your sensors.
<ul>
<li><strong>friendly_name</strong> (<em>Optional</em>): Name to use in the Frontend.</li>
<li><strong>unit_of_measurement</strong> (<em>Optional</em>): Defines the units of measurement of the sensor, if any.</li>
<li><strong>value_template</strong> (<em>Required</em>): Defines a <a href="/docs/configuration/templating/#processing-incoming-data">template</a> to extract a value from the event bus.</li>
<li><strong>icon_template</strong> (<em>Optional</em>): Defines a <a href="/topics/templating/">template</a> for the icon of the sensor.</li>
<li><strong>entity_id</strong> (<em>Optional</em>): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update its state.</li>
</ul>
</li>
</ul>
<div class="config-vars">
<h3><a class="title-link" name="configuration-variables" href="#configuration-variables"></a> Configuration Variables</h3>
<dl class="">
<dt><a class="title-link" name="sensors" href="#sensors"></a> sensors</dt>
<dd>
<p class="desc"><span class="type">(<span class="map">map</span>)</span><span class="required">(Required)</span><span class="description">List of your sensors.</span></p>
</dd>
<dd>
<dl class="nested">
<dt><a class="title-link" name="friendly_name" href="#friendly_name"></a> friendly_name</dt>
<dd>
<p class="desc"><span class="type">(<span class="string">string</span>)</span><span class="required">(Optional)</span><span class="description">Name to use in the frontend.</span></p>
</dd>
<dt><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</dt>
<dd>
<p class="desc"><span class="type">(<span class="string, list">string | list</span>)</span><span class="required">(Optional)</span><span class="description">Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update its state.</span></p>
</dd>
<dt><a class="title-link" name="unit_of_measurement" href="#unit_of_measurement"></a> unit_of_measurement</dt>
<dd>
<p class="desc"><span class="type">(<span class="string">string</span>)</span><span class="required">(Optional)</span><span class="description">Defines the units of measurement of the sensor, if any.</span></p>
</dd>
<dt><a class="title-link" name="value_template" href="#value_template"></a> value_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Required)</span><span class="description">Defines a template to get the state of the sensor.</span></p>
</dd>
<dt><a class="title-link" name="icon_template" href="#icon_template"></a> icon_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Optional)</span><span class="description">Defines a template for the icon of the sensor.</span></p>
</dd>
</dl>
</dd>
</dl>
</div>
<h2><a class="title-link" name="considerations" href="#considerations"></a> Considerations</h2>
<p>If you are using the state of a platform that takes extra time to load, the
Template Sensor may get an <code class="highlighter-rouge">unknown</code> state during startup. This results
in error messages in your log file until that platform has completed loading.
If you use <code class="highlighter-rouge">is_state()</code> function in your template, you can avoid this situation.
For example, you would replace
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">states.switch.source.state</span><span class="w"> </span><span class="err">==</span><span class="w"> </span><span class="err">'on'</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code>
with this equivalent that returns <code class="highlighter-rouge">true</code>/<code class="highlighter-rouge">false</code> and never gives an unknown
result:
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">is_state('switch.source',</span><span class="w"> </span><span class="err">'on')</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code></p>
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
<p>In this section you find some real life examples of how to use this sensor.</p>
<h3><a class="title-link" name="sun-angle" href="#sun-angle"></a> Sun angle</h3>
<h3><a class="title-link" name="sun-angle" href="#sun-angle"></a> Sun Angle</h3>
<p>This example shows the sun angle in the frontend.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">solar_angle</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">"%+.1f"|format(states.sun.sun.attributes.elevation)</span><span class="nv"> </span><span class="s">}}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Sun</span><span class="nv"> </span><span class="s">Angle'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Sun</span><span class="nv"> </span><span class="s">Angle"</span>
<span class="s">unit_of_measurement</span><span class="pi">:</span> <span class="s1">'</span><span class="s">°'</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">'%+.1f'|format(states.sun.sun.attributes.elevation)</span><span class="nv"> </span><span class="s">}}"</span>
</code></pre>
</div>
<h3><a class="title-link" name="renaming-sensor-output" href="#renaming-sensor-output"></a> Renaming sensor output</h3>
<p>If you dont like the wording of a sensor output then the template sensor can help too. Lets rename the output of the <a href="/components/sun/">Sun component</a> as a simple example:</p>
<h3><a class="title-link" name="renaming-sensor-output" href="#renaming-sensor-output"></a> Renaming Sensor Output</h3>
<p>If you dont like the wording of a sensor output then the Template Sensor can
help too. Lets rename the output of the <a href="/components/sun/">Sun component</a> as
a simple example:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">sun_state</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{%</span><span class="nv"> </span><span class="s">if</span><span class="nv"> </span><span class="s">is_state("sun.sun",</span><span class="nv"> </span><span class="s">"above_horizon")</span><span class="nv"> </span><span class="s">%}up{%</span><span class="nv"> </span><span class="s">else</span><span class="nv"> </span><span class="s">%}down{%</span><span class="nv"> </span><span class="s">endif</span><span class="nv"> </span><span class="s">%}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Sun</span><span class="nv"> </span><span class="s">state'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Sun</span><span class="nv"> </span><span class="s">State"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{% if is_state('sun.sun', 'above_horizon') %}</span>
<span class="no">up</span>
<span class="no">{% else %}</span>
<span class="no">down</span>
<span class="no">{% endif %}</span>
</code></pre>
</div>
<p>Processes monitored by the <a href="/components/sensor.systemmonitor/">System Monitor sensor</a> show <code class="highlighter-rouge">on</code> or <code class="highlighter-rouge">off</code> if they are running or not. This example shows how the output of a monitored <code class="highlighter-rouge">glances</code> process can be renamed.</p>
<p>Processes monitored by the <a href="/components/sensor.systemmonitor/">System Monitor sensor</a>
show <code class="highlighter-rouge">on</code> or <code class="highlighter-rouge">off</code> if they are running or not. This example shows how the
output of a monitored <code class="highlighter-rouge">glances</code> process can be renamed.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">glances</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{%</span><span class="nv"> </span><span class="s">if</span><span class="nv"> </span><span class="s">is_state("sensor.process_glances",</span><span class="nv"> </span><span class="s">"off")</span><span class="nv"> </span><span class="s">%}not</span><span class="nv"> </span><span class="s">running{%</span><span class="nv"> </span><span class="s">else</span><span class="nv"> </span><span class="s">%}running{%</span><span class="nv"> </span><span class="s">endif</span><span class="nv"> </span><span class="s">%}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Glances'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Glances"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{% if is_state('sensor.process_glances', 'on') %}</span>
<span class="no">running</span>
<span class="no">{% else %}</span>
<span class="no">not running</span>
<span class="no">{% endif %}</span>
</code></pre>
</div>
<p>By comparing the details published on the <a href="/topics/templating/">template</a> page the same can be achieved with a different approach:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{%if</span><span class="nv"> </span><span class="s">states.sensor.ENTITY_ID.state</span><span class="nv"> </span><span class="s">==</span><span class="nv"> </span><span class="s">'on'</span><span class="nv"> </span><span class="s">%}running{%elif</span><span class="nv"> </span><span class="s">states.switch.ENTITY_ID.state</span><span class="nv"> </span><span class="s">==</span><span class="nv"> </span><span class="s">'off'</span><span class="nv"> </span><span class="s">%}not</span><span class="nv"> </span><span class="s">running{%</span><span class="nv"> </span><span class="s">endif</span><span class="nv"> </span><span class="s">%}"</span>
</code></pre>
</div>
<p>The <a href="/components/binary_sensor.template/">Binary template sensor</a> is the one in similar cases if you prefer to see an icon instead of text.</p>
<h3><a class="title-link" name="multiline-example-with-an-if-test" href="#multiline-example-with-an-if-test"></a> Multiline example with an if test</h3>
<p>This example shows a multiple line template with an if test. It looks at a sensing switch and shows on/off in the frontend.</p>
<p>The <a href="/components/binary_sensor.template/">Template Binary Sensor</a> is the one in
similar cases if you prefer to see an icon instead of text.</p>
<h3><a class="title-link" name="multiline-example-with-an-if-test" href="#multiline-example-with-an-if-test"></a> Multiline Example With an <code class="highlighter-rouge">if</code> Test</h3>
<p>This example shows a multiple line template with an <code class="highlighter-rouge">if</code> test. It looks at a
sensing switch and shows <code class="highlighter-rouge">on</code>/<code class="highlighter-rouge">off</code> in the frontend.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">kettle</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Kettle'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Kettle"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{%- if is_state("switch.kettle", "off") %}</span>
<span class="no">off</span>
<span class="no">{% elif states.switch.kettle.attributes.kwh &lt; 1000 %}</span>
<span class="no">standby</span>
<span class="no">{% elif is_state("switch.kettle", "on") %}</span>
<span class="no">on</span>
<span class="no">{% else %}</span>
<span class="no">failed</span>
<span class="no">{%- endif %}</span>
<span class="no">{% if is_state('switch.kettle', 'off') %}</span>
<span class="no">off</span>
<span class="no">{% elif states.switch.kettle.attributes.kwh|float &lt; 1000 %}</span>
<span class="no">standby</span>
<span class="no">{% elif is_state('switch.kettle', 'on') %}</span>
<span class="no">on</span>
<span class="no">{% else %}</span>
<span class="no">failed</span>
<span class="no">{% endif %}</span>
<span class="s">next_sensor</span><span class="pi">:</span>
<span class="pi">[</span><span class="nv">...</span><span class="pi">]</span>
<span class="s">...</span>
</code></pre>
</div>
<p class="note">
Please note the blank line to close the multi-line template.
</p>
<h3><a class="title-link" name="change-the-unit-of-measurement" href="#change-the-unit-of-measurement"></a> Change the unit of measurement</h3>
<p>With a template sensor its easy to convert given values into others if the unit of measurement doesnt fit your needs.</p>
<h3><a class="title-link" name="change-the-unit-of-measurement" href="#change-the-unit-of-measurement"></a> Change The Unit of Measurement</h3>
<p>With a Template Sensor its easy to convert given values into others if the
unit of measurement doesnt fit your needs.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">transmission_down_speed_kbps</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sensor.transmission_down_speed.state</span><span class="nv"> </span><span class="s">|</span><span class="nv"> </span><span class="s">multiply(1024)</span><span class="nv"> </span><span class="s">}}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Transmission</span><span class="nv"> </span><span class="s">Down</span><span class="nv"> </span><span class="s">Speed'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Transmission</span><span class="nv"> </span><span class="s">Down</span><span class="nv"> </span><span class="s">Speed"</span>
<span class="s">unit_of_measurement</span><span class="pi">:</span> <span class="s1">'</span><span class="s">kB/s'</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states('sensor.transmission_down_speed')|float</span><span class="nv"> </span><span class="s">*</span><span class="nv"> </span><span class="s">1024</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">transmission_up_speed_kbps</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{{</span><span class="nv"> </span><span class="s">states.sensor.transmission_up_speed.state</span><span class="nv"> </span><span class="s">|</span><span class="nv"> </span><span class="s">multiply(1024)</span><span class="nv"> </span><span class="s">}}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Transmission</span><span class="nv"> </span><span class="s">Up</span><span class="nv"> </span><span class="s">Speed'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Transmission</span><span class="nv"> </span><span class="s">Up</span><span class="nv"> </span><span class="s">Speed"</span>
<span class="s">unit_of_measurement</span><span class="pi">:</span> <span class="s1">'</span><span class="s">kB/s'</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">states('sensor.transmission_up_speed')|float</span><span class="nv"> </span><span class="s">*</span><span class="nv"> </span><span class="s">1024</span><span class="nv"> </span><span class="s">}}"</span>
</code></pre>
</div>
<h3><a class="title-link" name="change-the-icon" href="#change-the-icon"></a> Change the icon</h3>
<h3><a class="title-link" name="change-the-icon" href="#change-the-icon"></a> Change The Icon</h3>
<p>This example shows how to change the icon based on the day/night cycle.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">sensors</span><span class="pi">:</span>
<span class="s">day_night</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Day/Night'</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{%</span><span class="nv"> </span><span class="s">if</span><span class="nv"> </span><span class="s">is_state("sun.sun",</span><span class="nv"> </span><span class="s">"above_horizon")</span><span class="nv"> </span><span class="s">%}Day{%</span><span class="nv"> </span><span class="s">else</span><span class="nv"> </span><span class="s">%}Night{%</span><span class="nv"> </span><span class="s">endif</span><span class="nv"> </span><span class="s">%}'</span>
<span class="s">icon_template</span><span class="pi">:</span> <span class="s1">'</span><span class="s">{%</span><span class="nv"> </span><span class="s">if</span><span class="nv"> </span><span class="s">is_state("sun.sun",</span><span class="nv"> </span><span class="s">"above_horizon")</span><span class="nv"> </span><span class="s">%}mdi:weather-sunny{%</span><span class="nv"> </span><span class="s">else</span><span class="nv"> </span><span class="s">%}mdi:weather-night{%</span><span class="nv"> </span><span class="s">endif</span><span class="nv"> </span><span class="s">%}'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Day/Night"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{% if is_state('sun.sun', 'above_horizon') %}</span>
<span class="no">Day</span>
<span class="no">{% else %}</span>
<span class="no">Night</span>
<span class="no">{% endif %}</span>
<span class="no">icon_template: &gt;-</span>
<span class="no">{% if is_state('sun.sun', 'above_horizon') %}</span>
<span class="no">mdi:weather-sunny</span>
<span class="no">{% else %}</span>
<span class="no">mdi:weather-night</span>
<span class="no">{% endif %}</span>
</code></pre>
</div>
</article>
@ -217,7 +271,7 @@ Please note the blank line to close the multi-line template.
Template Light
</a></li>
<li><a href='/components/switch.template/'>
Template switch
Template Switch
</a></li>
</ul>
</div>

View file

@ -261,7 +261,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -253,7 +253,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -254,7 +254,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -263,7 +263,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -293,7 +293,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -276,7 +276,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -406,7 +406,7 @@ Use <a href="http://tomeko.net/online_tools/hex_to_base64.php?lang=en1">this</a>
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -342,7 +342,7 @@ This switch will shutdown your host immediately, there will be no confirmation.
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -263,7 +263,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -261,7 +261,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -261,7 +261,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -250,7 +250,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -268,7 +268,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -265,7 +265,7 @@ If this component throws an error when starting home-assistant you should check
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -262,7 +262,7 @@ Currently works using default https port only.
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -263,7 +263,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -263,7 +263,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -262,7 +262,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -253,7 +253,7 @@ component.</p>
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -263,7 +263,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -268,7 +268,7 @@ of the script as linked above).</p>
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -280,7 +280,7 @@ For switching actuators that are only controlled by a single group address and c
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -252,7 +252,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -257,7 +257,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -262,7 +262,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -264,7 +264,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -277,7 +277,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -327,7 +327,7 @@ Make sure that your topic match exact. <code class="highlighter-rouge">some-topi
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -512,7 +512,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -274,7 +274,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -251,7 +251,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -286,7 +286,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -261,7 +261,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -329,7 +329,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -261,7 +261,7 @@ This component relies on raw TCP commands to PulseAudio. In order for PulseAudio
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -252,7 +252,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -298,7 +298,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -298,7 +298,7 @@ can fix the issue.</p>
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -287,7 +287,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -290,7 +290,7 @@ Make sure that the URL matches exactly your endpoint or resource.
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -307,7 +307,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -380,7 +380,7 @@ Then you should update your configuration to:</p>
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -272,7 +272,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -275,7 +275,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -278,7 +278,7 @@ For more info see the PyPi module description: <a href="https://pypi.python.org/
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -266,7 +266,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -244,7 +244,7 @@
Telldus Live Switch
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -256,7 +256,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -6,22 +6,22 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Template switch - Home Assistant</title>
<title>Template Switch - Home Assistant</title>
<meta name="author" content="Home Assistant">
<meta name="description" content="Instructions how to integrate Template switches into Home Assistant.">
<meta name="description" content="Instructions how to integrate Template Switches into Home Assistant.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://home-assistant.io/components/switch.template/">
<meta property="fb:app_id" content="338291289691179">
<meta property="og:title" content="Template switch">
<meta property="og:title" content="Template Switch">
<meta property="og:site_name" content="Home Assistant">
<meta property="og:url" content="https://home-assistant.io/components/switch.template/">
<meta property="og:type" content="article">
<meta property="og:description" content="Instructions how to integrate Template switches into Home Assistant.">
<meta property="og:description" content="Instructions how to integrate Template Switches into Home Assistant.">
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@home_assistant">
<meta name="twitter:title" content="Template switch">
<meta name="twitter:description" content="Instructions how to integrate Template switches into Home Assistant.">
<meta name="twitter:title" content="Template Switch">
<meta name="twitter:description" content="Instructions how to integrate Template Switches into Home Assistant.">
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
@ -70,14 +70,19 @@
<article class="page">
<header>
<h1 class="title indent">
Template switch
Template Switch
</h1>
</header>
<hr class="divider">
<p>The <code class="highlighter-rouge">template</code> platform creates switches that combines components.</p>
<p>For example, if you have a garage door with a toggle switch that operates the motor and a sensor that allows you know whether the door is open or closed, you can combine these into a switch that knows whether the garage door is open or closed.</p>
<p>This can simplify the GUI and make it easier to write automations. You can mark the components you have combined as <code class="highlighter-rouge">hidden</code> so they dont appear themselves.</p>
<p>To enable Template switches in your installation, add the following to your <code class="highlighter-rouge">configuration.yaml</code> file:</p>
<p>For example, if you have a garage door with a toggle switch that operates the
motor and a sensor that allows you know whether the door is open or closed,
you can combine these into a switch that knows whether the garage door is open
or closed.</p>
<p>This can simplify the GUI and make it easier to write automations. You can mark
the components you have combined as <code class="highlighter-rouge">hidden</code> so they dont appear themselves.</p>
<p>To enable Template Switches in your installation, add the following to your
<code class="highlighter-rouge">configuration.yaml</code> file:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">switch</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
@ -86,30 +91,60 @@
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state('sensor.skylight',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">turn_on</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_on</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_open</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_open</span>
<span class="s">turn_off</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_on</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_close</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_close</span>
</code></pre>
</div>
<p>Configuration variables:</p>
<ul>
<li><strong>switches</strong> array (<em>Required</em>): List of your switches.
<ul>
<li><strong>friendly_name</strong> (<em>Optional</em>): Name to use in the Frontend.</li>
<li><strong>value_template</strong> (<em>Required</em>): Defines a <a href="/topics/templating/">template</a> to set the state of the switch.</li>
<li><strong>turn_on</strong> (<em>Required</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the switch is turned on.</li>
<li><strong>turn_off</strong> (<em>Required</em>): Defines an <a href="/getting-started/automation/">action</a> to run when the switch is turned off.</li>
<li><strong>entity_id</strong> (<em>Optional</em>): Add a list of entity IDs so the switch only reacts to state changes of these entities. This will reduce the number of times the switch will try to update its state.</li>
</ul>
</li>
</ul>
<div class="config-vars">
<h3><a class="title-link" name="configuration-variables" href="#configuration-variables"></a> Configuration Variables</h3>
<dl class="">
<dt><a class="title-link" name="switches" href="#switches"></a> switches</dt>
<dd>
<p class="desc"><span class="type">(<span class="map">map</span>)</span><span class="required">(Required)</span><span class="description">List of your switches.</span></p>
</dd>
<dd>
<dl class="nested">
<dt><a class="title-link" name="friendly_name" href="#friendly_name"></a> friendly_name</dt>
<dd>
<p class="desc"><span class="type">(<span class="string">string</span>)</span><span class="required">(Optional)</span><span class="description">Name to use in the frontend.</span></p>
</dd>
<dt><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</dt>
<dd>
<p class="desc"><span class="type">(<span class="string list">string | list</span>)</span><span class="required">(Optional)</span><span class="description">Add a list of entity IDs so the switch only reacts to state changes of these entities. This will reduce the number of times the switch will try to update its state.</span></p>
</dd>
<dt><a class="title-link" name="value_template" href="#value_template"></a> value_template</dt>
<dd>
<p class="desc"><span class="type">(<span class="template"><a href="/docs/configuration/templating/">template</a></span>)</span><span class="required">(Required)</span><span class="description">Defines a template to set the state of the switch.</span></p>
</dd>
<dt><a class="title-link" name="turn_on" href="#turn_on"></a> turn_on</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Required)</span><span class="description">Defines an action to run when the switch is turned on.</span></p>
</dd>
<dt><a class="title-link" name="turn_off" href="#turn_off"></a> turn_off</dt>
<dd>
<p class="desc"><span class="type">(<span class="action"><a href="/docs/scripts/">action</a></span>)</span><span class="required">(Required)</span><span class="description">Defines an action to run when the switch is turned off.</span></p>
</dd>
</dl>
</dd>
</dl>
</div>
<h2><a class="title-link" name="considerations" href="#considerations"></a> Considerations</h2>
<p>If you are using the state of a platform that takes extra time to load, the template switch may get an unknown state during startup. This results in error messages in your log file until that platform has completed loading. If you use <code class="highlighter-rouge">is_state()</code> function in your template, you can avoid this situation. For example, you would replace <code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">states.switch.source.state</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code> with this equivalent that returns true/false and never gives an unknown result:
<p>If you are using the state of a platform that takes extra time to load, the
Template Switch may get an <code class="highlighter-rouge">unknown</code> state during startup. This results
in error messages in your log file until that platform has completed loading.
If you use <code class="highlighter-rouge">is_state()</code> function in your template, you can avoid this situation.
For example, you would replace
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">states.switch.source.state</span><span class="w"> </span><span class="err">==</span><span class="w"> </span><span class="err">'on'</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code>
with this equivalent that returns <code class="highlighter-rouge">true</code>/<code class="highlighter-rouge">false</code> and never gives an unknown
result:
<code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">is_state('switch.source',</span><span class="w"> </span><span class="err">'on')</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code></p>
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
<p>In this section you find some real life examples of how to use this switch.</p>
<h3><a class="title-link" name="copy-switch" href="#copy-switch"></a> Copy switch</h3>
<h3><a class="title-link" name="copy-switch" href="#copy-switch"></a> Copy Switch</h3>
<p>This example shows a switch that copies another switch.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">switch</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
@ -118,58 +153,73 @@
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state('switch.source',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">turn_on</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_on</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.source</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.source</span>
<span class="s">turn_off</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_off</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.source</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.source</span>
</code></pre>
</div>
<h3><a class="title-link" name="toggle-switch" href="#toggle-switch"></a> Toggle switch</h3>
<p>This example shows a switch that takes its state from a sensor, and toggles a switch.</p>
<h3><a class="title-link" name="toggle-switch" href="#toggle-switch"></a> Toggle Switch</h3>
<p>This example shows a switch that takes its state from a sensor, and toggles
a switch.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">switch</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">switches</span><span class="pi">:</span>
<span class="s">blind</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Blind'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Blind"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state_attr('switch.blind_toggle',</span><span class="nv"> </span><span class="s">'sensor_state',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">turn_on</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.toggle</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.blind_toggle</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.blind_toggle</span>
<span class="s">turn_off</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.toggle</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.blind_toggle</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.blind_toggle</span>
</code></pre>
</div>
<h3><a class="title-link" name="sensor-and-two-switches" href="#sensor-and-two-switches"></a> Sensor and two switches</h3>
<p>This example shows a switch that takes its state from a sensor, and uses two momentary switches to control a device.</p>
<h3><a class="title-link" name="sensor-and-two-switches" href="#sensor-and-two-switches"></a> Sensor and Two Switches</h3>
<p>This example shows a switch that takes its state from a sensor, and uses two
momentary switches to control a device.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">switch</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">switches</span><span class="pi">:</span>
<span class="s">skylight</span><span class="pi">:</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s1">'</span><span class="s">Skylight'</span>
<span class="s">friendly_name</span><span class="pi">:</span> <span class="s2">"</span><span class="s">Skylight"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state('sensor.skylight.state',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">turn_on</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_on</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_open</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_open</span>
<span class="s">turn_off</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">switch.turn_on</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_close</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">switch.skylight_close</span>
</code></pre>
</div>
<h3><a class="title-link" name="change-the-icon" href="#change-the-icon"></a> Change the icon</h3>
<h3><a class="title-link" name="change-the-icon" href="#change-the-icon"></a> Change The Icon</h3>
<p>This example shows how to change the icon based on the day/night cycle.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">switch</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">platform</span><span class="pi">:</span> <span class="s">template</span>
<span class="s">switches</span><span class="pi">:</span>
<span class="s">garage</span><span class="pi">:</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state(cover.garage_door',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">value_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{{</span><span class="nv"> </span><span class="s">is_state('cover.garage_door',</span><span class="nv"> </span><span class="s">'on')</span><span class="nv"> </span><span class="s">}}"</span>
<span class="s">turn_on</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">cover.open_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.garage_door</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.garage_door</span>
<span class="s">turn_off</span><span class="pi">:</span>
<span class="s">service</span><span class="pi">:</span> <span class="s">cover.close_cover</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.garage_door</span>
<span class="s">icon_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">{%</span><span class="nv"> </span><span class="s">if</span><span class="nv"> </span><span class="s">is_state('cover.garage_door',</span><span class="nv"> </span><span class="s">'open')</span><span class="nv"> </span><span class="s">%}mdi:garage-open{%</span><span class="nv"> </span><span class="s">else</span><span class="nv"> </span><span class="s">%}mdi:garage{%</span><span class="nv"> </span><span class="s">endif</span><span class="nv"> </span><span class="s">%}"</span>
<span class="s">data</span><span class="pi">:</span>
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">cover.garage_door</span>
<span class="s">icon_template</span><span class="pi">:</span> <span class="pi">&gt;-</span>
<span class="no">{% if is_state('cover.garage_door', 'open') %}</span>
<span class="no">mdi:garage-open</span>
<span class="no">{% else %}</span>
<span class="no">mdi:garage</span>
<span class="no">{% endif %}</span>
</code></pre>
</div>
</article>
@ -353,7 +403,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
Template switch
Template Switch
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -254,7 +254,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
Thinking Cleaner Switch

View file

@ -269,7 +269,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -285,7 +285,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -267,7 +267,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -260,7 +260,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -292,7 +292,7 @@ from Home Assistant running on another Linux computer (the <strong>server</stron
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -249,7 +249,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -284,7 +284,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -266,7 +266,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ZigBee Home Automation Switch - Home Assistant</title>
<meta name="author" content="Home Assistant">
<meta name="description" content="Instructions how to setup ZigBee Home Automation switches within Home Assistant.">
<meta name="description" content="Instructions on how to setup ZigBee Home Automation switches within Home Assistant.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://home-assistant.io/components/switch.zha/">
<meta property="fb:app_id" content="338291289691179">
@ -16,12 +16,12 @@
<meta property="og:site_name" content="Home Assistant">
<meta property="og:url" content="https://home-assistant.io/components/switch.zha/">
<meta property="og:type" content="article">
<meta property="og:description" content="Instructions how to setup ZigBee Home Automation switches within Home Assistant.">
<meta property="og:description" content="Instructions on how to setup ZigBee Home Automation switches within Home Assistant.">
<meta property="og:image" content="https://home-assistant.io/images/default-social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@home_assistant">
<meta name="twitter:title" content="ZigBee Home Automation Switch">
<meta name="twitter:description" content="Instructions how to setup ZigBee Home Automation switches within Home Assistant.">
<meta name="twitter:description" content="Instructions on how to setup ZigBee Home Automation switches within Home Assistant.">
<meta name="twitter:image" content="https://home-assistant.io/images/default-social.png">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet">
<link href="/atom.xml" rel="alternate" title="Home Assistant" type="application/atom+xml">
@ -74,7 +74,7 @@
</h1>
</header>
<hr class="divider">
<p>To get your ZigBee switches working with Home Assistant, follow theminstructions for the general <a href="/components/zha/">ZigBee Home Automation component</a>.</p>
<p>To get your ZigBee switches working with Home Assistant, follow the instructions for the general <a href="/components/zha/">ZigBee Home Automation component</a>.</p>
</article>
</div>
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">
@ -253,7 +253,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -272,7 +272,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -272,7 +272,7 @@ The default functions installed by ZoneMinder are: None, Monitor, Modect, Record
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -268,7 +268,7 @@
<a href='/components/switch.tellduslive/'>Telldus Live Switch</a>
</li>
<li>
<a href='/components/switch.template/'>Template switch</a>
<a href='/components/switch.template/'>Template Switch</a>
</li>
<li>
<a href='/components/switch.thinkingcleaner/'>Thinking Cleaner Switch</a>

View file

@ -258,7 +258,7 @@
Telldus Live Switch
</a></li>
<li><a href='/components/switch.template/'>
Template switch
Template Switch
</a></li>
<li><a href='/components/switch.thinkingcleaner/'>
Thinking Cleaner Switch

View file

@ -3306,7 +3306,7 @@
</url>
<url>
<loc>https://home-assistant.io/components/switch.hook/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/cookbook/automation_for_rainy_days/</loc>
@ -3938,99 +3938,99 @@
</url>
<url>
<loc>https://home-assistant.io/docs/autostart/init.d/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/api/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/configuration/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/example_apps/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/installation/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/operation/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/reboot/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/running/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/tutorial/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/updating/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/appdaemon/windows/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/certificates/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/hadashboard/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/hass-configurator/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/ios/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/nginx/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/notebooks/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/scenegen/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/ecosystem/synology/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/tools/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/tools/dev-tools/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/tools/hass/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/docs/tools/scripts/</loc>
<lastmod>2017-09-21T14:45:33+00:00</lastmod>
<lastmod>2017-09-23T00:52:15+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/faq/after-upgrading/</loc>
@ -5034,62 +5034,62 @@
</url>
<url>
<loc>https://home-assistant.io/demo/frontend.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/index.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-dev-event.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-dev-info.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-dev-service.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-dev-state.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-dev-template.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-history.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-iframe.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-logbook.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/demo/panels/ha-panel-map.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/googlef4f3693c209fe788.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/static/fonts/roboto/DESCRIPTION.en_us.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/static/fonts/robotomono/DESCRIPTION.en_us.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
<url>
<loc>https://home-assistant.io/static/mdi-demo.html</loc>
<lastmod>2017-09-21T14:44:50+00:00</lastmod>
<lastmod>2017-09-23T00:51:42+00:00</lastmod>
</url>
</urlset>

File diff suppressed because one or more lines are too long