0% found this document useful (0 votes)
21 views17 pages

OpenIoT 2016 - Automating Your Home With Home Assistant

This document discusses automating a home using Home Assistant. It describes the challenges with the Internet of Things, such as different devices using different standards and apps. Home hubs try to provide a single point of control but Home Assistant improves on this with an event-driven architecture and state machine that can trigger rules-based automations across devices. It supports many devices through components that expose devices as entities with states that can be tracked and used in automations and rules to control devices in response to events.

Uploaded by

RochmatBinSalim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views17 pages

OpenIoT 2016 - Automating Your Home With Home Assistant

This document discusses automating a home using Home Assistant. It describes the challenges with the Internet of Things, such as different devices using different standards and apps. Home hubs try to provide a single point of control but Home Assistant improves on this with an event-driven architecture and state machine that can trigger rules-based automations across devices. It supports many devices through components that expose devices as entities with states that can be tracked and used in automations and rules to control devices in response to events.

Uploaded by

RochmatBinSalim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Automating your home

with Home Assistant


Paulus Schoutsen
OpenIoT 2016, San Diego

1
Introduction

● Paulus Schoutsen

● What are we trying to solve

● How is Home Assistant solving it

● Building on top of Home Assistant

Home Assistant · 2
Challenges with the Internet of Things

● More and more smart devices in homes without a common standard.


○ Some use WiFi to connect to their own cloud.
○ Some talk one of the many home automation protocols.

● Each device comes with own app.


○ No single place of control.
○ No automation across different products.

● Hubs try to solve this.

Home Assistant · 3
What’s the essence of a hub?

● Devices have a state


○ Light = on
Home Control ■ Brightness: 120
■ Color: red
○ Media player = playing
Information Commands
(ie. light is on) (ie. turn light on) ■ Volume: 8
■ TV Show: Game of Thrones

Internet of Things
● There are events happening:
○ State of light has changed
○ Motion detected Home Assistant · 4
What’s the core of home automation?

● Rule based.
Rules
Home
● Triggered by an event. User
Automation

● Optional conditions based on the Commands Commands


current state of devices.
Information Information

● Action can be to control a device or


Home Control
call an external service.

Home Assistant · 5
Rules
Home
User Smart Home
Automation

Commands Commands Commands

Information Information Information

Home Control

Information Commands
(ie. light is on) (ie. turn light on)

Internet of Things

Lights Switches Many more…

Different levels of home automation hubs Home Assistant · 6


Home Assistant

Home automation platform Host it yourself so your Responsive web app that
running on Python 3. data stays yours. runs great everywhere.

Open-source, MIT license. Track people and Track the state of your
things on a map. house over time.

7
Core Architecture State
Machine

● Event driven system.


State changed
● No notion of lights or switches. events
Just entities and their state:
○ Identifier
Time changed
○ State
events
○ Attributes Event Bus Timer
○ Last updated (anything)
○ Last changed (state)

● Service Registry to track available


Call service Service executed
services.
events events

● Timer to notify time changed.


Service
Registry

Home Assistant · 8
Light Bulb Motion Detector

Poll state Turn on

Light Set state


State Machine
Component

State changed
Turn on
events
Call service Motion detected
turn light on events Motion Detector
Service Registry Event Bus
Component

Call service Motion detected


turn light on events

Automation
Component

Interaction between Home Assistant core, components and the Internet of Things Home Assistant · 9
There’s a component
for that.
● Device Types (light, switch, etc)

● Presence Detection

● Entity Organization

● Automation

● Record History

● Third-Party Services Integrations

● Export Data

Find all 242 components and platforms


on home-assistant.io/components
Home Assistant · 10
Support for devices in Home Assistant

● An entity component per device type

● Exports abstract base class (ABC) that connects to Home Assistant core.
○ Defines information to be exposed (is_on, rgb_color, brightness)
○ Defines methods to be called (turn_on, turn_off)

● Each protocol/cloud/etc implemented as a platform


○ Expose devices as objects derived from ABC.

Home Assistant · 11
Example sensor
platform
Create file as:

<config>/custom_components/
sensor/example.py

In configuration.yaml file:

sensor:
platform: example

For source code, see:


https://gist.github.com/balloob/3e8ae00a2354f4e889c0
Example switch
platform
● Based on existence of a file.
● File path passed in via config.

Create file as:

<config>/custom_components/
switch/example.py

In configuration.yaml file:

switch:
platform: example
file_path: /tmp/ha_switch

For source code, see: Home Assistant · 13


https://gist.github.com/balloob/3e8ae00a2354f4e889c0
Components can also
provide automation
● Keep two entities in opposite
states.

Create file as:

<config>/custom_components/
xor_automation.py

In configuration.yaml file:

xor_automation:
entity_1: switch.ac
entity_2: switch.heater

For source code, see: Home Assistant · 14


https://gist.github.com/balloob/3e8ae00a2354f4e889c0
Example automation
configuration
● Turn light on 1 hour before
sunset if anyone is home.
● Using automation component.

● 1 or more triggers.
● 0 or more conditions.

○ Time
○ Event
○ State
○ Sun
○ Zone (GPS)
○ MQTT

Home Assistant · 15
Thanks for supporting open-source

● GitHub for hosting our source code and website.


● TravisCI for providing continuous integration.
● Coveralls for keeping track of our test coverage.
● Pivotal Tracker for roadmap management.
● Gitter for hosting our community chat.

● AppFolio for allowing me to go to these conferences.


● Home Assistant community for being active, friendly and helpful.

Home Assistant · 16
Home Assistant
Try the demo on your phone at
home-assistant.io/demo

On your computer with Python 3:

pip3 install homeassistant


hass --open-ui

Visit our website for more information


and tutorials: home-assistant.io

Home Assistant · 17

You might also like