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

Exploring Your Smart Home Data

July 06, 2019

Exploring Your Smart Home Data

Sharine at Taichung. Py


July 06, 2019

More Decks by suci

Other Decks in Technology


  1. Lurking in PyHug, Taipei.py and various Meetup About Me 2

    Scrum Master + Data Engineer in a manufacturing company Working with • data and people Focus on • Agile/Engineering culture • Streaming process • IoT applications • Data visualization Shuhsi Lin sucitw gmail.com https://medium.com/@suci/
  2. • Smart home/home automation ◦ What makes home automation hard

    • Introduction of home-assistant ◦ Basic concept and Architecture • How to build your home automation system ◦ Environment setup/Configuration/Possible scenarios • Explore Your Data ◦ Data, libary, and examples • Summary What I Will Share Today 3
  3. • Hacking hardware • Basic configurations and use on Raspberry

    Pi • Compare ecosystems for Amazon Alexa/ Google home/ Apple HomePod/ Mi home ….. • Too many source code What I Will not Focus ( aka I don’t really know) 4
  4. • Explore Your Data ◦ Data, libary, and examples This

    is a new session Photo by Harm Weustink on Unsplash
  5. Home Control Home Automation Smart Home location and time-based events

    10 connect and control devices Photo by Samuel Zeller on Unsplash
  6. 11 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
  7. Home Automation Landscape 13 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
  8. •More IoT devices with different protocols •Many own apps •More

    data •More scenarios •Privacy and trust •Easy to use Challenges 14 https:/ /www.home-assistant.io/blog/2014/12/26/home-control-home-automation-and-the-smart-home/
  9. 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
  10. • Platforms (collection) ◦ Types of devices (ex, lights, sensors)

    • Integration/Components (> 1400) Responsible for a specific domain within Home Assistant. ◦ 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
  11. Home Automation Landscape 21 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
  12. Components Architecture 23 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.html ...
  13. 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
  14. Home Assistant Cloud • Google Assistant (Google Home) • Amazon

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

    Assistant working on Hass.io Home Assistant Cloud $5 USD/month yicamera (hacked)
  16. 大兵萊恩 一路直前 a. Home Assistant, (1) 系統安裝與簡單上手 (Internet of Things,

    Home Assistant) b. Home Assistant, (2) 遙控小米開關與條件式自動化 (Internet of Things, Home Assistant) c. Home Assistant, (3) 安裝 InfluxDB 與 Grafana 套件 (Internet of Things, Home Assistant) d. Home Assistant, (4) 安裝 Mosquitto 套件與建立 MQTT 開關 (Internet of Things, Home Assistant) More Step by Step!! • 新手上路 Home Assistant 中文文檔
  17. events Explore Your Data states services context state_changed automation_triggered script_started

    service_registered recorder_runs 1. Complete ownership of your personal data 2. Optimise automation SQL https://data.home-assistant.io/ event-driven!!
  18. events states services context state_id domain state attributes recorder_runs https://data.home-assistant.io/docs/data_states

    Entity States event_id last_changed last_updated created context_id context_user_id events states services context context_id user_id recorder_runs refresh_token_id not stored in their own table https://data.home-assistant.io/docs/data_context https://data.home-assistant.io/docs/data_recorder_runs run_id start end closed_incorrect created
  19. Getting started • User environment ◦ Hass.io user ◦ non-hass.io

    users ▪ Quick start on Ubuntu ▪ Docker • kylerw/hass-data-detective • Jupyter notebooks for Home Assistant ◦ DataExploration-1 and -2 • HASS-data-detective/notebooks • Sample data HASS Data Detective Home Assistant notebooks Explore Your Data More Possibilities • AI in smart home ◦ To learn when to switch on the lights in the living room
  20. • Smart Home ◦ No standard/universal communication way between smart

    things (so far) • Home assistant ◦ as a Developer ◦ as a User • Hassio ( + Raspberry Pi) • Home assistant cloud • Try it with blog tutorials • Play data from HA Take Home Messages
  21. 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://data.home-assistant.io/ Smart Home • 智慧家庭實驗室 林祐祺 References not HA, but python with IoT • Homekit with Python • IoT in Home – Building a Toilet Vacancy Indicator • ….