Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Smart Things + Home Assistant: build your own s...

suci
June 01, 2018

Smart Things + Home Assistant: build your own smart home

Slides for pycon Taiwan 2018
https://tw.pycon.org/2018/zh-hant/events/talk/595662847891996847/

Our world will be composed of more and more connected devices. Smart things will enrich our life started from our home. However, with no standard in place for communication, devices are unable to recognize to each other and work together well.

An open source project, "Home Assistant", brings us into the practical home automation world. Building on Python, the home automation platform was implemented to take control of their houses, their data, and their privacy. In this talk, I will start by introducing a concept of home automation, the general concept of "Home Assistant" and it's components. Then, a sample demo will bring you a real scenario along with introducing configurations.

suci

June 01, 2018
Tweet

More Decks by suci

Other Decks in Programming

Transcript

  1. About me Data engineer in a manufacturing company Working with

    • data and people Focus on • Streaming process • IoT applications • Engineer culture Shuhsi Lin Lurking in PyHug, Taipei.py and various Meetup sucitw gmail.com
  2. • Smart home/home automation ◦ What makes home automation hard

    • Introduction of home-assistant ◦ Basic concept of home-assistant ◦ Architecture of home-assistant • How to build your home automation system ◦ Environment setup ◦ Configuration ◦ Possible scenario • Summary What I will share today 3
  3. • Hacking hardware ( The next speaker may take care

    !?) • Basic configurations and use on Raspberry Pi • Compare ecosystems for Amazon Alexa/ Google home/ Apple HomePod/ Mi home ….. • Much source code What I will not focus ( aka I don’t know) 4
  4. Smart Things 6 home control home automation smart home location

    and time-based events communicate with each other at home
  5. 7 Internet of Things Home Control Information (ex, light is

    on) Commands (ex, turn light on) Home Automation: Start from a hub User Information Commands State • Light = on ◦ Brightness: 120 ◦ Color: Yellow • Sensor value ◦ Temperature: 32 oC • Switch ◦ Power: turn_on Event • State of switch has changed ◦ Off -> on • Motion detected • Remote control TV
  6. Home Automation Landscape 9 Internet of Things Home Control User

    Information (ex, light is on) Commands (ex, turn light on) Information Commands Information Commands Information Commands Home Automation Smart Home Rules (Configuration) Home Control, Automation & the Smart Home
  7. •More IoT devices with different protocols •Many own apps •More

    data •More scenarios •Privacy and trust •Easy to use Challenges 10 https://www.home-assistant.io/blog/2014/12/26/home-control-home-automation-and-the-smart-home/
  8. Home Assistant • Open source, Python 3 • Active Community

    ◦ 2 weeks release cycle ◦ Chatrooms, forums, videos • Supported many and many devices • Configuration-based ◦ Automation with no code change • Cross platforms • Local or remote and cloud is optional
  9. • Platforms ◦ Types of devices (ex, lights, sensors) •

    Components (> 1000) ◦ Interact with an Internet-of-Things domain ▪ MQTT, Zwave, Zigbee ▪ Lights (Hue, Tradfri) ▪ Sensors ◦ Respond to events that happen within Home Assistant ▪ Small pieces of home automation logic or involve services that do common tasks within your house. ▪ ex, device_sun_light_trigger component Wording in HA Event Bus: facilitates the firing and listening of events -- the beating heart of Home Assistant. State Machine: keeps track of the states of things and fires a state_changed event when a state has been changed. Service Registry: listens on the event bus for call_service events and allows other code to register services. Timer: sends a time_changed event every 1 second on the event bus
  10. Home Automation Landscape 14 Internet of Things Home Control User

    Information (ex, light is on) Commands (ex, turn light on) Information Commands Information Commands Information Commands Home Automation Smart Home Rules (Configuration) Home Control, Automation & the Smart Home
  11. Components Architecture 16 State Machine Components service_called events call_service events

    set state Event Bus Service Registry Timer listen for events/ fire event state_changed events call event listeners time_changed events publish service call service modified from (component_interaction) https://developers.home-assistant.io/docs/en/architecture_index.htm ...
  12. Installation On Raspberry Pi 3 1. Raspbian 2. Hassbian 3.

    Mossbian (Chinese) 4. Hass.io use this • HA UI • Ready to use (integrated 3rd part applications) • Easy to install and update (ResinOS and Docker) • Easy to extend by Hass.io add-ons (Goolge Assistant...) Home Assistant 0.70.0
  13. Home Assistant Cloud • Google Assistant (Google Home) • Amazon

    Alexa (Amazon Echo) https://www.home-assistant.io/cloud /
  14. Possible Scenario 34 Mi Home (China version) (gateway) text-based Google

    Assistant working on Hass.io Home Assistant Cloud $5 USD/month ? yicamera (hacked)
  15. • Smart Home ◦ No standard/universal communication way between smart

    things (so far) • Home assistant ◦ as a Developer ◦ as a User • Hassio • Home assistant cloud Take Home Messages
  16. Overview and tutorials • https://developers.home-assistant.io/ (Developer documentation) • https://www.home-assistant.io/cookbook/ (Cookbook)

    • https://www.home-assistant.io/getting-started/ • https://www.hachina.io/ (Chinese!) • https://home-assistant.cc (Another Chinese!) • https://zhuanlan.zhihu.com/c_138110024 知乎:智能家居从零开始( Home Assistant) • Xiaomi Smart Home Ecosystem list VIDEOS, TALKS, WORKSHOPS AND ALIKE • Paulus Schoutsen - Awaken your home: Python and the Internet of Things - PyCon 2016 • Automating your Home with Home Assistant: Python’s Answer to the Internet of Things Hassio • https://www.home-assistant.io/hassio/ • https://www.home-assistant.io/blog/2017/07/25/introducing-hassio/ Google Home • https://www.home-assistant.io/components/google_assistant/ (components/) • https://www.home-assistant.io/cloud/google_assistant/ (via HA cloud) • https://www.youtube.com/watch?v=NfyavpAg4as with google assistant Data Science with HA • https://github.com/robmarkcole/HASS-data-science Smart Home • 到底什麼是智慧音箱?為什麼亞馬遜、谷歌、蘋果都視其為後手機時代的決勝點? 智慧家庭實驗室 林祐祺 20180409 References