/home-assistant-config

๐Ÿก Home Assistant configuration to manage ๐Ÿšจ security, โšก energy, ๐ŸŒก heating, ๐Ÿ’ก lighting, ๐Ÿ‘‹ occupancy, ๐Ÿ‘ window decoration and ๐Ÿ”Š multi-room audio

Primary LanguagePythonMIT LicenseMIT

๐Ÿก Gabriel's homeOS

My smart home built on a Raspberry Pi 4 Model B (4GB) running Home Assistant OS, with a connected ConBee II.

Overview

๐Ÿšจ Home Security | ๐Ÿ“ฑ Mobile control | ๐Ÿ’ก Smart adaptive lighting | ๐Ÿ‘‹ Motion & occupancy sensing | ๐Ÿ‘ Smart curtains & blinds | โšก Energy & solar monitoring | ๐ŸŒก Smart heating & cooling | ๐Ÿ”Š Multi-room audio | ๐ŸŽ› Local control

Hero-combined

Foundation

  • ๐Ÿšจ Home is secured using a combination of Aqara contact sensors, Sonos speakers and HomeKit Secure Video
  • ๐Ÿ“ฑ Most everything is controlled in the Apple Home app through HomeKit, and managed through Home Assistant Lovelace
  • ๐Ÿ’ก All lights adapt throughout the day and are color or warm/white Zigbee bulbs by IKEA or Signify
  • ๐Ÿ‘‹ Every room contains Hue, Aqara or IKEA motion sensor(s) for occupancy and controlling lights
  • ๐Ÿ‘ Window covers are automated using SwitchBots and IKEA roller blinds
  • โšก Energy and solar are monitored by a Homewizard Energy P1 meter and Solar Inverter (SEMS)
  • ๐ŸŒก Heating is controlled by Aqara and Sonoff temperature sensors in combination with Tuya devices and Sonoff relays behind electric radiators
  • ๐Ÿ”Š Multi-room audio is realized using Sonos (& Sonos+IKEA) speakers
  • ๐ŸŽ› Every room (save a few exceptions) contain physical Hue or IKEA Zigbee switches to manually control the lights

Miscellaneous

  • ๐Ÿ“บ Android TV and Apple TV can be controlled through Lovelace or HomeKit
  • ๐ŸŽฎ Game consoles can be controlled through Lovelace or HomeKit
  • ๐Ÿงบ Washer state is monitored using SmartThings in Lovelace and notified in HomeKit through a lock entity
  • ๐Ÿ’จ Air purification is done using a Smartmi purifier controlled through Lovelace (via helpers) or HomeKit (directly)
  • ๐Ÿ–จ๏ธ HP Printer & ink state is monitored in Lovelace

Technical

Software

Hardware

Raspberry Pi 4B ConBee II Synology DS718+ Philips Hue Bridge v2 Hue HDMI Sync Box SwitchBot Hub Mini Apple TV 4K
RaspberryRaspberry USBUSB NASNAS HubHub HDMIHDMI SwitchSwitch Apple TVApple TV
Runs Home Assistant OS and it's add-ons like SSH and SMB from a Kingston A400 SSD USB-gateway connected through a USB2.0 Extension cable to connect all my Zigbee nodes. Stores SMB backups and contains a Homebridge instance for devices Home Assistant doesn't support. In use to control the entertainment area in conjuction with the HDMI Sync Box and OTAU Hue devices. In use for the Ambilight behind the tv and the rest of the entertainment area in conjuction with the Hue Bridge. In use to connect to SwitchBot Curtains, runs through HomeBridge to Home Assistant. In use as HomeKit Home Hubs to run location automations and control the Home app when away.

Icons by Icons8

Implementation

In general, whenever I built something in Home Assistant it uses the following structure: an Automation to control a Switch, which triggers a Script(s). Major exceptions to this rule are:

  • deCONZ devices, which are controlled directly with Automations by listening for events,
  • Motion sensors, which are controlled by an Automation per sensor
  • Notifications, which listen for state changes and calls the Notify service

Home States

Globally, my Home Assistant config follows a State path during the day, which controls how certain Automations, and thus Switches and Scripts run: โ›…๏ธ Morning โ‡ข โ˜€๏ธ Day โ‡ข ๐ŸŒœ Evening โ‡ข ๐ŸŒ‘ Night

Each Home State is controlled by a Switch and corresponding Input Select, which run Scripts in the background. All of these either run automatically through Automations, or can be called through a Home app or a physical controller. Roughly, the corresponding actions are as following:

  • โ›…๏ธ Morning turns off outside lights, and opens all the blinds except the bedroom
  • โ˜€๏ธ Day ensures the Home Occupancy is set, opens all curtains and runs certain bedroom automations
  • ๐ŸŒœ Evening turns on outside and living room lights, and closes all curtains
  • ๐ŸŒ‘ Night ensures the Sleeping Occupancy is set and turns off lights & devices

Home State Occupancy

While Home States are mostly based on time and/or sun-position, I've also created Home State Occupancy as an additional variable based on location data. Similarly, these are controlled by Switches and an Input Select, which runs Scripts. Some of these, like Away and On vacation run automatically through Automations. Others, like Sleeping need to specifically be called, either through a Home app or physical controller. The following occupancy state transitions are possible:

  • ๐Ÿ  Home โ‡ข ๐Ÿ’ค Sleeping turns security on, dims lights, adjusts heating and runs certain bedroom automations
  • ๐Ÿ  Home โ‡ข ๐Ÿ“ Away turns security on, turns off lights & devices and lowers heating
  • ๐Ÿ“ Away โ‡ข โ›ฑ๏ธ On vacation ensures Home State automations will run as if someone's home
  • ๐Ÿ’ค Sleeping | ๐Ÿ“ Away | โ›ฑ๏ธ On vacation โ‡ข ๐Ÿ  Home turns security off, adapts lights and turns on heating

Modes

Additionally, there are a couple of Modes which can be manually turned on depending on the situation. Turning them off runs the corresponding script actions of the currect Home State to ensure a smooth transition back to the status quo.

  • ๐Ÿฟ Cinema Mode ensures the ideal movie watching experience, by turning on the tv, closing the curtains and turning off or dimming certain lights
  • ๐ŸŽ‰ Party Mode ensures no automations are run that interfere with guests, like curtains opening, alarms triggering or lights dimming
  • ๐Ÿ‘€ Privacy Mode ensures the living room is secured against prying eyes from outside, by closing the curtains, dimming lights, disabling camera's and playing music