This is the old README of this repository, kept here for reference. I'm no longer using Ansible to orchestrate my setup, nor do I have a lot of these auxillary systems installed. Instead, I use Home Assistant Operating System which makes it trivially easy to upgrade and manage Home Assistant and add-ons (such as Grafana).
Home-automation stack based on homeassistant, orchestrated through Ansible. This repository also contains ansible playbooks for auxillary systems such as Prometheus, Grafana, AppDaemon and more.
I maintain this purely for fun (favoring speed and exploration over quality and documentation). Consider this a reference/demo rather than a re-usable solution
Blogposts and write-ups:
- Details of my conference talk Creating the Ultimate Morning Routine at the 2020 Home Assistant Conference
- Blogpost: My Favorite Home Automations
- Blogpost: Window Opener project
- Blogpost: My Smart Sauna
- Details: Curtain Opener project
Main dashboard running on wall-mounted iPad (using AppDaemon HADashboard)
Screenshots | Hubs | Climate | Windows/Curtains | Lights | Switches | Voice Control | Security | Sensors | Media | Other Hardware | Software Integrations | Supporting Software | Retired General Notes Future Notes
The main interface is build in appdaemon (with some customizations) and displayed on wall-mounted iPad minis around the house (the first iPad has been continuously running for over 3 years without issues).
With the introduction of lovelace in home-assistant more recently, I'm evaluating whether to replace the appdaemon interface with lovelace.
Device | Homeassistant | Notes |
---|---|---|
Philips Hue Hub v2 | Philips Hue | Used to control all Philips Hue Light bulbs, switches |
Ikea Trådfri | Ikea Tradfri | Use the control all IKEA Trådfri light bulbs, switches, movement sensors |
HomeMatic HmIP-CCU3 | HomeMatic | HomeMatic control unit, used for smart radiator valves |
Aeotec Zwave Stick Gen5 | Zwave | Simple Z-wave controller in USB-stick form factor |
Device | Homeassistant | Notes |
---|---|---|
Nest Thermostat | Nest | Smart climate control |
HomeMatic HM-CC-RT-DN | HomeMatic | Smart Radiator valves. Allows me to control temperature for radiators upstairs where I have no separate thermostat and heating circuit. |
Device | Homeassistant | Notes |
---|---|---|
Custom Window Opener | ESPHome | A custom-build motorized widget to open our bedroom window. I wrote a lengthy blog-post about how I build it. |
Dooya Smart Curtain | ESPHome | Custom solution for smart curtains. Detailed Write-up |
Device | Homeassistant | Notes |
---|---|---|
Hue color bulb | Philips Hue | Color light bulbs |
Hue ambience bulb | Philips Hue | Ambience bulbs (=white spectrum only) |
Hue ambience spot | Philips Hue | Spot ambience lights, GU10 sockets used in Kitchen |
Hue dimmer switch | Philips Hue | Dimmer switch for nightstand lamps |
Trådfri ambience bulb | Ikea Trådfri | Movement sensors |
Trådfri ambience spot | Ikea Trådfri | |
Trådfri LED panel | Ikea Trådfri | Smart LED panel |
Trådfri motion sensor | Ikea Tradfri | Motion sensors, used to automatically control lights in hallway, pantry, toilet |
Trådfri remote control | Ikea Tradfri | Remote control, used to manually control lights |
Device | Homeassistant | Notes |
---|---|---|
TPLink HS100 | TP-Link | Automatic power switching of some devices: office standing lamp, bathroom mirror, christmas tree, etc. I do NOT recommend using TPLink smartplugs |
TPLink HS110 | TP-Link | Washing Machine and Dryer power monitoring (to detect whether they're running or not). I do NOT recommend using TPLink smartplugs |
Elgato Eve Power plug | NA - Apple Homekit only | Bluetooth smart plugs used to hard reset wifi routers every night at 4AM. I've found this solves many stability issues. Also really useful to power cycle network gear even when whole network is down. |
Device | Homeassistant | Notes |
---|---|---|
Amazon Echo dot (v2, v3) | Emulated Hue | Allows for alexa integration without exposing the stack to the internet. |
Amazon Polly | Amazon Polly | AWS Text-to-Speech engine. Allows the house to talk back (e.g. "Good Night!"). Cool? Yes. Nerdy? For sure. |
Device | Homeassistant | Notes |
---|---|---|
Nest Cam Indoor | Nest | Intelligent security camera (allows remote access remotely). I'm grandfathered into the Legacy Works With Nest API program. I'd probably not buy Nest Cams if I'd be starting today, instead opting for something with better local API access. |
Nest Cam IQ Indoor | Nest | 1080p video monitoring with 4K sensor (for digital zooming). |
Nest Cam Outdoor | Nest | Garden monitoring |
Nest Protect smoke detectors | Nest | Smart Smoke detectors |
Device | Homeassistant | Notes |
---|---|---|
Aeotec ZW100 MultiSensor | Zwave | Multi-sensor. Used to detect movement, temperature and humidity in bathroom |
Raspberry Pi 3B + Serial-to-USB cable | Sensor - DSMR | Energy monitoring using the Dutch DSMR energy monitoring protocol |
Desk-height | NA | Simple Arduino-based sensor to determine the current height of my standing desk using an ultrasonic sensor mounted underneath it. This info is then send over to my home server which does some simple processing in logstash and home-assistant to determine whether the desk is up or down. This is then used to calculate and show standing time statistics in grafana. |
Device | Homeassistant | Notes |
---|---|---|
Samsung SmartTV QE55Q70R | SamsungTV | Our main TV |
Samsung SmartTV UE48H6200AW | SamTV + shell_command | Older Smart TV that isn't supported by home-assistant out-of-the-box. I've usedSamTV to control it in the past. |
Sonos play 5, Gen 1 | Sonos | Main Living Room smart speaker. Older model |
Sonos Play 1 | Sonos | Bathroom smart speaker |
Sonos One | Sonos | TV Surround smart speakers - back units |
Sonos Play Base | Sonos | TV Surround smart speakers - front unit |
Sonos Move | Sonos | Portable smart speaker, usually docked in the Office but used in the garden during the summer |
AppleTV 4K | AppleTV | There are some issues with the Home-assistant AppleTV integration (pyatv in particular) thta will cause connected TVs to turn on semi-randomly that prevent me from properly integrating this. |
AppleTV | AppleTV | Attached to non-4K TV |
Playstation 4 | Sony Playstation 4 (Not used) | I don't (yet) use home-assistant's PS4 integration, but instead use a simple custom sensor to reliably detect whether the PS4 is active. |
Device | Notes |
---|---|
2011 Macbook Pro | Old laptop (2.7GHz dual-core i7, 8GB RAM) used for hosting the whole stack. While the machine can easily handle the load and has been running almost continuously for 4 years, I expect that at some point I'll replace it with something that is more suited for running 24x7 - I have some concerns about fire safety with the Macbook's built-in battery. |
iPad mini (Gen 2, Gen 4) | Wall Mounted control panels |
Linksys WRT1900AC | Main router and Wifi Access Point, running OpenWRT. I use this in combination with some cheap dumb switches from TP-Link and have an SSD hooked up to it for NAS over SMB. While the current setup works fine, I'd like to upgrade my network setup to something more prosumer (like Ubiquiti) but haven't come around to it. |
Raspberry Pi | Own a few different models used for various purposes. |
Quooker | Boiling water tap. Not a smart device, but still a very time-saving way to boil water for tea or cooking. |
AnyCubic i3 Mega S | 3D printer. Currently not integrated with home-assistant (although should be easy via OctoPrint). |
Software | Homeassistant | Notes |
---|---|---|
Homeassistant Mobile App (iOS) | Mobile App | Mobile application for home-assistant. |
Home Assistant Companion for macOS (beta) | Mobile App | Home assistant application for the mac. |
Slack | Slack | Used for sending notifications when certain events occur around the house. |
SleepCycle | via Philips Hue | Smart alarm mobile app that integrates with Philips Hue to create a wake-up light. |
Google Calendar | Google Calender Event | Display and notify on upcoming events (e.g. birthdays) |
Google Maps | Google Maps Travel Time | Display travel time to Office |
Buienradar.nl | Sensor - Buienradar Weather - Buienradar |
Local (Dutch) weather reporting and events |
Afvalwijzer.nl | HTTP (REST API) Sensor | Simple script to determine when the next trash pick date is (exposed as sensors in homeassistant). Scrapes the Dutch mijnafvalwijzer.nl once every 24 hours to determine this. |
System Monitoring | System monitor | System monitoring (CPU, memory, etc) |
Work Day | Workday | Determine whether any given day is a working day or not (weekend, holidays) based on location. |
Software | Description |
---|---|
HADashboard | Part of appdaemon that allows for easy creation of dashboards for Home Assistant that are intended to be wall mounted (optimized for distance viewing). |
Ubuntu 18.04 | Operating System. |
Docker | A good amount of software components run in containers, I use plain docker to manage them. I've considered using something like docker swarm or kubernetes for management/orchestration, but given that I only run containers on a single machine for now, I don't believe the overhead is worth it. |
Grafana | Visualization dashboard to display metrics stored in homeassistant and prometheus. |
Prometheus | Main monitoring platform that collects metrics on various components of my stack, and alerts when certain conditions are (not) met. |
Alert Manager | Default alerting solution for prometheus. |
Node Exporter | Widely popular linux system data exporter for prometheus. |
Process Exporter | Prometheus exporter to collect metrics on specific linux processes |
Blackbox Exporter | Prometheus exporter to collect metrics on external (blackbox) systems using network requests like ping, TCP connections, etc. |
Selenium | UI testing framework used as part of my sanity tests. Primarily used to periodically test that all dashboards are still loading correctly (if they're not, that's often an indicator of a bigger underlying issue). |
OpenWRT | Main AP/Router software. Not immediately related to home-automation but important supporting system. |
Ser2net | Simple way to expose a serial port to the network. I use this to expose a serial stream coming from a Raspberry PI connected to my smart electricity meter to homeassistant. |
Sanity tests | Small set of python tests that run every 5 min against the setup that check for some common problems and misconfigurations. These have been great to catch issues when I've made changes to the setup. |
prom2hass | Custom python script that fetches certain prometheus metrics or alerts and pushes them to homeassistant as sensors. Runs every 20 seconds. Allows for automatation of parts of the house based on monitoring conditions from prometheus. While there exist upstream supported integrations between homeassistant and prometheus, from my initial assessment they didn't seem to be a good fit. |
Seshat | Simple set of script(s) in typescript that aggregate some metrics from InfluxDB into more interesting statistics that I can display in grafana. These run every minute via a cronjob. |
roofcam | Simple custom python program to determine whether my flat roof has any water on it (which means the draining pipes are clogged up). Uses very simple image manipulations on screenshots to determine this. At some point I'd like to do something more advanced with ML, but the current script already is ~85% accurate on test data. Don't always have this program running. |
Backups | Set of scripts that do periodic backups of some personal data and copy the resulting tarballs over to a Samba/CIFS network share. Each backup script also has an accompanying monitoring script that periodically verifies whether the last backup was successful. |
Other gear is no longer integrated in the setup.
Hardware | Notes |
---|---|
Elgato Eve Window sensor | HomeKit only. Not currently using. |
Chromecast | We usually use our AppleTV(s) instead. |
Google Nest Home | We use our Echo Dot instead |
Sonoff Basic R2 | Wifi-enabled ESP8266 based remote relay |
Shelly 1 | Wifi-enabled ESP8266 based remote relay |
Deconz Conbee 2 | Universal Zigbee gateway (can replace IKEA/Hue hubs), had some challenges getting this to work and haven't spend more time |
Hue Tap Switch | Battery-free Philips Hue Switch. |
Software | Notes |
---|---|
node-sonos-http-api | HTTP API bridge for Sonos speakers. Filled some gaps in sonos features that HomeAssistant didn't support in the past. |
Monit | When I started out, I used Monit for simple monitoring but I quickly required more elaborate monitoring capabilities. |
Sensu | I migrated from Monit to Sensu for monitoring but over time that ended up consuming way too much CPU and memory which tended to slow my whole stack down. Currently on Prometheus. |
InfluxDB | Time series database used to persistently store sensor and monitoring data. Stopped using it because Prometheus is already providing everything I needed and InfluxDB was adding too much overhead, contributing to high CPU utilization. |
ELK | Log Aggregation, Search Indexing, web dashboard. Didn't use it a lot and uninstalled it because it required too much memory and CPU for my liking. |
- You might see some references to
casa-data
: this is a private repo I maintain that contains the actual data (encrypted) relevant to my home (usernames, passwords, secrets, IP addresses, etc). The roles and playbooks in this repo all use dummy defaults. - Since my family's mother tongue is Dutch, you'll see some Dutch language used here and there (mostly in the user-facing parts).
- I keep my setup disconnected from the Internet for security and privacy reasons. There are some exceptions (like some Nest devices I use), but those connect outward to the internet themselves - it's not possible to directly connect to any device from the Internet as everything runs in a private network.
- I have no idea how much time I've spend getting to this point, but I'm fairly certain it's a couple of hundreds of hours at least. Spread over about 4 years.
- I've never done a calculation of how much the current setup has cost me, but I'd roughly guess it's about ~3000 EUR. Note that it also highly depends on how you calculate things. Do you account for a (smart) TV? What about smart audio speakers? An old laptop that you had still lying around that you use as a server? Light bulbs you needed to buy anyways but you bought smartbulbs instead? etc.
- When I first started using home-assistant in 2016, things were in a very different state than they are today. This means I'd probably do things a bit differently if I'd start afresh today. So if you're looking at some code/config and wondering why I'm not using some out-of-the-box feature of home-assistant, changes are it didn't exist when I started out and I haven't come around to upgrading.
- If you're new to home-automation and want to do something similar to this, I recommend getting a Raspberry Pi (get the latest model with the most compute power) and installing HomeAssistant on it. Then get yourself a set of Philips Hue or Ikea Tradfri smart light bulbs and start playing!
There's always more to automate!
- Siding curtains (in-progress)
Automated window opening(✅done)- Window blinds (in addition to curtains, maybe?)
- Doorlocks
- Doorbell
- Sense Infuser?
- Garden irrigation
- Improved presence detection
- Improved voice commands
- Upgrade network gear
- Replace macbook server with something more suited (although it works well...)
- Only use zwave/zigbee (no WiFi) to interact with sensors
Ok, the title of this section is a lie. Like I've mentioned at the start of this README, I don't really expect this playbook to work for anyone but me. But if you ARE me, here's how you actually run this against your target hosts :-).
Note: I'm currently using Ansible 2.9.4. The playbooks are not compatible with older Ansible versions.
ansible-playbook -i ~/repos/casa-data/inventory/prod --tags node_exporter --limit controller home.yml
# Only run 'node_exporter' tag against target energy_tracker host
ansible-playbook -i ~/repos/casa-data/inventory/prod --tags node_exporter --limit energy* home.yml
In the past I did development locally on a VM using Vagrant, but with the amount of sensors and containers involved, that no longer works well. For reference though:
vagrant up
ansible-playbook home.yml -i inventory/vagrant
# roofcam only
ansible-playbook home.yml -i inventory/vagrant --tags roofcam
# using production data
ansible-playbook home.yml -i ~/repos/casa-data/inventory/prod