home-assistant.github.io/blog/categories/architecture/atom.xml
2016-03-21 19:41:32 +00:00

311 lines
22 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<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>2016-03-21T19:41:07+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Paulus Schoutsen]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Classifying the Internet of Things]]></title>
<link href="https://home-assistant.io/blog/2016/02/12/classifying-the-internet-of-things/"/>
<updated>2016-02-12T06:31:00+00:00</updated>
<id>https://home-assistant.io/blog/2016/02/12/classifying-the-internet-of-things</id>
<content type="html"><![CDATA[<p>The core of home automation is knowing whats going on. The faster we know about a state change, the better we can serve the user. If you want to have your lights to turn on when you arrive at home, it doesnt help if it only knows about it after youve already opened the door and manually (!!) turned on the light.</p>
<p>Each smart device consists of the normal device and the piece that makes it smart: the connectivity. The connectivity part of a device can consists of either control, state or both.</p>
<p>State describes what a device is up to right now. For example, a light can be on with a red color and a medium brightness.</p>
<p>Control is about controlling the smart device by sending commands via an API. These commands can vary from configuring how a device works till mimicking how a user would interact with a device. A media player can allow skipping to the next track and a sensor could allow to configure its sensitivity or polling interval.</p>
<p>The Home Assistant APIs are setup to be as convenient as possible. However, a network is always as weak as its weakest link. In our case these are the integrations. Take for example controlling a light that does not report state. The only state Home Assistant can report on after sending a command is the assumed state: what do we expect the state of the light to be if the command worked.</p>
<p>We want our users to get the best home automation experience out there and this starts with making sure they have devices that work well with Home Assistant. Thats why we will start applying the following classifiers to our integrations:</p>
<p><a name="classifiers"></a></p>
<table>
<tr>
<th colspan="2">Classifier</th>
<th>Description</th>
</tr>
<tr>
<td><i class="icon-adjust"></i></td>
<td style="white-space: nowrap;">Assumed State</td>
<td>
We are unable to get the state of the device. Best we can do is to assume the state based on our last command.
</td>
</tr>
<tr>
<td><i class="icon-cloud-upload"></i></td>
<td>Cloud Polling</td>
<td>
Integration of this device happens via the cloud and requires an active internet connection. Polling the state means that an update might be noticed later.
</td>
</tr>
<tr>
<td><i class="icon-cloud-download"></i></td>
<td>Cloud Push</td>
<td>
Integration of this device happens via the cloud and requires an active internet connection. Home Assistant will be notified as soon as a new state is available.
</td>
</tr>
<tr>
<td><i class="icon-download-alt"></i></td>
<td>Local Polling</td>
<td>
Offers direct communication with device. Polling the state means that an update might be noticed later.
</td>
</tr>
<tr>
<td><i class="icon-upload-alt"></i></td>
<td>Local Push</td>
<td>
Offers direct communication with device. Home Assistant will be notified as soon as a new state is available.
</td>
</tr>
</table>
<p>The background to how we got to these classifiers can be read after the break.<br />
<!--more--></p>
<h2><a class='title-link' name='state' href='#state'></a> State </h2>
<p>How state is communicated can be broken down into 5 categories. They are not mutually exclusive - a device state can be available both via the cloud and local connectivity.</p>
<h3><a class='title-link' name='no-state-available' href='#no-state-available'></a> No state available </h3>
<p>These are devices that do not have the capabilities to make their state available. They only allow to be controlled. For example, devices with infrared remote controls like TVs and ACs. You can press the turn on button on the remote but can only assume that your command was received and executed successfully. The device might not be powered or something is blocking the infrared receiver.</p>
<p>Home automation will have to approach such devices based on the assumption that its commands are received correctly: using optimistic updates. This means that after sending a command it will update the state of the device as if the command was received successfully.</p>
<p>Advantages:</p>
<ul>
<li>None</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>Home automation will assume the wrong state if the the command is not received correctly or if the device is controlled in any other way outside of the home automation system.</li>
</ul>
<h3><a class='title-link' name='polling-the-cloud' href='#polling-the-cloud'></a> Polling the cloud </h3>
<p>These are devices that will only report their state to their own cloud backend. The cloud backend will allow reading the state but will not notify when a new state has arrived. This requires the home automation to check frequently if the state has been updated.</p>
<p>Advantages:</p>
<ul>
<li>Able to control devices while at home or away.</li>
<li>Cloud has access to more computing power to mine the device data to suggest optimizations to the user.</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>It doesnt work if the internet is down or the company stops support.</li>
<li>You are no longer in control about who has access to your data.</li>
</ul>
<h3><a class='title-link' name='cloud-pushing-new-state' href='#cloud-pushing-new-state'></a> Cloud pushing new state </h3>
<p>All off the previous section applies to this one. On top of that the cloud will now notify the home automation when a new state has arrived. This means that as soon as the cloud knows, the home automation knows.</p>
<p>Advantages:</p>
<ul>
<li>New state known as soon as available in the cloud.</li>
</ul>
<h3><a class='title-link' name='polling-the-local-device' href='#polling-the-local-device'></a> Polling the local device </h3>
<p>These devices will offer an API that is locally accessible. The home automation will have to frequently check if the state has been updated.</p>
<p>Advantages:</p>
<ul>
<li>Does not depend on the internet</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>To be pollable, a device needs to be always online which requires the device to be connected to a power source.</li>
</ul>
<h3><a class='title-link' name='local-device-pushing-new-state' href='#local-device-pushing-new-state'></a> Local device pushing new state </h3>
<p>The best of the best. These devices will send out a notice when they get to a new state. These devices usually use a home automation protocol to pass its message to a hub that will do the heavy lifting of managing and notifying subscribers</p>
<p>Advantages:</p>
<ul>
<li>Near instant delivery of new states.</li>
<li>Able to get a long battery life by going into deep sleep between state updates.</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>If it does not also support polling, home automation will not be made aware of the state after booting up until it changes.</li>
<li>If using deep sleep and wifi, will suffer a delay when waking up because connecting to WiFi and receiving an IP takes time.</li>
</ul>
<h2><a class='title-link' name='control' href='#control'></a> Control </h2>
<p>Controlling a device can, just like state, be done through cloud and/or local connectivity. But the more important part of control is knowing if your command was a success and the new state of the device.</p>
<h3><a class='title-link' name='no-control-available' href='#no-control-available'></a> No control available </h3>
<p>These devices are not able to be controlled. They will only offer state.</p>
<h3><a class='title-link' name='poll-state-after-sending-command' href='#poll-state-after-sending-command'></a> Poll State after sending command </h3>
<p>These devices will require the state to be polled after sending a command to see if a command was successfull.</p>
<p>Advantages:</p>
<ul>
<li>The state will be known right after the command was issued.</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>It can take time before the state gets updated. How often do we poll and how long do we wait till we consider the command failed? Also, a state may change because of other factors. Difficult to determine if the updated state is because of our command.</li>
</ul>
<h3><a class='title-link' name='device-pushes-state-update' href='#device-pushes-state-update'></a> Device pushes state update </h3>
<p>These devices will not return a new state as a result of the command but instead will push a new state right away. The downside of this approach is that we have to assume that a state update coming in within a certain period of time after a command is related to the command.</p>
<h3><a class='title-link' name='command-returns-new-state' href='#command-returns-new-state'></a> Command returns new state </h3>
<p>The very best. These devices will answer the command with the new state after executing the command.</p>
<h2><a class='title-link' name='classifying-home-assistant' href='#classifying-home-assistant'></a> Classifying Home Assistant </h2>
<p>Home Assistant tries to offer the best experience possible via its APIs. There are different ways of interacting with Home Assistant but all are local.</p>
<ul>
<li>State polling is available via the REST API</li>
<li>There is a stream API that will push new states as soon as they arrive to subscribers. This is how the frontend is able to always stay in sync.</li>
<li>Calling a service on Home Assistant will return all states that changed while the service was executing. This sadly does not always include the new state of devices that push their new state, as they might arrive after the service has finished.</li>
</ul>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Perfect Home Automation]]></title>
<link href="https://home-assistant.io/blog/2016/01/19/perfect-home-automation/"/>
<updated>2016-01-19T08:20:00+00:00</updated>
<id>https://home-assistant.io/blog/2016/01/19/perfect-home-automation</id>
<content type="html"><![CDATA[<p>People often ask me about my vision for Home Assistant. Before I can describe where I want to go with Home Assistant, I should first talk about how home automation would look in my ideal world. This will be the aim of this post. Im not going to focus on protocols, networks or specific hubs. Thats all implementation details. Instead, this post will focus on what is most important: the interaction between the users and their home.</p>
<h3>You should not have to adapt to technology.</h3>
<p>When people start using home automation, they always experience home control first: being able to control devices in new ways using a phone or computer. They believe the future is now and their app will be their remote for their lives. They only focus on what they are getting, not on what they are losing. You install some light bulbs and all of a sudden you are no longer able to use the light switches. Youll arrive at home at night and have to pull out your phone, open the app, let it connect and finally youll be able to turn on the light. All while turning the light on could have been a switch away.</p>
<p>Yes, you can solve this with presence detection. What if your phone runs out of battery? Youll have to resort to the switch again.</p>
<p>If you find that using your new home devices is cumbersome, the promise of home automation technology has failed you. Your lights should work with both a switch (or button) at the entrance of your room and via presence detection. Honestly, there are hardly any valid use cases for being able to control lights from your phone except for showing off.<br />
<!--more--></p>
<h3>You are not the only user of your home automation.</h3>
<p>People tend to forget that they are not the only ones in their home. As the developer of your house youre enthusiastic about the possibilities and are willing to overlook flaws. Chances are very high that the other people in your household have different hobbies and just want to mind their own business.</p>
<p>This means that everything you automate has to work flawlessly. If you successfully manage to cause a response to some stimulus 90% of the time, youre going to have a disproportionately poor experience 10% of the time. A common automation that fits this pattern is to fade the lights when you start watching a movie or series in the living room. It only works if everyone is watching.</p>
<h3>Limit the impact of false positives and negatives.</h3>
<p>With every automation, you always have to think: what will be the impact if it doesnt work? Home automation is composed of many different systems by many different vendors that speak many different protocols: things will go wrong. Its up to you to make sure that they have a limited impact when they fail. Ideally, devices should fall back to a pre-smart home experience. A Philips Hue bulb will act like a standard white light if turned on/off using a normal switch or when not connected to a hub. If things get worse when your system is out of order, your users will revolt. Take for example the Nest thermostat that <a href="http://www.nytimes.com/2016/01/14/fashion/nest-thermostat-glitch-battery-dies-software-freeze.html">had a bug in the beginning of January</a> which caused it to stop heating the house, yikes!</p>
<h3>The perfect app is no app.</h3>
<p>Home automation should blend with your current workflow, not replace it. For most devices, there is no faster way to control most devices than how you are already doing it today. Most of the time, the best app is no app. The only interface that can be more convenient, and is accessible for visitors of your home of all ages is a voice interface. The industry has realized this too and there are some major players focussing on voice interaction. Take Apple for example: the only way to control your HomeKit devices is with Siri. Amazon has taken it one step further with the Amazon Echo, providing an always-listening connected speaker/microphone for the living room. I expect a lot more companies to join this segment in 2016.</p>
<p>Voice interfaces are not perfect either. The speed at which you can issue commands is low because you have to wait for a response. There are also issues with the discoverability of commands, recognition of accents and dependency on the cloud for processing your voice. I believe that all but the first one are problems that are going to be solved eventually.</p>
<p>This however doesnt mean there isnt a place for apps, there definitely is. They are perfectly well-suited for checking in while youre away, browsing the state changes of your house or making the lights go all funky when there are kids visiting.</p>
<h3>Your system should run at home, not in the cloud.</h3>
<p>The cloud is a magical thing. Somewhere in the world there are computers collecting the data that your house generates, testing them against your automation rules and sending commands back when needed. The cloud will receive updates and improve itself over time so it is able to serve you better. Until its not. There are many reasons why your home might lose its connection to the cloud. The internet can stop working, an update might have gone wrong or the servers running the cloud crash.</p>
<p>When this happens, your house should be able to keep functioning. The cloud should be treated as an extension to your smart home instead of running it. That way youll avoid awkward situations like when Amazon AWS was down and the <a href="http://www.zdnet.com/article/the-night-alexa-lost-her-mind/">Amazon Echo stopped working</a>.</p>
<p><strong>Good home automation never annoys but is missed when it is not working.</strong></p>
<p><em>Thanks to Chris LaRose for this feedback and comments.</em></p>
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Home Control, Automation &amp; the Smart Home]]></title>
<link href="https://home-assistant.io/blog/2014/12/26/home-control-home-automation-and-the-smart-home/"/>
<updated>2014-12-26T18:23:13+00:00</updated>
<id>https://home-assistant.io/blog/2014/12/26/home-control-home-automation-and-the-smart-home</id>
<content type="html"><![CDATA[<p>The internet has been buzzing over the last year about home automation. A lot of different terms fly around like the internet of things, home automation and the smart home.<br />
This article will try to explain how they all relate.</p>
<p>The first thing to introduce is the <strong>Internet of Things</strong> (IoT). This refers to a new generation of devices that cannot only be controlled by humans via buttons or remotes but also provide an interface to communicate with other devices and applications. For example, an IoT-capable coffee machine could receive commands to create different types of coffee and be able to broadcast the amount of water left in its resevoir.</p>
<p>There is no widely adopted open standard for smart device communication. This prevents a lot of devices to communicate with one another. And even if they could, most devices are not designed to manage other devices. To solve this we need a device to be able to communicate with and manage all these connected devices. This device is called a <strong>hub</strong>.</p>
<p>As a bare minimum a hub has to keep track of the state of each device and should be able to control them if possible. For example, it has to know which lights are on or off and offer a way to control the lights. For a sensor it only has to know the value. A hub with these capabilities offers <strong>home control</strong>.</p>
<p class="img">
<a href="/images/screenshots/nexus_7_dashboard.png">
<img alt="Hub dashboard example" src="/images/screenshots/nexus_7_dashboard.png" />
</a>
Example of a hubs dashboard. Showing the state of 2 persons, 4 lights and the sun.
</p>
<!--more-->
<p>A step up from home control is to have the user setup triggers to send commands based on information in the home control layer. For example, to turn on the lights when a person arrives home. A hub with these capabilities is capable of <strong>home automation</strong>.</p>
<p>Most hubs on the market today offer this in various degrees of functionality and usability. Some IoT-capable devices offer this too, but only control themselves and are usually limited to location and time-based events.</p>
<p>The last category, and this is still very much in the future, is the <strong>smart home</strong>. A self-learning and adopting system that will decide which events should impact other devices.</p>
<p>An example of a smart home in action is that it observes that when person A comes home, the lights in the living room and the kitchen switch on. While if person B comes home, the lights in the living room and the study room are switched on. The next time person A or B comes home, the smart home will turn on its preferred lights without any configuration being set by the user.</p>
<p>A glimpse today at how the future can look is the <a href="https://nest.com/">Nest thermostat</a>. A thermostat smart enough to learn your schedule and adjust its own temperature accordingly.</p>
<p>All this results in the following overview of Home Automation.</p>
<p class="img">
<a href="/images/architecture/home_automation_landscape.png">
<img alt="Home Automation landscape" src="/images/architecture/home_automation_landscape.png" />
</a>
Overview of the home automation landscape.
</p>
<h3>Challenges</h3>
<p>You are probably wondering, this all seems relatively simple, why dont I have my very own smart home yet? There are a couple of challenges today that keep us from stepping into the future.</p>
<h4>More Internet of Things-capable devices</h4>
<p>The majority of the IoT products out there are either lights, switches or presence detection. Thats not enough for your home to be very smart about. We need televisions, fridges, ovens and more to join the party to increase the number of devices that we can control.</p>
<h4>More data</h4>
<p>Most first generation IoT devices are only exposing information that is needed for controlling it. We need to be able to track all interactions with each device for our smart home to learn how interaction with devices influence other things. For example, we need to be able to track how many cups of coffee were made or how often the fridge was open. This will increase the information flow and open up a whole bunch of new possibilities. For example, the smart home can order new coffee when youre running low.</p>
<h4>Easy to use, open software that we can trust</h4>
<p>To increase adoption we will need people to trust their smart home system. It will be very tough to convince people to upgrade all their devices and upload all interactions with each of them to the cloud. This data could reveal their whole life including all bad habits. Thats why such a system should be simple and open-source so people can validate that their data generated at home stays home.</p>
<p>Anoter important booster for adoption is that the software should be easy to set up and use by the average user. A lot of people are not burning their hands yet on Home Automation because they are scared of configurating it.</p>
<p>Home Assistant is trying to be this software. It is not there yet but trying hard. Device discovery and a user interface for configuring home automation are problems we hope to tackle in 2015 while not sacrificing any modularity or usability.</p>
<p>Happy new year!</p>
]]></content>
</entry>
</feed>