Site updated at 2017-10-07 22:49:55 UTC

This commit is contained in:
Travis CI 2017-10-07 22:49:56 +00:00
parent f9a8fad682
commit 9ff55add23
128 changed files with 676 additions and 657 deletions

View file

@ -96,7 +96,7 @@
<p>Thats it. Restart your machine and Home Assistant should start automatically.</p>
<p>If HA does not start, check the log file output for errors at <code class="highlighter-rouge">/var/opt/homeassistant/home-assistant.log</code></p>
<h3><a class="title-link" name="extra-running-commands-before-hass-executes" href="#extra-running-commands-before-hass-executes"></a> Extra: Running commands before hass executes</h3>
<p>If any commands need to run before executing hass (like loading a virutal environment), put them in PRE_EXEC. This command must end with a semicolon.</p>
<p>If any commands need to run before executing hass (like loading a virtual environment), put them in PRE_EXEC. This command must end with a semicolon.</p>
<h3><a class="title-link" name="daemon-script" href="#daemon-script"></a> Daemon script</h3>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="c">#!/bin/sh</span>
<span class="c">### BEGIN INIT INFO</span>

View file

@ -96,7 +96,7 @@
<span class="c">#</span>
<span class="c"># Installation:</span>
<span class="c"># 1) If any commands need to run before executing hass (like loading a</span>
<span class="c"># virutal environment), put them in PRE_EXEC. This command must end with</span>
<span class="c"># virtual environment), put them in PRE_EXEC. This command must end with</span>
<span class="c"># a semicolon.</span>
<span class="c"># 2) Set RUN_AS to the username that should be used to execute hass.</span>
<span class="c"># 3) Copy this script to /etc/init.d/</span>

View file

@ -97,11 +97,11 @@
</tr>
<tr>
<td><code class="highlighter-rouge">old_state</code></td>
<td>The previous state of the entity before it changed. This field is ommitted if the entity is new.</td>
<td>The previous state of the entity before it changed. This field is omitted if the entity is new.</td>
</tr>
<tr>
<td><code class="highlighter-rouge">new_state</code></td>
<td>The new state of the entity. This field is ommitted if the entity is removed from the state machine.</td>
<td>The new state of the entity. This field is omitted if the entity is removed from the state machine.</td>
</tr>
</tbody>
</table>

View file

@ -85,7 +85,7 @@
</code></pre>
</div>
<p>The package configuration can include: <code class="highlighter-rouge">switch</code>, <code class="highlighter-rouge">light</code>, <code class="highlighter-rouge">automation</code>, <code class="highlighter-rouge">groups</code> or the majority of the Home Assistant components.</p>
<p>It can be specified inline or in a seperate YAML file using <code class="highlighter-rouge">!include</code>.</p>
<p>It can be specified inline or in a separate YAML file using <code class="highlighter-rouge">!include</code>.</p>
<p>Inline example, main <code class="highlighter-rouge">configuration.yaml</code>:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">homeassistant</span><span class="pi">:</span>
<span class="s">...</span>

View file

@ -89,10 +89,12 @@ The following example entry specifies that you want to use the <a href="/compone
<li>A <strong>platform</strong> makes the connection to a specific software or hardware platform (like <code class="highlighter-rouge">pushbullet</code> works with the service from pushbullet.com).</li>
</ul>
<p>The basics of YAML syntax are block collections and mappings containing key-value pairs. Each item in a collection starts with a <code class="highlighter-rouge">-</code> while mappings have the format <code class="highlighter-rouge">key: value</code>. If you specify duplicate keys, the last value for a key is used.</p>
<p>Note that indentation is an important part of specifying relationships using YAML. Things that are indented are nested “inside” things that are one level higher. So in the above example, <code class="highlighter-rouge">platform: pushbullet</code> is a property of (nested inside) the <code class="highlighter-rouge">notify</code> component.
Getting the right indentation can be tricky if youre not using an editor with a fixed width font. Tabs are not allowed to be used for indentation. Convention is to use 2 spaces for each level of indentation.
You can use <a href="http://www.yamllint.com/">YAMLLint</a> to check if your YAML-syntax is correct before loading it into Home Assistant which will save you some time.
<em>Please pay attention on not putting in private data, as it is a 3rd-party website not maintained by Home Assistant.</em></p>
<p>Note that indentation is an important part of specifying relationships using YAML. Things that are indented are nested “inside” things that are one level higher. So in the above example, <code class="highlighter-rouge">platform: pushbullet</code> is a property of (nested inside) the <code class="highlighter-rouge">notify</code> component.</p>
<p>Getting the right indentation can be tricky if youre not using an editor with a fixed width font. Tabs are not allowed to be used for indentation. Convention is to use 2 spaces for each level of indentation.</p>
<p>You can use the online service <a href="http://www.yamllint.com/">YAMLLint</a> to check if your YAML syntax is correct before loading it into Home Assistant which will save you some time. If you do so, be aware that this is a thrid-party service and is not maintained by the Home Assistant community.</p>
<p class="note">
Please pay attention on not storing private data (passwords, API keys, etc.) directly in your <code class="highlighter-rouge">configuration.yaml</code> file. Private data can be stored in a <a href="/docs/configuration/secrets/">separate file</a> or in <a href="/docs/configuration/yaml/#using-environment-variables">environmental variables</a>, which circumvents this problem of security.
</p>
<p>Text following a <strong>#</strong> are comments and are ignored by the system.</p>
<p>The next example shows an <a href="/components/input_select">input_select</a> component that uses a block collection for the options values.
The other properties (like name) are specified using mappings. Note that the second line just has <code class="highlighter-rouge">threat:</code> with no value on the same line. Here threat is the name of the input_select and the values for it are everything nested below it.</p>

View file

@ -425,7 +425,7 @@
<p>If <code class="highlighter-rouge">old</code> is supplied as a parameter, callbacks will only be made if the state of the selected attribute (usually <code class="highlighter-rouge">state</code>) in the old state match the value of <code class="highlighter-rouge">old</code>.</p>
<p>Note: <code class="highlighter-rouge">old</code> and <code class="highlighter-rouge">new</code> can be used singly or together.</p>
<h5><a class="title-link" name="duration---seconds-optional" href="#duration---seconds-optional"></a> duration = <seconds> (optional)</seconds></h5>
<p>If duration is supplied as a parameter, the callback will not fire unless the state listened for is maintained for that number of seconds. This makes the most sense if a specific attribute is specified (or the default os <code class="highlighter-rouge">state</code> is used), an in conjunction with the <code class="highlighter-rouge">old</code> or <code class="highlighter-rouge">new</code> parameters, or both. When the callback is called, it is supplied with the values of <code class="highlighter-rouge">entity</code>, <code class="highlighter-rouge">attr</code>, <code class="highlighter-rouge">old</code> and <code class="highlighter-rouge">new</code> that were current at the time the actual event occured, since the assumption is that none of them have changed in the intervening period.</p>
<p>If duration is supplied as a parameter, the callback will not fire unless the state listened for is maintained for that number of seconds. This makes the most sense if a specific attribute is specified (or the default os <code class="highlighter-rouge">state</code> is used), an in conjunction with the <code class="highlighter-rouge">old</code> or <code class="highlighter-rouge">new</code> parameters, or both. When the callback is called, it is supplied with the values of <code class="highlighter-rouge">entity</code>, <code class="highlighter-rouge">attr</code>, <code class="highlighter-rouge">old</code> and <code class="highlighter-rouge">new</code> that were current at the time the actual event occurred, since the assumption is that none of them have changed in the intervening period.</p>
<div class="language-python highlighter-rouge"><pre class="highlight"><code> <span class="k">def</span> <span class="nf">my_callback</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="o">&lt;</span><span class="n">do</span> <span class="n">some</span> <span class="n">useful</span> <span class="n">work</span> <span class="n">here</span><span class="o">&gt;</span>
</code></pre>
@ -520,7 +520,7 @@
<h5><a class="title-link" name="delay" href="#delay"></a> delay</h5>
<p>Delay, in seconds before the callback is invoked.</p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="bp">self</span><span class="o">.</span><span class="n">handle</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">run_in</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">run_in_c</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">handle</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">run_in</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">run_in_c</span><span class="p">,</span> <span class="n">title</span> <span class="o">=</span> <span class="s">"run_in5"</span><span class="p">)</span>
@ -540,7 +540,7 @@
<h5><a class="title-link" name="time" href="#time"></a> time</h5>
<p>A Python <code class="highlighter-rouge">time</code> object that specifies when the callback will occur. If the time specified is in the past, the callback will occur the next day at the specified time.</p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Run at 4pm today, or 4pm tomorrow if it is already after 4pm</span>
<span class="kn">import</span> <span class="nn">datetime</span>
@ -563,7 +563,7 @@
<h5><a class="title-link" name="datetime" href="#datetime"></a> datetime</h5>
<p>A Python <code class="highlighter-rouge">datetime</code> object that specifies when the callback will occur.</p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Run at 4pm today</span>
<span class="kn">import</span> <span class="nn">datetime</span>
@ -588,7 +588,7 @@
<h5><a class="title-link" name="time" href="#time"></a> time</h5>
<p>A Python <code class="highlighter-rouge">time</code> object that specifies when the callback will occur. If the time specified is in the past, the callback will occur the next day at the specified time.</p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Run daily at 7pm</span>
<span class="kn">import</span> <span class="nn">datetime</span>
@ -611,7 +611,7 @@
<h5><a class="title-link" name="time" href="#time"></a> time</h5>
<p>A Python <code class="highlighter-rouge">time</code> object that specifies when the callback will occur, the hour component of the time object is ignored. If the time specified is in the past, the callback will occur the next hour at the specified time. If time is not supplied, the callback will start an hour from the time that <code class="highlighter-rouge">run_hourly()</code> was executed.</p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Run every hour, on the hour</span>
<span class="kn">import</span> <span class="nn">datetime</span>
@ -634,7 +634,7 @@
<h5><a class="title-link" name="time" href="#time"></a> time</h5>
<p>A Python <code class="highlighter-rouge">time</code> object that specifies when the callback will occur, the hour and minute components of the time object are ignored. If the time specified is in the past, the callback will occur the next hour at the specified time. If time is not supplied, the callback will start a minute from the time that <code class="highlighter-rouge">run_minutely()</code> was executed.</p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Run Every Minute on the minute</span>
<span class="kn">import</span> <span class="nn">datetime</span>
@ -659,7 +659,7 @@
<h5><a class="title-link" name="repeat" href="#repeat"></a> repeat</h5>
<p>After the initial callback has occurred, another will occur every <code class="highlighter-rouge">repeat</code> seconds.</p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Run every 17 minutes starting in 2 hours time</span>
<span class="kn">import</span> <span class="nn">datetime</span>
@ -705,7 +705,7 @@
<li><code class="highlighter-rouge">random_start</code> - start of range of the random time</li>
<li><code class="highlighter-rouge">random_end</code> - end of range of the random time</li>
</ul>
<p><code class="highlighter-rouge">random_start</code> must always be numerically lower than <code class="highlighter-rouge">random_end</code>, they can be negative to denote a random offset before and event, or positive to denote a random offset after an event. The event would be a an absolute or relative time or sunrise/sunset depending on whcih scheduler call you use and these values affect the base time by the spcified amount. If not specified, they will default to <code class="highlighter-rouge">0</code>.</p>
<p><code class="highlighter-rouge">random_start</code> must always be numerically lower than <code class="highlighter-rouge">random_end</code>, they can be negative to denote a random offset before and event, or positive to denote a random offset after an event. The event would be a an absolute or relative time or sunrise/sunset depending on which scheduler call you use and these values affect the base time by the spcified amount. If not specified, they will default to <code class="highlighter-rouge">0</code>.</p>
<p>For example:</p>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Run a callback in 2 minutes minus a random number of seconds between 0 and 60, e.g. run between 60 and 120 seconds from now</span>
<span class="bp">self</span><span class="o">.</span><span class="n">handle</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">run_in</span><span class="p">(</span><span class="n">callback</span><span class="p">,</span> <span class="mi">120</span><span class="p">,</span> <span class="n">random_start</span> <span class="o">=</span> <span class="o">-</span><span class="mi">60</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
@ -731,7 +731,7 @@
<h5><a class="title-link" name="offset--seconds" href="#offset--seconds"></a> offset = <seconds></seconds></h5>
<p>The time in seconds that the callback should be delayed after sunrise. A negative value will result in the callback occurring before sunrise. This parameter cannot be combined with <code class="highlighter-rouge">random_start</code> or <code class="highlighter-rouge">random_end</code></p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">datetime</span>
<span class="o">...</span>
@ -759,7 +759,7 @@
<h5><a class="title-link" name="offset--seconds" href="#offset--seconds"></a> offset = <seconds></seconds></h5>
<p>The time in seconds that the callback should be delayed after sunrise. A negative value will result in the callback occurring before sunrise. This parameter cannot be combined with <code class="highlighter-rouge">random_start</code> or <code class="highlighter-rouge">random_end</code></p>
<h5><a class="title-link" name="kwargs" href="#kwargs"></a> **kwargs</h5>
<p>Arbitary keyword parameters to be provided to the callback function when it is invoked.</p>
<p>Arbitrary keyword parameters to be provided to the callback function when it is invoked.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="c"># Example using timedelta</span>
<span class="kn">import</span> <span class="nn">datetime</span>
@ -903,7 +903,7 @@
</code></pre>
</div>
<h3><a class="title-link" name="select_value" href="#select_value"></a> select_value()</h3>
<p>This is a convenience function for the <code class="highlighter-rouge">input_slider.select_value</code> function. It is able to set the value of an input_slider in Home Assistant.</p>
<p>This is a convenience function for the <code class="highlighter-rouge">input_number.select_value</code> function. It is able to set the value of an input_number in Home Assistant.</p>
<h4><a class="title-link" name="synopsis" href="#synopsis"></a> Synopsis</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="bp">self</span><span class="o">.</span><span class="n">select_value</span><span class="p">(</span><span class="n">entity_id</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
</code></pre>
@ -912,11 +912,11 @@
<p>None</p>
<h4><a class="title-link" name="parameters" href="#parameters"></a> Parameters</h4>
<h5><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</h5>
<p>Fully qualified entity_id of the input_slider to be changed, e.g. <code class="highlighter-rouge">input_slider.alarm_hour</code>.</p>
<p>Fully qualified entity_id of the input_number to be changed, e.g. <code class="highlighter-rouge">input_number.alarm_hour</code>.</p>
<h5><a class="title-link" name="value" href="#value"></a> value</h5>
<p>The new value to set the input slider to.</p>
<p>The new value to set the input number to.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="bp">self</span><span class="o">.</span><span class="n">select_value</span><span class="p">(</span><span class="s">"input_slider.alarm_hour"</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="bp">self</span><span class="o">.</span><span class="n">select_value</span><span class="p">(</span><span class="s">"input_number.alarm_hour"</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
</code></pre>
</div>
<h3><a class="title-link" name="select_option" href="#select_option"></a> select_option()</h3>
@ -931,7 +931,7 @@
<h5><a class="title-link" name="entity_id" href="#entity_id"></a> entity_id</h5>
<p>Fully qualified entity_id of the input_select to be changed, e.g. <code class="highlighter-rouge">input_select.mode</code>.</p>
<h5><a class="title-link" name="value" href="#value"></a> value</h5>
<p>The new value to set the input slider to.</p>
<p>The new value to set the input number to.</p>
<h4><a class="title-link" name="examples" href="#examples"></a> Examples</h4>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="bp">self</span><span class="o">.</span><span class="n">select_option</span><span class="p">(</span><span class="s">"input_select.mode"</span><span class="p">,</span> <span class="s">"Day"</span><span class="p">)</span>
</code></pre>

View file

@ -100,7 +100,7 @@ class = HelloWorld
<li><code class="highlighter-rouge">logfile</code> (optional) is the path to where you want <code class="highlighter-rouge">AppDaemon</code> to keep its main log. When run from the command line this is not used - log messages come out on the terminal. When running as a daemon this is where the log information will go. In the example above I created a directory specifically for AppDaemon to run from, although there is no reason you cant keep it in the <code class="highlighter-rouge">appdaemon</code> directory of the cloned repository. If <code class="highlighter-rouge">logfile = STDOUT</code>, output will be sent to stdout instead of stderr when running in the foreground, if not specified, output will be sent to STDOUT.</li>
<li><code class="highlighter-rouge">errorfile</code> (optional) is the name of the logfile for errors - this will usually be errors during compilation and execution of the apps. If <code class="highlighter-rouge">errorfile = STDERR</code> errors will be sent to stderr instead of a file, if not specified, output will be sent to STDERR.</li>
<li><code class="highlighter-rouge">app_dir</code> (optional) is the directory the apps are placed in. If not specified, AppDaemon will look first in <code class="highlighter-rouge">~/.homeassistant</code> then <code class="highlighter-rouge">/etc/appdaemon</code> for a subdirectory named <code class="highlighter-rouge">apps</code></li>
<li><code class="highlighter-rouge">threads</code> - the number of dedicated worker threads to create for running the apps. Note, this will bear no resembelance to the number of apps you have, the threads are re-used and only active for as long as required to tun a particular callback or initialization, leave this set to 10 unless you experience thread starvation</li>
<li><code class="highlighter-rouge">threads</code> - the number of dedicated worker threads to create for running the apps. Note, this will bear no resemblance to the number of apps you have, the threads are re-used and only active for as long as required to tun a particular callback or initialization, leave this set to 10 unless you experience thread starvation</li>
<li><code class="highlighter-rouge">latitude</code>, <code class="highlighter-rouge">longitude</code>, <code class="highlighter-rouge">elevation</code>, <code class="highlighter-rouge">timezone</code> - should all be copied from your Home Assistant configuration file</li>
<li><code class="highlighter-rouge">cert_path</code> (optional) - path to root CA cert directory - use only if you are using self signed certs.</li>
</ul>

View file

@ -87,7 +87,7 @@
<li>Durable variables and state - Variables can be kept between events to keep track of things like the number of times a motion sensor has been activated, or how long it has been since a door opened.</li>
<li>All the power of Python - use any of Pythons libraries, create your own modules, share variables, refactor and re-use code, create a single App to do everything, or multiple Apps for individual tasks - nothing is off limits!</li>
</ul>
<p>It is in fact a testament to Home Assistants open nature that a component like <code class="highlighter-rouge">AppDaemon</code> can be integrated so neatly and closely that it acts in all ways like an extension of the system, not a second class citizen. Part of the strength of Home Assistants underlying design is that it makes no assumptions whatsoever about what it is controlling, reacting to, or reporting state on. This is made achievable in part by the great flexibility of Python as a programming environment for Home Assistant, and carrying that forward has enabled me to use the same philosophy for <code class="highlighter-rouge">AppDaemon</code> - it took surprisingly little code to be able to respond to basic events and call services in a completely open ended manner. The bulk of the work after that was adding additonal functions to make things that were already possible easier.</p>
<p>It is in fact a testament to Home Assistants open nature that a component like <code class="highlighter-rouge">AppDaemon</code> can be integrated so neatly and closely that it acts in all ways like an extension of the system, not a second class citizen. Part of the strength of Home Assistants underlying design is that it makes no assumptions whatsoever about what it is controlling, reacting to, or reporting state on. This is made achievable in part by the great flexibility of Python as a programming environment for Home Assistant, and carrying that forward has enabled me to use the same philosophy for <code class="highlighter-rouge">AppDaemon</code> - it took surprisingly little code to be able to respond to basic events and call services in a completely open ended manner. The bulk of the work after that was adding additional functions to make things that were already possible easier.</p>
<h1>How it Works</h1>
<p>The best way to show what AppDaemon does is through a few simple examples.</p>
<h2>Sunrise/Sunset Lighting</h2>

View file

@ -97,7 +97,7 @@
<li>Durable variables and state - variables can be kept between events to keep track of things like the number of times a motion sensor has been activated, or how long it has been since a door opened</li>
<li>All the power of Python - use any of Pythons libraries, create your own modules, share variables, refactor and re-use code, create a single app to do everything, or multiple apps for individual tasks - nothing is off limits!</li>
</ul>
<p>It is in fact a testament to Home Assistants open nature that a component like <code class="highlighter-rouge">AppDaemon</code> can be integrated so neatly and closely that it acts in all ways like an extension of the system, not a second class citizen. Part of the strength of Home Assistants underlying design is that it makes no assumptions whatever about what it is controlling or reacting to, or reporting state on. This is made achievable in part by the great flexibility of Python as a programming environment for Home Assistant, and carrying that forward has enabled me to use the same philosophy for <code class="highlighter-rouge">AppDaemon</code> - it took surprisingly little code to be able to respond to basic events and call services in a completely open ended manner - the bulk of the work after that was adding additonal functions to make things that were already possible easier.</p>
<p>It is in fact a testament to Home Assistants open nature that a component like <code class="highlighter-rouge">AppDaemon</code> can be integrated so neatly and closely that it acts in all ways like an extension of the system, not a second class citizen. Part of the strength of Home Assistants underlying design is that it makes no assumptions whatever about what it is controlling or reacting to, or reporting state on. This is made achievable in part by the great flexibility of Python as a programming environment for Home Assistant, and carrying that forward has enabled me to use the same philosophy for <code class="highlighter-rouge">AppDaemon</code> - it took surprisingly little code to be able to respond to basic events and call services in a completely open ended manner - the bulk of the work after that was adding additional functions to make things that were already possible easier.</p>
<h2><a class="title-link" name="how-it-works" href="#how-it-works"></a> How it Works</h2>
<p>The best way to show what AppDaemon does is through a few simple examples.</p>
<h3><a class="title-link" name="sunrisesunset-lighting" href="#sunrisesunset-lighting"></a> Sunrise/Sunset Lighting</h3>

View file

@ -82,7 +82,7 @@
</ul>
<p>AppDaemon can be installed exactly as per the instructions for every other version using pip3.</p>
<h2><a class="title-link" name="windows-under-the-linux-subsystem" href="#windows-under-the-linux-subsystem"></a> Windows Under the Linux Subsystem</h2>
<p>Windows 10 now supports a full Linux bash environment that is capable of running Python. This is essentially an Ubuntu distribution and works extremely well. It is possible to run AppDaemon in exactly the same way as for Linux distributions, and none of the above Windows Caveats apply to this version. This is the reccomended way to run AppDaemon in a Windows 10 and later environment.</p>
<p>Windows 10 now supports a full Linux bash environment that is capable of running Python. This is essentially an Ubuntu distribution and works extremely well. It is possible to run AppDaemon in exactly the same way as for Linux distributions, and none of the above Windows Caveats apply to this version. This is the recommended way to run AppDaemon in a Windows 10 and later environment.</p>
</article>
</div>
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">

View file

@ -80,7 +80,7 @@
<p>You need two parts in order to get it working correctly.</p>
<p>Become the user that run Home Assistant.</p>
<ul>
<li>A seperate Python script that syncs a specific folder. Which can be found <a href="https://gist.github.com/riemers/31e3350041fd3e47e489cbc811209d6f">here</a></li>
<li>A separate Python script that syncs a specific folder. Which can be found <a href="https://gist.github.com/riemers/31e3350041fd3e47e489cbc811209d6f">here</a></li>
<li>The excellent <a href="https://github.com/andreafabrizi/Dropbox-Uploader/blob/master/dropbox_uploader.sh">dropbox uploader script</a> you can grab the .sh file only.</li>
</ul>
<p>Download those files to a folder of your liking, after that edit both files and change paths accordingly.</p>
@ -99,7 +99,7 @@
<p>The first time can take a lot of time since it will upload all your files!
Do note, this will <strong>backup your passwords to Dropbox</strong>.</p>
<h3><a class="title-link" name="automate-the-backup" href="#automate-the-backup"></a> Automate the backup</h3>
<p>So you just made a full backup, next time you want it to be done automaticly. Since your database can change and so do other files over time.
<p>So you just made a full backup, next time you want it to be done automatically. Since your database can change and so do other files over time.
Add it to your crontab, edit the <strong>path/to</strong> part.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span><span class="o">(</span>crontab -l 2&gt;/dev/null; <span class="nb">echo</span> <span class="s2">"0 3 * * * python /path/to/dropbox.py"</span><span class="o">)</span> | crontab -
</code></pre>

View file

@ -92,7 +92,7 @@ This will not create a full backup of your Home Assistant files or your OS. In a
<ul>
<li>Extensive use of <a href="https://home-assistant.io/topics/secrets/">secrets.yaml</a> to hide sensitive information like usernames, passwords, device information, and location</li>
<li>Exclusion of some files, including <code class="highlighter-rouge">secrets.yaml</code> and device-specific information using a <a href="https://git-scm.com/docs/gitignore"><code class="highlighter-rouge">.gitignore</code></a> file</li>
<li>Regularly commiting your configuration to GitHub to make sure that your backup is up to date</li>
<li>Regularly committing your configuration to GitHub to make sure that your backup is up to date</li>
<li>Use a README.md to document your configuration and include screenshots of your Home Assistant GUI</li>
</ul>
<h3><a class="title-link" name="step-1-installing-and-initializing-git" href="#step-1-installing-and-initializing-git"></a> Step 1: Installing and Initializing Git</h3>
@ -164,7 +164,7 @@ git push origin master
<span class="nb">exit</span>
</code></pre>
</div>
<p>Every time you run this script, you will be prompted for a comment to describe the change(s) that you are commiting. This comment will be displayed beside each changed file on GitHub and will be stored after each commit. You will also be asked to enter your GitHub username and password (or ssh key passphrase if you use <a href="https://help.github.com/categories/ssh/">GitHub with ssh</a>).</p>
<p>Every time you run this script, you will be prompted for a comment to describe the change(s) that you are committing. This comment will be displayed beside each changed file on GitHub and will be stored after each commit. You will also be asked to enter your GitHub username and password (or ssh key passphrase if you use <a href="https://help.github.com/categories/ssh/">GitHub with ssh</a>).</p>
<h3><a class="title-link" name="step-7-configuration-file-testing" href="#step-7-configuration-file-testing"></a> Step 7: Configuration file testing</h3>
<p><a href="https://travis-ci.org">Travis CI</a> is a continuous integration testing system that runs every time the code in your repository is updated and allows you to validate that your code works on a fresh install.</p>
<ul>
@ -193,7 +193,7 @@ git push origin master
</code></pre>
</div>
<h3><a class="title-link" name="extra-commands" href="#extra-commands"></a> Extra commands</h3>
<p>You can enter these commands to get a list of the files in your local git repository and a status of files that have changed but not commited yet:</p>
<p>You can enter these commands to get a list of the files in your local git repository and a status of files that have changed but not committed yet:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>git ls-files
<span class="gp">$ </span>git status
</code></pre>

View file

@ -146,7 +146,7 @@ Change below path to where you placed the <code class="highlighter-rouge">usb_ba
</code></pre>
</div>
<h3><a class="title-link" name="auto-mount" href="#auto-mount"></a> Auto mount</h3>
<p>This does not automaticly mount your USB drive at boot. You need to do that manually or add a line to your <code class="highlighter-rouge">/etc/fstab</code> file.</p>
<p>This does not automatically mount your USB drive at boot. You need to do that manually or add a line to your <code class="highlighter-rouge">/etc/fstab</code> file.</p>
<p>If your drive is on <code class="highlighter-rouge">/dev/sda1</code>, you could add a entry to your <code class="highlighter-rouge">/etc/fstab</code> like so:</p>
<div class="language-text highlighter-rouge"><pre class="highlight"><code>/dev/sda1 /media ext4 defaults,noatime 0 1
</code></pre>

View file

@ -88,7 +88,7 @@ Before exposing your Home Assistant instance to the outside world it is ESSENTIA
<li>You are not currently running anything on port 80 on your network (youd know if you were).</li>
<li>If you are not using Home Assistant on a Debian/Raspian/Hassbian system you will be able to convert any of the terminology I use in to the correct syntax for your system.</li>
<li>You understand that this is a guide covering the general application of these things to the general masses and there are things outside of the scope of it, and it does not cover every eventuality (although I have made some notes where people may stumble). Also, I have used some turns of phrase to make it easier to understand for the novice reader which people of advanced knowledge may say is innacurate. My goal here is to get you through this guide with a satisfactory outcome and have a decent understanding of what you are doing and why, not to teach you advanced internet communication protocols.</li>
<li>Each step presumes you have fully completed the previous step succesfully, so if you did an earlier step following a different guide, please ensure that you have not missed anything out that may affect the step you have jumped to, and ensure that you adapt any commands to take in to account different file placements from other guides.</li>
<li>Each step presumes you have fully completed the previous step successfully, so if you did an earlier step following a different guide, please ensure that you have not missed anything out that may affect the step you have jumped to, and ensure that you adapt any commands to take in to account different file placements from other guides.</li>
</ul>
<p>Steps we will take:</p>
<ul>
@ -315,9 +315,9 @@ Protocol - Both
<div class="language-text highlighter-rouge"><pre class="highlight"><code>https://home-assistant.io/docs/frontend/mobile/
</code></pre>
</div>
<p>All done? Accessing your Home Assistant from across the world with your DuckDNS URL and a lovely secure logo on your browser? Ace! Now lets clean up our port forwards so that we are only exposing the parts of our network that are absolutely neccesary to the outside world.</p>
<p>All done? Accessing your Home Assistant from across the world with your DuckDNS URL and a lovely secure logo on your browser? Ace! Now lets clean up our port forwards so that we are only exposing the parts of our network that are absolutely necessary to the outside world.</p>
<h3><a class="title-link" name="6---clean-up-port-forwards" href="#6---clean-up-port-forwards"></a> 6 - Clean up port forwards</h3>
<p>In step 2 we created a port forwarding rule called <code class="highlighter-rouge">ha_test</code>. This opens port 8123 to the world, and is no longer neccessary.</p>
<p>In step 2 we created a port forwarding rule called <code class="highlighter-rouge">ha_test</code>. This opens port 8123 to the world, and is no longer necessary.</p>
<p>Go to your routers configuration pages and delete the <code class="highlighter-rouge">ha_test</code> rule.</p>
<p>You should now have two rules in relation to Home Assistant for your port forwards, named:</p>
<p><code class="highlighter-rouge">ha_ssl</code> and <code class="highlighter-rouge">ha_letsencrypt</code></p>
@ -345,7 +345,7 @@ Protocol - Both
</code></pre>
</div>
<p class="note">
In cases where, for whatever reason, apt-get installing is not appropriate for your installation you can fetch the ssl-cert-check script from <code class="highlighter-rouge">http://prefetch.net/code/ssl-cert-check</code> bearing in mind that you will have to modify the command in the sensor code below to run the script from wherever you put it, modify permission if neccessary and so on.
In cases where, for whatever reason, apt-get installing is not appropriate for your installation you can fetch the ssl-cert-check script from <code class="highlighter-rouge">http://prefetch.net/code/ssl-cert-check</code> bearing in mind that you will have to modify the command in the sensor code below to run the script from wherever you put it, modify permission if necessary and so on.
</p>
<p>To set up a senor add the following to your <code class="highlighter-rouge">configuration.yaml</code> (remembering to correct the URL for your DuckDNS):</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">sensor</span><span class="pi">:</span>
@ -365,7 +365,7 @@ In cases where, for whatever reason, apt-get installing is not appropriate for y
<p>If you are a TWO-RULE person (from step 6), you can automatically renew your certificate using a <code class="highlighter-rouge">http-01</code> challenge and port 80.</p>
<p>There are a number of options for automating the renewal process:</p>
<h4>Option 1:</h4>
<p>Your certificate can be renewed as a cron job - cron jobs are background tasks run by the computer at specified intervals (and are totally independant of Home Assistant). Defining cron is outside of the scope of this guide but you will have had dealings with <code class="highlighter-rouge">crontab</code> when setting up DuckDNS in step 3</p>
<p>Your certificate can be renewed as a cron job - cron jobs are background tasks run by the computer at specified intervals (and are totally independent of Home Assistant). Defining cron is outside of the scope of this guide but you will have had dealings with <code class="highlighter-rouge">crontab</code> when setting up DuckDNS in step 3</p>
<p>To set a cron job to run the script at regular intervals:</p>
<ul>
<li>SSH in to your device running Home Assistant.</li>

View file

@ -105,7 +105,7 @@ Consider running the configurator as a user with limited privileges to limit pos
</ul>
<h3><a class="title-link" name="configuration" href="#configuration"></a> Configuration</h3>
<p>Near the top of the configurator.py-file you will find some global variables you can change to customize the configurator. If you are unfamiliar with Python: when setting variables of the type <em>string</em>, you have to write that within quotation marks. The default settings are fine for just checking out the configurator quickly. With more customized setups you should change some settings though.<br />
To keep your settings across updates it is also possible to save settings in an external file. In that case copy <a href="https://github.com/danielperna84/hass-configurator/blob/master/settings.conf">settings.conf</a> whereever you like and append the full path to the file to the command when starting the configurator. E.g. <code class="highlighter-rouge">sudo .configurator.py /home/homeassistant/.homeassistant/mysettings.conf</code>. This file is in JSON format. So make sure it has a valid syntax (you can set the editor to JSON to get syntax highlighting for the settings). The major difference to the settings in the py-file is, that <code class="highlighter-rouge">None</code> becomes <code class="highlighter-rouge">null</code>.</p>
To keep your settings across updates it is also possible to save settings in an external file. In that case copy <a href="https://github.com/danielperna84/hass-configurator/blob/master/settings.conf">settings.conf</a> wherever you like and append the full path to the file to the command when starting the configurator. E.g. <code class="highlighter-rouge">sudo .configurator.py /home/homeassistant/.homeassistant/mysettings.conf</code>. This file is in JSON format. So make sure it has a valid syntax (you can set the editor to JSON to get syntax highlighting for the settings). The major difference to the settings in the py-file is, that <code class="highlighter-rouge">None</code> becomes <code class="highlighter-rouge">null</code>.</p>
<h4>LISTENIP (string)</h4>
<p>The IP the service is listening on. By default it is binding to <code class="highlighter-rouge">0.0.0.0</code>, which is every interface on the system.</p>
<h4>LISTENPORT (integer)</h4>

View file

@ -76,7 +76,7 @@
</header>
<hr class="divider">
<h2><a class="title-link" name="location-tracking-when-outside-a-home-assistant-zone" href="#location-tracking-when-outside-a-home-assistant-zone"></a> Location tracking when outside a Home Assistant zone</h2>
<p>Home Assistant for iOS receives <em>significant location updates</em> from iOS. Whenever an update is received, it is sent to Home Assistant. Roughly, an update is received everytime that your device transfers to a new cellular tower, a significant amount of time has passed (usually a couple hours) or a connection state changes and the system notices your location recently changed.</p>
<p>Home Assistant for iOS receives <em>significant location updates</em> from iOS. Whenever an update is received, it is sent to Home Assistant. Roughly, an update is received every time that your device transfers to a new cellular tower, a significant amount of time has passed (usually a couple hours) or a connection state changes and the system notices your location recently changed.</p>
<p>Apple <a href="https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW9">defines</a> significant significant-change location updates as:</p>
<blockquote>
<p>The significant-change location service delivers updates only when there has been a significant change in the devices location, such as 500 meters or more.</p>

View file

@ -139,7 +139,7 @@ entities:
</div>
<p>This output can be cut and pasted into your configuration.yaml file as required (ensuring correct indentatation of course).</p>
<p>Scenegen supports all documented effects for lights including transitions and flash effects, however generally it is easier to run scenegen to get the basic setup and add any effects manually later.</p>
<p>Note that depending on the type of light there may be a delay in actually setting up its parameters and Home Assistant actually recieving that state. For instance, if you set a scene up with the Hue App, Home Assistant wont see those changes for up to 10 seconds. Turning on a ZWave light might not be seen for an entire poll interval. For this reason, its good practice to wait for a while after the scene is setup before running scenegen. Alternatively, perform all setup using the Home Assistant frontend and it will instantly have the required state for capture.</p>
<p>Note that depending on the type of light there may be a delay in actually setting up its parameters and Home Assistant actually receiving that state. For instance, if you set a scene up with the Hue App, Home Assistant wont see those changes for up to 10 seconds. Turning on a ZWave light might not be seen for an entire poll interval. For this reason, its good practice to wait for a while after the scene is setup before running scenegen. Alternatively, perform all setup using the Home Assistant frontend and it will instantly have the required state for capture.</p>
<h2><a class="title-link" name="advanced-usage" href="#advanced-usage"></a> Advanced Usage</h2>
<p>For a more advanced way to use the output try the following. In configuration.yaml add the following line:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>scene: !include_dir_list scenes

View file

@ -117,7 +117,7 @@ Note that as of 2016-11-30 SSH is disabled by default in the official Raspbian i
<ul>
<li>Login to Raspberry Pi <code class="highlighter-rouge">ssh pi@your_raspberry_pi_ip</code></li>
<li>Change to homeassistant user <code class="highlighter-rouge">sudo su -s /bin/bash homeassistant</code></li>
<li>Change to virtual enviroment <code class="highlighter-rouge">source /srv/homeassistant/homeassistant_venv/bin/activate</code></li>
<li>Change to virtual environment <code class="highlighter-rouge">source /srv/homeassistant/homeassistant_venv/bin/activate</code></li>
<li>Update Home Assistant <code class="highlighter-rouge">pip3 install --upgrade homeassistant</code></li>
<li>Type <code class="highlighter-rouge">exit</code> to logout the hass user and return to the <code class="highlighter-rouge">pi</code> user.</li>
</ul>
@ -126,7 +126,7 @@ Note that as of 2016-11-30 SSH is disabled by default in the official Raspbian i
<ul>
<li>Login to Raspberry Pi <code class="highlighter-rouge">ssh pi@your_raspberry_pi_ip</code></li>
<li>Change to homeassistant user <code class="highlighter-rouge">sudo su -s /bin/bash hass</code></li>
<li>Change to virtual enviroment <code class="highlighter-rouge">source /srv/hass/hass_venv/bin/activate</code></li>
<li>Change to virtual environment <code class="highlighter-rouge">source /srv/hass/hass_venv/bin/activate</code></li>
<li>Update Home Assistant <code class="highlighter-rouge">pip3 install --upgrade homeassistant</code></li>
<li>Type <code class="highlighter-rouge">exit</code> to logout the hass user and return to the <code class="highlighter-rouge">pi</code> user.</li>
</ul>

View file

@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Manual installation on a Raspberry Pi - Home Assistant</title>
<meta name="author" content="Home Assistant">
<meta name="description" content="Instructions to install Home Assistant on a Raspberry Pi runnning Raspbian Lite.">
<meta name="description" content="Instructions to install Home Assistant on a Raspberry Pi running Raspbian Lite.">
<meta name="viewport" content="width=device-width">
<link rel="canonical" href="https://home-assistant.io/docs/installation/raspberry-pi/">
<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/docs/installation/raspberry-pi/">
<meta property="og:type" content="article">
<meta property="og:description" content="Instructions to install Home Assistant on a Raspberry Pi runnning Raspbian Lite.">
<meta property="og:description" content="Instructions to install Home Assistant on a Raspberry Pi running Raspbian Lite.">
<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="Manual installation on a Raspberry Pi">
<meta name="twitter:description" content="Instructions to install Home Assistant on a Raspberry Pi runnning Raspbian Lite.">
<meta name="twitter:description" content="Instructions to install Home Assistant on a Raspberry Pi running Raspbian Lite.">
<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">

View file

@ -121,9 +121,9 @@
<span class="s">minutes</span><span class="pi">:</span> <span class="s">1</span>
</code></pre>
</div>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Waits however many minutes input_slider.minute_delay is set to</span>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="c1"># Waits however many minutes input_number.minute_delay is set to</span>
<span class="c1"># Valid formats include HH:MM and HH:MM:SS</span>
<span class="s">delay</span><span class="pi">:</span> <span class="s1">'</span><span class="s">00:{{</span><span class="nv"> </span><span class="s">states.input_slider.minute_delay.state</span><span class="nv"> </span><span class="s">|</span><span class="nv"> </span><span class="s">int</span><span class="nv"> </span><span class="s">}}:00'</span>
<span class="s">delay</span><span class="pi">:</span> <span class="s1">'</span><span class="s">00:{{</span><span class="nv"> </span><span class="s">states.input_number.minute_delay.state</span><span class="nv"> </span><span class="s">|</span><span class="nv"> </span><span class="s">int</span><span class="nv"> </span><span class="s">}}:00'</span>
</code></pre>
</div>
<h3><a class="title-link" name="wait" href="#wait"></a> Wait</h3>

View file

@ -81,7 +81,7 @@
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>hass --script check_config
</code></pre>
</div>
<h3><a class="title-link" name="existance-of-configuration" href="#existance-of-configuration"></a> Existance of configuration</h3>
<h3><a class="title-link" name="existence-of-configuration" href="#existence-of-configuration"></a> Existence of configuration</h3>
<p>This script checks if the <code class="highlighter-rouge">configuration.yaml</code> file exists. If the file is not available, one is created.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>hass --script ensure_config
</code></pre>
@ -98,7 +98,7 @@
</code></pre>
</div>
<h3><a class="title-link" name="old-scripts" href="#old-scripts"></a> Old scripts</h3>
<p>Usally those scripts were only used when a massive update happend and was announced in the release notes.</p>
<p>Usually those scripts were only used when a massive update happened and was announced in the release notes.</p>
<ul>
<li><code class="highlighter-rouge">db_migrator</code>: Migrate an existing SQLite database to the new schema.</li>
<li><code class="highlighter-rouge">influxdb_migrator</code>: Convert an old InfluxDB to the new format.</li>