Site updated at 2014-12-22 04:17:16 UTC

This commit is contained in:
Paulus Schoutsen 2014-12-21 20:17:16 -08:00
parent e30ce415e1
commit 65078b86a0
16 changed files with 214 additions and 101 deletions

View file

@ -104,8 +104,9 @@ You can append <code>?api_password=YOUR_PASSWORD</code> to any url to log in aut
<p>The api supports the following actions:</p>
<p><strong>/api - GET</strong><br>
Returns message if API is up and running.</p>
<h4>GET /api</h4>
<p>Returns message if API is up and running.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -116,8 +117,9 @@ Returns message if API is up and running.</p>
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/events - GET</strong><br>
Returns an array of event objects. Each event object contain event name and listener count.</p>
<h4>GET /api/events</h4>
<p>Returns an array of event objects. Each event object contain event name and listener count.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -142,8 +144,9 @@ Returns an array of event objects. Each event object contain event name and list
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/services - GET</strong><br>
Returns an array of service objects. Each object contains the domain and which services it contains.</p>
<h4>GET /api/services</h4>
<p>Returns an array of service objects. Each object contains the domain and which services it contains.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -178,8 +181,9 @@ Returns an array of service objects. Each object contains the domain and which s
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/states - GET</strong><br>
Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes.</p>
<h4>GET /api/states</h4>
<p>Returns an array of state objects. Each state has the following attributes: entity_id, state, last_changed and attributes.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -218,8 +222,9 @@ Returns an array of state objects. Each state has the following attributes: enti
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/states/&lt;entity_id></strong> - GET<br>
Returns a state object for specified entity_id. Returns 404 if not found.</p>
<h4>GET /api/states/&lt;entity_id></h4>
<p>Returns a state object for specified entity_id. Returns 404 if not found.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -242,13 +247,26 @@ Returns a state object for specified entity_id. Returns 404 if not found.</p>
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/states/&lt;entity_id></strong> - POST<br>
Updates or creates the current state of an entity.</p>
<h4>POST /api/states/&lt;entity_id></h4>
<p>Return code is 200 if the entity existed, 201 if the state of a new entity was set. A location header will be returned with the url of the new resource. The response body will contain a JSON encoded State object.<br>
<br>
parameter: state - string<br>
optional parameter: attributes - JSON object</p>
<p>Updates or creates the current state of an entity.</p>
<p>Expects a JSON object that has atleast a state attribute:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="nt">&quot;state&quot;</span><span class="p">:</span> <span class="s2">&quot;below_horizon&quot;</span><span class="p">,</span>
</span><span class='line'> <span class="nt">&quot;next_rising&quot;</span><span class="p">:</span> <span class="s2">&quot;07:04:15 29-10-2013&quot;</span><span class="p">,</span>
</span><span class='line'> <span class="nt">&quot;next_setting&quot;</span><span class="p">:</span> <span class="s2">&quot;18:00:31 29-10-2013&quot;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>Return code is 200 if the entity existed, 201 if the state of a new entity was set. A location header will be returned with the url of the new resource. The response body will contain a JSON encoded State object.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -271,9 +289,22 @@ optional parameter: attributes - JSON object</p>
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/events/&lt;event_type></strong> - POST<br>
Fires an event with event_type<br>
optional body: JSON encoded object that represents event_data</p>
<h4>POST /api/events/&lt;event_type></h4>
<p>Fires an event with event_type</p>
<p>You can pass an optional JSON object to be used as <code>event_data</code>.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="nt">&quot;next_rising&quot;</span><span class="p">:</span> <span class="s2">&quot;18:00:31 29-10-2013&quot;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>Returns a message if successful.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -284,11 +315,22 @@ optional body: JSON encoded object that represents event_data</p>
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/services/&lt;domain>/&lt;service></strong> - POST<br>
Calls a service within a specific domain. Will return when the service has been executed or 10 seconds has past, whichever comes first.<br>
optional body: JSON encoded object that represents service_data</p>
<h4>POST /api/services/&lt;domain>/&lt;service></h4>
<p>Returns a list of states that have changed since the start of this service call.</p>
<p>Calls a service within a specific domain. Will return when the service has been executed or 10 seconds has past, whichever comes first.</p>
<p>You can pass an optional JSON object to be used as <code>service_data</code>.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="nt">&quot;entity_id&quot;</span><span class="p">:</span> <span class="s2">&quot;light.Ceiling&quot;</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>Returns a list of states that have changed while the service was being executed.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -327,11 +369,33 @@ optional body: JSON encoded object that represents service_data</p>
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/event_forwarding</strong> - POST<br>
Setup event forwarding to another Home Assistant instance.<br>
parameter: host - string<br>
parameter: api_password - string<br>
optional parameter: port - int<br></p>
<div class='note'><p class='title'>Note</p><p class='content'>
The result will include any changed states that changed while the service was being executed, even if their change was the result of something else happening in the system.
</p></div>
<h4>POST /api/event_forwarding</h4>
<p>Setup event forwarding to another Home Assistant instance.</p>
<p>Requires a JSON object that represents the API to forward to.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="nt">&quot;host&quot;</span><span class="p">:</span> <span class="s2">&quot;machine&quot;</span><span class="p">,</span>
</span><span class='line'> <span class="nt">&quot;api_password&quot;</span><span class="p">:</span> <span class="s2">&quot;my_super_secret_password&quot;</span><span class="p">,</span>
</span><span class='line'> <span class="nt">&quot;port&quot;</span><span class="p">:</span> <span class="mi">8880</span> <span class="err">//</span> <span class="err">optional</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>It will return a message if event forwarding was setup successful.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -342,12 +406,26 @@ optional parameter: port - int<br></p>
</span></code></pre></td></tr></table></div></figure>
<p><strong>/api/event_forwarding</strong> - DELETE<br>
Cancel event forwarding to another Home Assistant instance.<br>
parameter: host - string<br>
optional parameter: port - int<br></p>
<h4>DELETE /api/event_forwarding</h4>
<p>If your client does not support DELETE HTTP requests you can add an optional attribute _METHOD and set its value to DELETE.</p>
<p>Cancel event forwarding to another Home Assistant instance.<br></p>
<p>Requires a JSON object that represents the API to cancel forwarding to.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class='json'><span class='line'><span class="p">{</span>
</span><span class='line'> <span class="nt">&quot;host&quot;</span><span class="p">:</span> <span class="s2">&quot;machine&quot;</span><span class="p">,</span>
</span><span class='line'> <span class="nt">&quot;api_password&quot;</span><span class="p">:</span> <span class="s2">&quot;my_super_secret_password&quot;</span><span class="p">,</span>
</span><span class='line'> <span class="nt">&quot;port&quot;</span><span class="p">:</span> <span class="mi">8880</span> <span class="err">//</span> <span class="err">optional</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>
<p>It will return a message if event forwarding was cancelled successful.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@ -359,6 +437,13 @@ optional parameter: port - int<br></p>
<div class='note'><p class='title'>Note</p><p class='content'>
If your client does not support <code>DELETE</code> HTTP requests you can add an optional attribute <code>_METHOD</code> and set its value to <code>DELETE</code>.
</p></div>
</article>
@ -373,7 +458,7 @@ optional parameter: port - int<br></p>
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -96,12 +96,20 @@
<pre><code>In the event that device 'Paulus Nexus 5' changes to the 'Home' state:
If the sun has set and the lights are not on:
Turn on the lights
</code></pre>
In the event that the combined state of all tracked devices changes to 'Not Home':
<!-- comment to seperate markdown blockquotes -->
<pre><code>In the event that the combined state of all tracked devices changes to 'Not Home':
If the lights are on:
Turn off the lights
</code></pre>
In the event of the sun setting:
<!-- comment to seperate markdown blockquotes -->
<pre><code>In the event of the sun setting:
If the lights are off and the combined state of all tracked device equals 'Home':
Turn on the lights
</code></pre>
@ -112,8 +120,6 @@ In the event of the sun setting:
<p>Home Assistant supports running multiple synchronzied instances using a master-slave model. Slaves forward all local events fired and states set to the master instance which will then replicate it to each slave.</p>
<p>Because each slave maintains its own ServiceRegistry it is possible to have multiple slaves respond to one service call.</p>
<p><a href='/images/architecture-remote.png'>
<img src='/images/architecture-remote.png' class='no-shadow' />
</a></p>
@ -146,6 +152,13 @@ In the event of the sun setting:
<div class='note'><p class='title'>Note</p><p class='content'>
Because each slave maintains its own ServiceRegistry it is possible to have multiple slaves respond to one service call.
</p></div>
</article>
@ -160,7 +173,7 @@ In the event of the sun setting:
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

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>2014-12-21T15:24:26-08:00</updated>
<updated>2014-12-21T20:17:03-08:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>
@ -18,7 +18,7 @@
<link href="https://home-assistant.io/blog/2014/12/18/website-launched/"/>
<updated>2014-12-18T23:24:45-08:00</updated>
<id>https://home-assistant.io/blog/2014/12/18/website-launched</id>
<content type="html"><![CDATA[<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. This will make sure that the README on GitHub can be purely focussed on developers.</p>
<content type="html"><![CDATA[<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. The process was super smooth thanks to the great tools <a href="http://jekyllrb.com">Jekyll</a> and <a href="http://octopress.org">Octopress</a> and the great services <a href="https://pages.github.com">GitHub Pages</a> and <a href="https://cloudflare.com">CloudFlare</a>.</p>
]]></content>
</entry>

View file

@ -106,7 +106,7 @@
<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. This will make sure that the README on GitHub can be purely focussed on developers.</p>
<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. The process was super smooth thanks to the great tools <a href="http://jekyllrb.com">Jekyll</a> and <a href="http://octopress.org">Octopress</a> and the great services <a href="https://pages.github.com">GitHub Pages</a> and <a href="https://cloudflare.com">CloudFlare</a>.</p>
</article>
@ -148,7 +148,7 @@
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -158,7 +158,7 @@
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

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>2014-12-21T15:24:26-08:00</updated>
<updated>2014-12-21T20:17:03-08:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>
@ -18,7 +18,7 @@
<link href="https://home-assistant.io/blog/2014/12/18/website-launched/"/>
<updated>2014-12-18T23:24:45-08:00</updated>
<id>https://home-assistant.io/blog/2014/12/18/website-launched</id>
<content type="html"><![CDATA[<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. This will make sure that the README on GitHub can be purely focussed on developers.</p>
<content type="html"><![CDATA[<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. The process was super smooth thanks to the great tools <a href="http://jekyllrb.com">Jekyll</a> and <a href="http://octopress.org">Octopress</a> and the great services <a href="https://pages.github.com">GitHub Pages</a> and <a href="https://cloudflare.com">CloudFlare</a>.</p>
]]></content>
</entry>

View file

@ -158,7 +158,7 @@
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -111,7 +111,7 @@
<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. This will make sure that the README on GitHub can be purely focussed on developers.</p>
<p>I finally took the time to setup a simple website to help people getting started with Home Assistant. The process was super smooth thanks to the great tools <a href="http://jekyllrb.com">Jekyll</a> and <a href="http://octopress.org">Octopress</a> and the great services <a href="https://pages.github.com">GitHub Pages</a> and <a href="https://cloudflare.com">CloudFlare</a>.</p>
</article>
@ -160,7 +160,7 @@
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -226,7 +226,7 @@ unknown_light: entity if of the light/light group to target when a light is turn
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -90,7 +90,7 @@
},
{
"attributes": {
"entity_picture": "http://graph.facebook.com/KillBillMovie/picture",
"entity_picture": "//graph.facebook.com/KillBillMovie/picture",
"friendly_name": "Living Room"
},
"entity_id": "chromecast.Living_Rm",
@ -117,7 +117,7 @@
},
{
"attributes": {
"entity_picture": "http://graph.facebook.com/schoutsen/picture"
"entity_picture": "//graph.facebook.com/schoutsen/picture"
},
"entity_id": "device_tracker.Paulus",
"last_changed": "14:55:25 21-12-2014",
@ -157,7 +157,7 @@
},
{
"attributes": {
"entity_picture": "http://graph.facebook.com/anne.t.frederiksen/picture"
"entity_picture": "//graph.facebook.com/anne.t.frederiksen/picture"
},
"entity_id": "device_tracker.Anne_Therese",
"last_changed": "14:55:25 21-12-2014",

View file

@ -75,31 +75,15 @@
<hr class="divider">
<p>Home Assistant can be extended by components. Components can listen for- or trigger events and offer services. Components are written in Python and can do all the goodness that Python has to offer.</p>
<p>Home Assistant can be extended by components. Each component is responsible for a specific domain within Home Assistant. An example is the switch component, which is responsible for interaction with different types of switches. Components can listen for- or trigger events, offer services and maintain states. Components are written in Python and can do all the goodness that Python has to offer.</p>
<p>Home Assistant offers <a href="/components/">built-in components</a> but it is easy to built your own. An example component can be found in <a href="https://github.com/balloob/home-assistant/blob/master/config/custom_components/example.py"><code>/config/custom_components/example.py</code></a>.</p>
<div class='note'><p class='title'>Note</p><p class='content'>
Home Assistant will use the directory that contains your config file as the directory that holds your customizations. By default this is the <code>config</code> folder in your current work directory. You can use a different folder by running Home Assistant with the &#8211;config argument <code>python3 homeassistant --config /YOUR/CONFIG/PATH/</code>.
</p></div>
<h2>Component structure</h2>
<p>Components that interact with devices are structured in core- and platform logic. This allows the same logic to be used for different platforms. Components that add automation usually consist of, but are not limited to, one file.</p>
<p>A component will be loaded on start if a section (ie. <code>[light]</code>) for it exists in the config file. A component can also be loaded if another component is loaded that depends on it. When loading a component Home Assistant will check the following paths:</p>
<ul>
<li><code>&lt;config directory>/custom_components/&lt;component name></code></li>
<li><code>homeassistant/components/&lt;component name></code> (built-in components)</li>
</ul>
<p>Once loaded, a component will only be setup if all dependencies can be loaded and are able to setup. Keep an eye on the logs to see if loading and setup of your component went well.</p>
<div class='note warning'><p class='title'>Warning</p><p class='content'>
*Warning:* You can override a built-in component by offering a component with the same name in your custom_components folder. This is not recommended and may lead to unexpected behavior!
</p></div>
<p>Each component is responsible for a specific domain within Home Assistant. An example is the switch component, which is responsible for interaction with different types of switches. The switch component consists of the following files in <code>homeassistant/components/switch/</code>:</p>
<p>For example, the built-in switch component consists of the following files in <a href="https://github.com/balloob/home-assistant/tree/master/homeassistant/components/switch"><code>homeassistant/components/switch/</code></a>:</p>
<table>
<thead>
@ -111,25 +95,56 @@ Home Assistant will use the directory that contains your config file as the dire
<tbody>
<tr>
<td> __init__.py </td>
<td> Contains the Switch component code.</td>
<td> Contains the Switch core logic.</td>
</tr>
<tr>
<td> wemo.py </td>
<td> WeMo platform support. Included if in config <code>platform=wemo</code>. </td>
<td> WeMo platform logic. Included if in config <code>platform=wemo</code>. </td>
</tr>
<tr>
<td> tellstick.py </td>
<td> Tellstick platform support. Included if in config <code>platform=tellstick</code>. </td>
<td> Tellstick platform logic. Included if in config <code>platform=tellstick</code>. </td>
</tr>
</tbody>
</table>
<p>If a component exists, your job is easy. Have a look at how the component works with other platforms and create a similar file for the platform that you would like to add. If you cannot find a suitable component, you&rsquo;ll have to add it yourself. When writing a component try to structure it after the Switch component to maximize reusability.</p>
<h2>Deciding what to built</h2>
<p>Communication between Home Assistant and devices should happen via third-party libraries that implement the device API. This will make sure the platform support code stays as small as possible.</p>
<p>If you are planning to add support for a new type of device to an existing component, you can get away with only writing a platform. Have a look at how the component works with other platforms and create a similar file for the platform that you would like to add.</p>
<p>After a component is loaded the bootstrapper will call its setup method <code>setup(hass, config)</code>:</p>
<div class='note'><p class='title'>Note</p><p class='content'>
Platform logic should not interface directly with the devices but use a third-party Python 3 library that speaks the actual API.
</p></div>
<h2>Loading components</h2>
<p>A component will be loaded on start if a section (ie. <code>[light]</code>) for it exists in the config file. A component can also be loaded if another component is loaded that depends on it. When loading a component Home Assistant will check the following paths:</p>
<ul>
<li><code>&lt;config directory>/custom_components/&lt;component name></code></li>
<li><code>homeassistant/components/&lt;component name></code> (built-in components)</li>
</ul>
<p>Once loaded, a component will only be setup if all dependencies can be loaded and are able to setup. Keep an eye on the logs to see if your component could be loaded and initialized.</p>
<div class='note warning'><p class='title'>Warning</p><p class='content'>
You can override a built-in component by having a component with the same name in your <code>config/custom_components</code> folder. This is not recommended and will probably break things!
</p></div>
<div class='note'><p class='title'>Note</p><p class='content'>
Home Assistant will use the directory that contains your config file as the directory that holds your customizations. By default this is the <code>config</code> folder in your current work directory. You can use a different folder by running Home Assistant with the &#8211;config argument: <code>python3 homeassistant --config /YOUR/CONFIG/PATH/</code>.
</p></div>
<h2>Initializing components</h2>
<p>After loading, the bootstrapper will call <code>setup(hass, config)</code> method on the component to initialize it. The following parameters are passed in:</p>
<table>
<thead>
@ -141,11 +156,11 @@ Home Assistant will use the directory that contains your config file as the dire
<tbody>
<tr>
<td> <code>hass</code> </td>
<td> The Home Assistant object. Call its methods to track time, register services or listen for events: <a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L38">Overview of available methods.</a> </td>
<td> The Home Assistant object. Call its methods to track time, register services, listen for events or track states: <a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L38">Overview of available methods.</a> </td>
</tr>
<tr>
<td> <code>config</code> </td>
<td> A dict containing the configuration. The keys of the config-dict are component names and the value is another dict with configuration attributes. </td>
<td> A dict containing the configuration. The keys of the config-dict are component names and the value is another dict with the component configuration. </td>
</tr>
</tbody>
</table>
@ -165,15 +180,15 @@ Home Assistant will use the directory that contains your config file as the dire
<tbody>
<tr>
<td> <code>hass.states</code> </td>
<td> This is the StateMachine. The StateMachine allows you to see which states are available and set/test states for specified entities. <a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L473">See available methods</a>. </td>
<td> This is the StateMachine. It allows you to set states and trach when they are changed. <a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L473">See available methods</a>. </td>
</tr>
<tr>
<td> <code>hass.events</code> </td>
<td> This is the EventBus. The EventBus allows you to listen and trigger events. <a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L308">See available methods</a>. </td>
<td> This is the EventBus. It allows you to trigger and listen for events.<br><a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L308">See available methods</a>. </td>
</tr>
<tr>
<td> <code>hass.services</code> </td>
<td> This is the ServiceRegistry. The ServiceRegistry allows you to register services. <a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L589">See available methods</a>. </td>
<td> This is the ServiceRegistry. It allows you to register services.<br><a href="https://github.com/balloob/home-assistant/blob/master/homeassistant/__init__.py#L589">See available methods</a>. </td>
</tr>
</tbody>
</table>
@ -206,7 +221,7 @@ Home Assistant will use the directory that contains your config file as the dire
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -90,7 +90,7 @@
</span></code></pre></td></tr></table></div></figure>
<p>This will start the Home Assistant server and create an initial configuration file in <code>config/home-assistant.conf</code> that is setup for demo mode. It will launch its web interface on <a href="http://127.0.0.1:8123">http://127.0.0.1:8123</a>. The default password is &lsquo;password&rsquo;.</p>
<p>This will start the Home Assistant server and create an initial configuration file <code>config/home-assistant.conf</code> that is setup for demo mode. It will launch its web interface on <a href="http://127.0.0.1:8123">http://127.0.0.1:8123</a>. The default password is &lsquo;password&rsquo;.</p>
<p>If you&rsquo;re using Docker, you can use</p>
@ -99,7 +99,7 @@
</span></code></pre></td></tr></table></div></figure>
<p>After you got the demo mode running it is time to enable some <a href="/components/">components</a> and get started. An example configuration file has been provided in <a href="https://github.com/balloob/home-assistant/blob/master/config/home-assistant.conf.example"><code>/config/home-assistant.conf.example</code></a>.</p>
<p>After you got the demo mode running it is time to customize your configuration and enable some <a href="/components/">built-in components</a>. See <a href="https://github.com/balloob/home-assistant/blob/master/config/home-assistant.conf.example"><code>/config/home-assistant.conf.example</code></a> for an example configuration.</p>
<div class='note'><p class='title'>Note</p><p class='content'>
You can append <code>?api_password=YOUR_PASSWORD</code> to any url to log in automatically.
@ -160,7 +160,7 @@ Tomato requires an extra config variable called `http_id`. The value can be obta
<div class='note'><p class='title'>Note on Luci</p><p class='content'>
Before the Luci scanner can be used you have to install the luci RPC package on OpenWRT: `opkg install luci-mod-rpc`.
Before the Luci scanner can be used you have to install the luci RPC package on OpenWRT: <code>opkg install luci-mod-rpc</code>.
</p></div>
@ -192,7 +192,7 @@ Before the Luci scanner can be used you have to install the luci RPC package on
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -183,7 +183,7 @@ Home Assistant will track the state of all the devices in your home, so you don&
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -94,7 +94,7 @@
<div class="grid">
<div class="grid__item">
<p class="copyright">
<span class="credit">Site powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and using the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>.</span>
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a>, <a href='http://jekyllrb.com/'>Jekyll</a> and the <a href='https://github.com/coogie/oscailte'>Oscalite theme</a>. Hosted by <a href='https://pages.github.com/'>GitHub</a> and served by <a href='https://cloudflare.com'>CloudFlare</a>.</span>
</p>
</div>
</div>

View file

@ -7,55 +7,55 @@
</url>
<url>
<loc>https://home-assistant.io/blog/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://home-assistant.io/blog/archives/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://home-assistant.io/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://home-assistant.io/components/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://home-assistant.io/api/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://home-assistant.io/developers/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://home-assistant.io/getting-started/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://home-assistant.io/screenshots/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://home-assistant.io/architecture/</loc>
<lastmod>2014-12-21T15:24:26-08:00</lastmod>
<lastmod>2014-12-21T20:17:03-08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>

File diff suppressed because one or more lines are too long