Site updated at 2017-08-26 06:14:00 UTC

This commit is contained in:
Travis CI 2017-08-26 06:14:00 +00:00
parent 0408a5478d
commit bf5e0c0bc2
733 changed files with 8077 additions and 1976 deletions

View file

@ -78,7 +78,7 @@
<p>We are defining a <a href="/docs/automation/trigger/">trigger</a> to track the sunset and tell it to fire when the sun is setting. When this event is triggered, the service <code class="highlighter-rouge">light.turn_on</code> is called without any parameters. Because we specify no parameters, it will turn on all the lights.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">automation</span><span class="pi">:</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on light when sun sets</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on the lights when the sun sets</span>
<span class="s">initial_state</span><span class="pi">:</span> <span class="s">True</span>
<span class="s">hide_entity</span><span class="pi">:</span> <span class="s">False</span>
<span class="s">trigger</span><span class="pi">:</span>
@ -88,11 +88,11 @@
<span class="s">service</span><span class="pi">:</span> <span class="s">light.turn_on</span>
</code></pre>
</div>
<p>Starting with 0.28 automation rules can be reloaded from the <a href="/components/automation/">frontend</a> and are shown by default. With <a href="/components/automation/"><code class="highlighter-rouge">hide_entity:</code></a> you can control this behaviour. Its very handy if you are working on your rules but when a rule is finished and you dont want to see that rule in your frontend, you can set <code class="highlighter-rouge">hide_entity:</code> to <code class="highlighter-rouge">True</code>. To set an automation to be disabled when Home Assistant starts set <code class="highlighter-rouge">initial_state:</code> to <code class="highlighter-rouge">False</code>.</p>
<p>After a few days of running this automation rule, you come to realize that this automation rule is not good enough. It was already dark when the lights went on and the one day you werent home, the lights turned on anyway. Time for some tweaking. Lets add an offset to the sunset trigger and a <a href="/docs/automation/condition/">condition</a> to only turn on the lights if anyone is home.</p>
<p>Starting with 0.28 automation rules can be reloaded from the <a href="/components/automation/">frontend</a> and are shown by default. With <a href="/components/automation/"><code class="highlighter-rouge">hide_entity:</code></a> you can control this behavior. Its convenient if you are working on your rules, but when a rule is finished, and you dont want to see that rule in your frontend, you can set <code class="highlighter-rouge">hide_entity:</code> to <code class="highlighter-rouge">True</code>. To set an automation to be disabled when Home Assistant starts set <code class="highlighter-rouge">initial_state:</code> to <code class="highlighter-rouge">False</code>.</p>
<p>After a few days of running this automation rule, you come to realize that this automation rule is not sufficient. It was already dark when the lights went on, and the one day you werent home, the lights turned on anyway. Time for some tweaking. Lets add an offset to the sunset trigger and a <a href="/docs/automation/condition/">condition</a> to only turn on the lights if anyone is home.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">automation</span><span class="pi">:</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on light when sun sets</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on the lights when the sun sets</span>
<span class="s">trigger</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>
@ -105,8 +105,8 @@
<span class="s">service</span><span class="pi">:</span> <span class="s">light.turn_on</span>
</code></pre>
</div>
<p>Now youre happy and all is good. You start to like this automation business and buy some more lights, this time you put them in the bedroom. But what you now realize is that when the sun is setting, the lights in the bedroom are also being turned on! Time to tweak the automation to only turn on the living room lights.</p>
<p>The first thing you do is to look at the entities in the developer tools (second icon) in the app. You see the names of your lights and you write them down: <code class="highlighter-rouge">light.table_lamp</code>, <code class="highlighter-rouge">light.bedroom</code>, <code class="highlighter-rouge">light.ceiling</code>.</p>
<p>Now youre happy, and all is good. You start to like this automation business and buy some more lights, this time you put them in the bedroom. But what you now realize is that when the sun is setting, the lights in the bedroom are also being turned on! Time to tweak the automation to only turn on the living room lights.</p>
<p>The first thing you do is to look at the entities in the developer tools (second icon) in the app. You see the names of your lights, and you write them down: <code class="highlighter-rouge">light.table_lamp</code>, <code class="highlighter-rouge">light.bedroom</code>, <code class="highlighter-rouge">light.ceiling</code>.</p>
<p>Instead of hard coding the entity IDs of the lights in the automation rule, we will set up a group. This will allow us to see the living room separate in the app and be able to address it from automation rules.</p>
<p>So we tweak the config to add the group and have the automation rule only turn on the group.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
@ -116,7 +116,7 @@
<span class="pi">-</span> <span class="s">light.ceiling</span>
<span class="s">automation</span><span class="pi">:</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on light when sun sets</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on the light when the sun sets</span>
<span class="s">trigger</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>
@ -130,8 +130,8 @@
<span class="s">entity_id</span><span class="pi">:</span> <span class="s">group.living_room</span>
</code></pre>
</div>
<p>Christmas is coming along and you decide to buy a remote switch to control the Christmas lights from Home Assistant. You cant claim to live in the house of the future if youre still manually turning on your Christmas lights!</p>
<p>We hook the switch up to Home Assistant and grab the entity ID from the developer tools: <code class="highlighter-rouge">switch.christmas_lights</code>. We will update the group to include the switch and will change our <a href="/docs/automation/action/">action</a>. We are no longer able to call <code class="highlighter-rouge">light.turn_on</code> because we also want to turn on a switch. This is where <code class="highlighter-rouge">homeassistant.turn_on</code> comes to the rescue. This service is capable of turning any entity on.</p>
<p>Christmas is coming along, and you decide to buy a remote switch to control the Christmas lights from Home Assistant. You cant claim to live in the house of the future if youre still manually turning on your Christmas lights!</p>
<p>We hook the switch up to Home Assistant and grab the entity ID from the developer tools: <code class="highlighter-rouge">switch.christmas_lights</code>. We will update the group to include the switch and will change our <a href="/docs/automation/action/">action</a>. We are no longer able to call <code class="highlighter-rouge">light.turn_on</code> because we also want to turn on a switch. This is where <code class="highlighter-rouge">homeassistant.turn_on</code> comes to the rescue. This service is capable of turning on any entity.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Example configuration.yaml entry</span>
<span class="s">group</span><span class="pi">:</span>
<span class="s">living_room</span><span class="pi">:</span>
@ -140,7 +140,7 @@
<span class="pi">-</span> <span class="s">switch.christmas_lights</span>
<span class="s">automation</span><span class="pi">:</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on light when sun sets</span>
<span class="s">alias</span><span class="pi">:</span> <span class="s">Turn on the lights when the sun sets</span>
<span class="s">hide_entity</span><span class="pi">:</span> <span class="s">True</span>
<span class="s">trigger</span><span class="pi">:</span>
<span class="s">platform</span><span class="pi">:</span> <span class="s">sun</span>