Site updated at 2018-01-27 05:27:50 UTC

This commit is contained in:
Travis CI 2018-01-27 05:27:50 +00:00
parent 0e5bccf933
commit d499361ff7
853 changed files with 12458 additions and 2552 deletions

View file

@ -77,11 +77,12 @@
<p>Home Assistant provides various APIs. For detail please refer to <a href="https://dev-docs.home-assistant.io/en/dev/">Home Assistant API</a> documentation.</p>
<ul>
<li><a href="https://dev-docs.home-assistant.io/">Python API</a></li>
<li><a href="/developers/websocket_api/">Websocket API</a></li>
<li><a href="/developers/websocket_api/">WebSocket API</a></li>
<li><a href="/developers/rest_api/">REST API</a></li>
<li><a href="/developers/python_api/">Python REST API</a></li>
<li><a href="/developers/server_sent_events/">Server-sent events</a></li>
</ul>
<p>If you are not using the <a href="/components/frontend/"><code class="highlighter-rouge">frontend</code></a> in your setup then you need to enable the components by adding them to your <code class="highlighter-rouge">configuration.yaml</code> file. E.g., <a href="/components/websocket_api/"><code class="highlighter-rouge">websocket_api:</code></a> for the WebSocket API or <a href="/components/api/"><code class="highlighter-rouge">api:</code></a> for the <a href="/developers/rest_api/">REST API</a> and the <a href="/developers/python_api/">Python REST API</a>.</p>
</article>
</div>
<aside id="sidebar" class="grid__item one-third lap-one-whole palm-one-whole">

View file

@ -75,7 +75,7 @@
</header>
<hr class="divider">
<p>See the <a href="https://dev-docs.home-assistant.io/en/master/api/homeassistant.html#module-homeassistant.remote">developer documentation</a> for a full overview of the documentation. The rest of this page will contain examples on how to use it.</p>
<p>In the package <a href="https://github.com/home-assistant/home-assistant/blob/master/homeassistant/remote.py"><code class="highlighter-rouge">homeassistant.remote</code></a> a Python API on top of the <a href="/developers/api/">HTTP API</a> can be found.</p>
<p>In the package <a href="https://github.com/home-assistant/home-assistant/blob/master/homeassistant/remote.py"><code class="highlighter-rouge">homeassistant.remote</code></a> a Python API on top of the <a href="/developers/api/">HTTP API</a> can be found. If you are not using the <a href="/components/frontend/"><code class="highlighter-rouge">frontend</code></a> in your setup then you need to add the <a href="/components/api/"><code class="highlighter-rouge">api</code> component</a> to your <code class="highlighter-rouge">configuration.yaml</code> file to use the Python Remote API.</p>
<p>A simple way to get all current entities is to visit the “Set State” page in the “Developer Tools”. For the examples below just choose one from the available entries. Here the sensor <code class="highlighter-rouge">sensor.office_temperature</code> and the switch <code class="highlighter-rouge">switch.livingroom_pin_2</code> are used.</p>
<p>First import the module and setup the basics:</p>
<div class="language-python highlighter-rouge"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">homeassistant.remote</span> <span class="kn">as</span> <span class="nn">remote</span>

View file

@ -80,6 +80,7 @@
<li>http://IP_ADDRESS:8123/api/ is a Rest API.</li>
</ul>
<p>The API accepts and returns only JSON encoded objects. All API calls have to be accompanied by the header <code class="highlighter-rouge">X-HA-Access: YOUR_PASSWORD</code> (YOUR_PASSWORD as specified in your <code class="highlighter-rouge">configuration.yaml</code> file in the <a href="/components/http/"><code class="highlighter-rouge">http:</code> section</a>).</p>
<p>If you are not using the <a href="/components/frontend/"><code class="highlighter-rouge">frontend</code></a> in your setup then you need to add the <a href="/components/api/"><code class="highlighter-rouge">api</code> component</a> to your <code class="highlighter-rouge">configuration.yaml</code> file.</p>
<p>There are multiple ways to consume the Home Assistant Rest API. One is with <code class="highlighter-rouge">curl</code>:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>curl -X GET <span class="se">\</span>
-H <span class="s2">"x-ha-access: YOUR_PASSWORD"</span> <span class="se">\</span>

View file

@ -81,14 +81,15 @@
<li><a href="https://raw.githubusercontent.com/home-assistant/home-assistant-dev-helper/master/ha-websocket.html">JavaScript/HTML</a> - WebSocket connection in your browser</li>
</ul>
<p>Connect your websocket implementation to <code class="highlighter-rouge">ws://localhost:8123/api/websocket</code>.</p>
<p>If you are not using the <a href="/components/frontend/"><code class="highlighter-rouge">frontend</code></a> in your setup then you need to add the <a href="/components/websocket_api/"><code class="highlighter-rouge">websocket_api</code> component</a> to your <code class="highlighter-rouge">configuration.yaml</code> file to use the WebSocket API.</p>
<h2><a class="title-link" name="server-states" href="#server-states"></a> Server states</h2>
<ol>
<li>Client connects</li>
<li>Authentication phase starts
<li>Client connects.</li>
<li>Authentication phase starts.
<ul>
<li>If no further authentication necessary for the user: go to 3</li>
<li>Server sends <code class="highlighter-rouge">auth_required</code> message</li>
<li>Client sends <code class="highlighter-rouge">auth</code> message</li>
<li>If no further authentication necessary for the user: go to 3.</li>
<li>Server sends <code class="highlighter-rouge">auth_required</code> message.</li>
<li>Client sends <code class="highlighter-rouge">auth</code> message.</li>
<li>If <code class="highlighter-rouge">auth</code> message correct: go to 3.</li>
<li>Server sends <code class="highlighter-rouge">auth_invalid</code>. Go to 6.</li>
</ul>