Site updated at 2015-10-31 05:14:10 UTC

This commit is contained in:
Paulus Schoutsen 2015-10-30 22:14:10 -07:00
parent b260f2881e
commit f9339c33ec
25 changed files with 118 additions and 179 deletions

View file

@ -4,7 +4,7 @@
<title><![CDATA[Home Assistant]]></title>
<link href="https://home-assistant.io/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: architecture | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/architecture/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: branding | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/branding/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: component | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/component/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: core | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/core/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: esp8266 | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/esp8266/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: frontend | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/frontend/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: how-to | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/how-to/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: mqtt | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/mqtt/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: release-notes | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/release-notes/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: user-stories | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/user-stories/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -4,7 +4,7 @@
<title><![CDATA[Category: website | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/website/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2015-10-29T00:08:34-07:00</updated>
<updated>2015-10-30T22:13:50-07:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>

View file

@ -104,8 +104,6 @@
<p>There are a lot of extensions (so called <a href="https://www.arduino.cc/en/Main/ArduinoShields">shields</a>) available. Those shields can be plugged-in into the existing connectors and stacked on top of each other. This makes it possible to expand the capabilities of the Arduino boards.</p>
<h2>Basic Configuration</h2>
<p>The arduino component is designed to let you use a directly attached board to your Home Assistant host over USB.</p>
<p>You need to have the <a href="https://github.com/firmata/">Firmata firmware</a> on your board. Please upload the <code>StandardFirmata</code> sketch to your board, please refer to the <a href="https://www.arduino.cc/en/Main/Howto">Arduino documentation</a> for further information.</p>
@ -123,28 +121,23 @@
<p>Configuration variables:</p>
<ul>
<li><strong>port</strong> (<em>Required</em>): The port where your board is connected to your Home Assistant host. If you are using an original Arduino the port will be named <code>ttyACM*</code>. The exact number can be determined with <code>ls /dev/ttyACM*</code>.</li>
<li><strong>port</strong> (<em>Required</em>): The port where your board is connected to your Home Assistant host. If you are using an original Arduino the port will be named <code>ttyACM*</code> otherwise <code>ttyUSB*</code>.</li>
</ul>
<p>The exact number can be determined with the command shown below.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>$ ls /dev/ttyACM*
</pre></div>
</div>
</div>
<p>If that is not working, check your <code>dmesg</code> or <code>journalctl -f</code> output. Keep in mind that Arduino clones are often using a different name for the port (e.g. <code>/dev/ttyUSB*</code>).</p>
<p>If thats not working, check your <code>dmesg</code> or <code>journalctl -f</code> output. Keep in mind that Arduino clones are often using a different name for the port (eg. <code>/dev/ttyUSB*</code>).</p>
<p class="note warning">
A word of caution: The Arduino boards are not storing states. This means that with every initialization the pins are set to off/low.
</p>
<h2>Building on top of the Arduino component</h2>
<ul>
<li><a href="/components/sensor.arduino/">Arduino Sensor</a></li>
<li><a href="/components/switch.arduino/">Arduino Switch</a></li>
</ul>
</article>

View file

@ -264,16 +264,11 @@
<span class="key">hours</span>: <span class="string"><span class="content">0</span></span>
<span class="key">minutes</span>: <span class="string"><span class="content">5</span></span>
<span class="key">seconds</span>: <span class="string"><span class="content">0</span></span>
<span class="key">weekday</span>:
- <span class="string"><span class="content">sat</span></span>
- <span class="string"><span class="content">sun</span></span>
</pre></div>
</div>
</div>
<p>You can use <code>weekday</code> to limit the trigger times to speific days as well (also available in conditions). Valid values for <code>weekday</code> are (<code>sun</code>, <code>mon</code>, <code>tue</code>, <code>wed</code>, <code>thu</code>, <code>fri</code> &amp; <code>sat</code>)</p>
<p>The above example will trigger on Saturday and Sunday every hour on the 5 (2:05, 3:05, 4:05, etc).</p>
<p>The above example will trigger every hour on the 5 (2:05, 3:05, 4:05, etc).</p>
<h4><a class="title-link" name="zone-trigger" href="#zone-trigger"></a> Zone trigger</h4>

View file

@ -119,7 +119,6 @@ This device tracker needs telnet to be enabled on the router.
<span class="key">host</span>: <span class="string"><span class="content">YOUR_ROUTER_IP</span></span>
<span class="key">username</span>: <span class="string"><span class="content">YOUR_ADMIN_USERNAME</span></span>
<span class="key">password</span>: <span class="string"><span class="content">YOUR_ADMIN_PASSWORD</span></span>
<span class="key">home_interval</span>: <span class="string"><span class="content">MINUTES</span></span>
</pre></div>
</div>
</div>
@ -130,7 +129,6 @@ This device tracker needs telnet to be enabled on the router.
<li><strong>host</strong> (<em>Required</em>): The IP address of your router, eg. 192.168.1.1.</li>
<li><strong>username</strong> (<em>Required</em>: The username of an user with administrative privileges, usually <em>admin</em>.</li>
<li><strong>password</strong> (<em>Required</em>): The password for your given admin account.</li>
<li><strong>home_interval</strong> (<em>Optional</em>): If the home_interval is set then the component will not let a device be AWAY if it has been HOME in the last home_interval minutes. This is in addition to the 3 minute wait built into the device_tracker component.</li>
</ul>
<p>See the <a href="/components/device_tracker/">device tracker component page</a> for instructions how to configure the people to be tracked.</p>

View file

@ -102,7 +102,7 @@
<p>The <code>downloader</code> component provides a service to download files. It will raise an error and not continue to set itself up when the download directory does not exist.</p>
<p>To enable it, add the following lines to your <code>configuration.yaml</code>:</p>
<p>To enable it, add the following lines to your <code>configuration.yaml</code> file:</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="comment"># Example configuration.yaml entry</span>
@ -111,11 +111,24 @@
</pre></div>
</div>
</div>
<p>If the path is not absolute, its assumed to be relative to the HASS configuration directory.</p>
<h4>Service <code>downloader/download_file</code></h4>
<p>Configuration variables:</p>
<p>Download the specified url.</p>
<ul>
<li><strong>download_dir</strong> (<em>Required</em>): If the path is not absolute, its assumed to be relative to the Home Assistant configuration directory (eg. <code>.homeassistant/downloads</code>).</li>
</ul>
<h3><a class="title-link" name="use-the-service" href="#use-the-service"></a> Use the service</h3>
<p>Go the the “Developer Tools”, then to “Call Service”, and choose <code>downloader/download_file</code> from the list of available services. Fill the “Service Data” field as shown in the example below and hit “CALL SERVICE”.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>{<span class="key"><span class="delimiter">&quot;</span><span class="content">url</span><span class="delimiter">&quot;</span></span>:<span class="string"><span class="delimiter">&quot;</span><span class="content">http://domain.tld/path/to/file</span><span class="delimiter">&quot;</span></span>}
</pre></div>
</div>
</div>
<p>This will download the file from the given URL.</p>
<table>
<thead>

View file

@ -100,17 +100,12 @@
</header>
<hr class="divider">
<p>The ISY994 is a home automation controller that is capable of controlling<br />
Insteon and X10 devices. The controller is also capable of controlling Z-Wave<br />
devices but that functionality has not yet been confirmed with Home Assistant.<br />
The ISY994 controller is manufactured by <a href="https://www.universal-devices.com/residential/isy994i-series/">Universal<br />
Devices</a>.</p>
<p>The ISY994 is a home automation controller that is capable of controlling Insteon and X10 devices. The controller is also capable of controlling Z-Wave devices but that functionality has not yet been confirmed with Home Assistant.<br />
The ISY994 controller is manufactured by <a href="https://www.universal-devices.com/residential/isy994i-series/">Universal Devices</a>.</p>
<h3><a class="title-link" name="basic-configuration" href="#basic-configuration"></a> Basic Configuration</h3>
<p>Home Assistant is capable of communicating with any switch, sensor, and light<br />
that is configured on the controller. Using the programs on the controller,<br />
custom switches and sensors can also be created.</p>
<p>Home Assistant is capable of communicating with any switch, sensor, and light that is configured on the controller. Using the programs on the controller, custom switches and sensors can also be created.</p>
<p>To integrate your ISY994 controller with Home Assistant, add the following section to your <code>configuration.yaml</code> file:</p>
@ -134,61 +129,40 @@ custom switches and sensors can also be created.</p>
<li>
<p><strong>password</strong> (<em>Required</em>): The password that used to access the ISY interface.</p>
</li>
<li><strong>sensor_string</strong> (<em>Optional</em>): This is the string that is used to identify which devices are to be assumed to be sensors instead of lights of switches. By default, this string is Sensor. If this string is found in the device name, Home Assistant will<br />
assume it is as a sensor.</li>
<li><strong>hidden_string</strong> (<em>Optional</em>): The HIDDEN_STRING is a string that is used to identify which devices are to be<br />
hidden on Home Assistants front page. This string will be stripped from the<br />
devices name before being used. By default, this value is {HIDE ME}.</li>
<li><strong>tls</strong> (<em>Optional</em>): This entry should refelct the version of TLS that the ISY controller is using for HTTPS encryption. This value can be either 1.1 or 1.2. If this value is not set, it is assumed to be version 1.1. This is the default for most users.<br />
ISY994 Pro users may likely be using 1.2. When using HTTPS in the host entry, it is best practice to set this value.</li>
<li><strong>sensor_string</strong> (<em>Optional</em>): This is the string that is used to identify which devices are to be assumed to be sensors instead of lights of switches. By default, this string is Sensor. If this string is found in the device name, Home Assistant will assume it is as a sensor.</li>
<li><strong>hidden_string</strong> (<em>Optional</em>): The HIDDEN_STRING is a string that is used to identify which devices are to be hidden on Home Assistants front page. This string will be stripped from the devices name before being used. By default, this value is {HIDE ME}.</li>
<li><strong>tls</strong> (<em>Optional</em>): This entry should refelct the version of TLS that the ISY controller is using for HTTPS encryption. This value can be either 1.1 or 1.2. If this value is not set, it is assumed to be version 1.1. This is the default for most users. ISY994 Pro users may likely be using 1.2. When using HTTPS in the host entry, it is best practice to set this value.</li>
</ul>
<p>Once the ISY controller is configured, it will automatically import any lights, switches, and sensors it can locate.</p>
<h3><a class="title-link" name="creating-custom-switches" href="#creating-custom-switches"></a> Creating Custom Switches</h3>
<p>Using the Programs tab in the controllers Administrative Console, custom<br />
switches can be created that will appear natively inside of Home Assistant.<br />
Home Assistant will scan two different directories for switch configurations on<br />
the controller. These directories must exist at the root level. The two<br />
directories used to make switches are <em>HA.doors</em> and <em>HA.switches</em>. Currently,<br />
the two receive identical treatment in Home Assistant.</p>
<p>Using the Programs tab in the controllers Administrative Console, custom switches can be created that will appear natively inside of Home Assistant. Home Assistant will scan two different directories for switch configurations on the controller. These directories must exist at the root level. The two directories used to make switches are <em>HA.doors</em> and <em>HA.switches</em>. Currently, the two receive identical treatment in Home Assistant.</p>
<p>A switch is created by creating a directory under either of these root<br />
dirctories with the name you would like to call the switch. Two programs are<br />
then required in this directory: <em>status</em> and <em>actions</em>. The image below shows<br />
a sample configuration. This sample includes an extra program called <em>auto on</em>.<br />
This is ignored by Home Assistant.</p>
<p>A switch is created by creating a directory under either of these root dirctories with the name you would like to call the switch. Two programs are then required in this directory: <em>status</em> and <em>actions</em>. The image below shows a sample configuration. This sample includes an extra program called <em>auto on</em>. This is ignored by Home Assistant.</p>
<p class="img">
<img src="/images/isy994/isy994_SwitchExample.png" />
</p>
<p>The <em>status</em> program in this directory is what indicates if the switch is on or<br />
off. Only the IF clause is evaluated. If the clause returns True, the switch<br />
will be on. False will indicate the switch is off.</p>
<p>The <em>status</em> program in this directory is what indicates if the switch is on or off. Only the IF clause is evaluated. If the clause returns True, the switch will be on. False will indicate the switch is off.</p>
<p class="img">
<img src="/images/isy994/isy994_SwitchStatusExample.png" />
</p>
<p>The <em>actions</em> program indicates what should be performed to turn the switch on<br />
or off. The THEN clause gives instructions for turning the switch on while the<br />
ELSE clause gives instructions for turning the switch off. Below is an example.</p>
<p>The <em>actions</em> program indicates what should be performed to turn the switch on or off. The THEN clause gives instructions for turning the switch on while the ELSE clause gives instructions for turning the switch off. Below is an example.</p>
<p class="img">
<img src="/images/isy994/isy994_SwitchActionsExample.png" />
</p>
<p>The example program above shows how to control a legacy X10 device from Home<br />
Assistant using an ISY controller.</p>
<p>The example program above shows how to control a legacy X10 device from Home Assistant using an ISY controller.</p>
<h3><a class="title-link" name="creating-custom-sensors" href="#creating-custom-sensors"></a> Creating Custom Sensors</h3>
<p>Custom sensors can also be created using the Programs tab in the ISY<br />
controllers Administrative Console. For programs, three different root level<br />
folders are evaluated that are all handled a little differently inside of Home<br />
Assistant.</p>
<p>Custom sensors can also be created using the Programs tab in the ISY controllers Administrative Console. For programs, three different root level folders are evaluated that are all handled a little differently inside of Home Assistant.</p>
<ul>
<li><em>HA.sensors</em> will have states of Open or Closed</li>
@ -196,17 +170,13 @@ Assistant.</p>
<li><em>HA.locations</em> will have states of Home or Away</li>
</ul>
<p>To create a custom sensor, create a program under any of the three root<br />
directories. The name of the program will be the name of the sensor. An example<br />
below shows a location indicator setup.</p>
<p>To create a custom sensor, create a program under any of the three root directories. The name of the program will be the name of the sensor. An example below shows a location indicator setup.</p>
<p class="img">
<img src="/images/isy994/isy994_SensorExample.png" />
</p>
<p>The program created only needs an IF clause. It will be evaluated to either<br />
Open/On/Home when it returns True and Closed/Off/Away when it returns False. An<br />
example is below.</p>
<p>The program created only needs an IF clause. It will be evaluated to either Open/On/Home when it returns True and Closed/Off/Away when it returns False. An example is below.</p>
<p class="img">
<img src="/images/isy994/isy994_SensorStatusExample.png" />

View file

@ -107,7 +107,7 @@
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="comment"># Example configuration.yaml entry</span>
<span class="key">media_player</span>:
<span class="key">platform</span>: <span class="string"><span class="content">chromecast</span></span>
<span class="key">platform</span>: <span class="string"><span class="content">cast</span></span>
<span class="key">host</span>: <span class="string"><span class="content">192.168.1.9</span></span>
</pre></div>
</div>

View file

@ -107,35 +107,36 @@
<p>If your are running into troubles with your notification platform, a simple way to test it is to use <strong>Call Service</strong> from the <strong>Developer Tools</strong>. Choose your service (<em>notify/xyz</em>) from the list of <strong>Available services:</strong> and enter something like the sample below into the <strong>Service Data</strong> field and hit <strong>CALL SERVICE</strong>.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>{<span class="key"><span class="delimiter">&quot;</span><span class="content">title</span><span class="delimiter">&quot;</span></span>:<span class="string"><span class="delimiter">&quot;</span><span class="content">Test</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">message</span><span class="delimiter">&quot;</span></span>:<span class="string"><span class="delimiter">&quot;</span><span class="content">A simple test message from HA.</span><span class="delimiter">&quot;</span></span>}
<div class="code"><pre>{<span class="key"><span class="delimiter">&quot;</span><span class="content">message</span><span class="delimiter">&quot;</span></span>:<span class="string"><span class="delimiter">&quot;</span><span class="content">A simple test message from HA.</span><span class="delimiter">&quot;</span></span>}
</pre></div>
</div>
</div>
<p>This will send a single message to your notification platform configured in your <code>configuration.yaml</code> file.</p>
<h2><a class="title-link" name="examples" href="#examples"></a> Examples</h2>
<table>
<thead>
<tr>
<th>Service data attribute</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>title</code></td>
<td>yes</td>
<td>Can be used to set a title for the message. The default is <code>Home Assistant</code>.</td>
</tr>
<tr>
<td><code>message</code></td>
<td>no</td>
<td>Message to send to recipient.</td>
</tr>
</tbody>
</table>
<h3><a class="title-link" name="automation" href="#automation"></a> Automation</h3>
<p>Notifications are great to be used within Home Automation. Below is a an example configuration that you can add to your <code>configuration.yaml</code> file to be notified when the sun sets.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="key">automation</span>:
<span class="key">alias</span>: <span class="string"><span class="content">Sun set notification</span></span>
<span class="key">platform</span>: <span class="string"><span class="content">state</span></span>
<span class="key">state_entity_id</span>: <span class="string"><span class="content">sun.sun</span></span>
<span class="key">state_from</span>: <span class="string"><span class="content">above_horizon</span></span>
<span class="key">state_to</span>: <span class="string"><span class="content">below_horizon</span></span>
<span class="key">execute_service</span>: <span class="string"><span class="content">notify.NOTIFIER_NAME</span></span>
<span class="key">service_data</span>: <span class="string"><span class="content">{&quot;message&quot;:&quot;YAY&quot;}</span></span>
</pre></div>
</div>
</div>
<p>For more automation examples, see the <a href="/components/automation/">getting started with automation page</a>.</p>
<p>For more automation examples, see the <a href="/getting-started/automation/">getting started with automation page</a> or the <a href="/cookbook">configuration cookbook</a>.</p>
</article>

View file

@ -122,8 +122,7 @@
<h3>How to find the packet_id for your devices</h3>
<p>Make sure you have enabled all RFXtrx related platforms. Push your remote and the device will be added<br />
automatically. After that you can see you device packetid in the state developer tools in the app.</p>
<p>Make sure you have enabled all RFXtrx related platforms. Push your remote and the device will be added automatically. After that you can see you device packetid in the state developer tools in the app.</p>
<p>Example for X10 and Chacon DI.O signals, if you see in state developer tools the following entities:</p>

View file

@ -148,71 +148,8 @@
</li>
</ul>
<p>The variables in the <code>monitored_variables</code> array must be available in the response of the device. As a starting point you find below a sketch for the Arduino device family. There are two variables (<code>temperature</code> and <code>humidity</code>) which will act as endpoints.</p>
<p>The variables in the <code>monitored_variables</code> array must be available in the response of the device. As a starting point you could use the one of the example sketches (eg. <a href="https://raw.githubusercontent.com/marcoschwartz/aREST/master/examples/Ethernet/Ethernet.ino">Ethernet</a> for an Arduino with Ethernet shield). In those sketches are two variables (<code>temperature</code> and <code>humidity</code>) available which will act as endpoints.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre><span class="comment">/*
This modified sketch is based on the Ethernet example of the aREST
(http://arest.io/) library.
*/</span>
<span class="comment">// Libraries</span>
<span class="preprocessor">#include</span> <span class="include">&lt;SPI.h&gt;</span>
<span class="preprocessor">#include</span> <span class="include">&lt;Ethernet.h&gt;</span>
<span class="preprocessor">#include</span> <span class="include">&lt;aREST.h&gt;</span>
<span class="preprocessor">#include</span> <span class="include">&lt;avr/wdt.h&gt;</span>
<span class="comment">// Device settings</span>
<span class="predefined-type">char</span>* deviceId = <span class="string"><span class="delimiter">&quot;</span><span class="content">sensor02</span><span class="delimiter">&quot;</span></span>;
<span class="predefined-type">char</span>* deviceName = <span class="string"><span class="delimiter">&quot;</span><span class="content">livingroom</span><span class="delimiter">&quot;</span></span>;
byte deviceMac[] = { <span class="hex">0x20</span>, <span class="hex">0xD5</span>, <span class="hex">0xD3</span>, <span class="hex">0x03</span>, <span class="hex">0xFE</span>, <span class="hex">0x31</span> };
IPAddress deviceIp(<span class="integer">192</span>, <span class="integer">168</span>, <span class="integer">1</span>, <span class="integer">12</span>);
EthernetServer server(<span class="integer">80</span>);
aREST rest = aREST();
<span class="comment">// Variables to be exposed to the API</span>
<span class="predefined-type">int</span> temperature;
<span class="predefined-type">int</span> humidity;
<span class="directive">void</span> setup(<span class="directive">void</span>) {
Serial.begin(<span class="integer">57600</span>);
<span class="comment">// Init variables and expose them to REST API</span>
temperature = <span class="integer">0</span>;
humidity = <span class="integer">0</span>;
rest.variable(<span class="string"><span class="delimiter">&quot;</span><span class="content">temperature</span><span class="delimiter">&quot;</span></span>, &amp;temperature);
rest.variable(<span class="string"><span class="delimiter">&quot;</span><span class="content">humidity</span><span class="delimiter">&quot;</span></span>, &amp;humidity);
<span class="comment">// Give name and ID to device</span>
rest.set_id(deviceId);
rest.set_name(deviceName);
Ethernet.begin(deviceMac, deviceIp);
server.begin();
Serial.print(<span class="string"><span class="delimiter">&quot;</span><span class="content">Sensor is ready...</span><span class="delimiter">&quot;</span></span>);
<span class="comment">// Start watchdog</span>
wdt_enable(WDTO_4S);
}
<span class="directive">void</span> loop() {
EthernetClient client = server.available();
rest.handle(client);
wdt_reset();
<span class="comment">// Replace this with your actual sensor readings, like</span>
<span class="comment">// temperature = (((analogRead(A0) * 5.0) / 1024) - 0.5) * 10;</span>
temperature = random(<span class="integer">400</span>);
humidity = random(<span class="integer">600</span>);
delay(<span class="integer">500</span>);
}
</pre></div>
</div>
</div>
<p>Accessing one of the endpoints (eg. http://192.168.1.10/temperature) will give you the value inside a JSON response.</p>
<div class="highlighter-coderay"><div class="CodeRay">
@ -237,6 +174,14 @@ aREST rest = aREST();
</div>
</div>
<p><code>return_value</code> contains the sensors data in a JSON response for a given pin (eg. http://192.168.1.10/analog/2/ or http://192.168.1.10/digital/7/).</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>{<span class="key"><span class="delimiter">&quot;</span><span class="content">return_value</span><span class="delimiter">&quot;</span></span>: <span class="integer">34</span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">id</span><span class="delimiter">&quot;</span></span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">sensor02</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">name</span><span class="delimiter">&quot;</span></span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">livingroom</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">connected</span><span class="delimiter">&quot;</span></span>: <span class="value">true</span>}
</pre></div>
</div>
</div>
</article>

View file

@ -124,17 +124,17 @@
<ul>
<li><strong>resource</strong> (<em>Required</em>): IP address and schema of the device that is exposing an aREST API, eg. http://192.168.1.10.</li>
<li><strong>name</strong> (<em>Optional</em>): Let you overwrite the the name of the device. By default <em>name</em> from the device is used.</li>
<li><strong>pins</strong> (<em>Required</em>): An array with all used pins of your board.
<li><strong>pins</strong> array (<em>Required</em>): An array with all used pins of your board.
<ul>
<li><strong>name</strong> (<em>Required</em>): The name of the pin you wish to toggle.</li>
</ul>
</li>
</ul>
<p>Accessing one of the endpoints (eg. http://192.168.1.10/analog/2/) will give you a JSON response. The interesting part is <code>return_value</code> which represents the sensors data.</p>
<p>You can still switch your pins with a web browser or a command line tool. Use the http://192.168.1.10/digital/8/1 to set pin 8 to high/on, the JSON response will give you some feedback.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>{<span class="key"><span class="delimiter">&quot;</span><span class="content">return_value</span><span class="delimiter">&quot;</span></span>: <span class="integer">34</span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">id</span><span class="delimiter">&quot;</span></span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">sensor02</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">name</span><span class="delimiter">&quot;</span></span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">livingroom</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">connected</span><span class="delimiter">&quot;</span></span>: <span class="value">true</span>}
<div class="code"><pre>{<span class="key"><span class="delimiter">&quot;</span><span class="content">message</span><span class="delimiter">&quot;</span></span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">Pin D8 set to 1</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">id</span><span class="delimiter">&quot;</span></span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">sensor02</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">name</span><span class="delimiter">&quot;</span></span>: <span class="string"><span class="delimiter">&quot;</span><span class="content">livingroom</span><span class="delimiter">&quot;</span></span>, <span class="key"><span class="delimiter">&quot;</span><span class="content">connected</span><span class="delimiter">&quot;</span></span>: <span class="value">true</span>}
</pre></div>
</div>
</div>

View file

@ -107,12 +107,32 @@
<li>Registers services <code>switch/turn_on</code> and <code>switch/turn_off</code> to control switches.</li>
</ul>
<p>Optional service data:</p>
<h3><a class="title-link" name="use-the-services" href="#use-the-services"></a> Use the services</h3>
<ul>
<li><code>entity_id</code> - only act on specific switch. Else targets all.</li>
</ul>
<p>Go the the <strong>Developer Tools</strong>, then to <strong>Call Service</strong> in the frontend, and choose <code>switch/turn_on</code> or <code>switch/turn_off</code> from the list of available services (<strong>Available services:</strong> on the left). Enter something like the sample below into the <strong>Service Data</strong> field and hit <strong>CALL SERVICE</strong>.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>{<span class="key"><span class="delimiter">&quot;</span><span class="content">entity_id</span><span class="delimiter">&quot;</span></span>:<span class="string"><span class="delimiter">&quot;</span><span class="content">livingroom_pin2</span><span class="delimiter">&quot;</span></span>}
</pre></div>
</div>
</div>
<table>
<thead>
<tr>
<th>Service data attribute</th>
<th>Optional</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>entity_id</code></td>
<td>yes</td>
<td>Only act on specific switch. Else targets all.</td>
</tr>
</tbody>
</table>
</article>

View file

@ -118,8 +118,8 @@
<p>For a component page it would be the fastest way to make a copy of an existing page and edit it.</p>
<h2>Code</h2>
<p>To take advantage of the build-in features of Octopress to display code snipplets, just use the default markdown syntax.</p>
<h3><a class="title-link" name="code" href="#code"></a> Code</h3>
<p>To take advantage of the build-in features of Octopress to display code snipplets, just use the default markdown syntax. Please use <code>$</code> and <code>#</code> if its a command and to differ from output.</p>
<div class="highlighter-coderay"><div class="CodeRay">
<div class="code"><pre>Here goes the code...
@ -127,7 +127,12 @@
</div>
</div>
<h2>Images, icons, and logos</h2>
<p>If you want to display line numbers, add the following snipplets somewhere on your page.</p>
<pre><code>{::options coderay_line_numbers="table" /}
</code></pre>
<h3><a class="title-link" name="images-icons-and-logos" href="#images-icons-and-logos"></a> Images, icons, and logos</h3>
<p>The images which are displayed on the pages are stored in various directories according their purpose.</p>
<table>

File diff suppressed because one or more lines are too long