For my home, I want a centralised abstracted event hub for connecting sensor/actor devices together, so I can separate “automation logic” from “interfacing code” – even better if the interfacing code is done for me!
Home Assistant handles this nicely.
Previously I’d been wiring things together in a very ad-hoc fashion. My “smart doorbell” had the logic to connect to Slack and SES to send me notifications, my cameras had similar logic replicated, et cetera. Event-handling and automation code lived on each device, and coordinating and managing it all was a pain.
Enter Home Assistant, which acts as a generalised abstraction layer and centralised event-bus between all the things.
You tell it about your devices (“components” – it has support for nearly a thousand), it provides you with a nice interface for manual control, and powerful but easy-to-write “automations” to hook everything together.
Here’s a snippet from a
configuration.yaml that defines two components, a pseudo-sensor that determines whether it’s a “work day” (e.g. a week day vs the weekend) and a TP-Link Smart Switch:
1 2 3 4 5 6 7 8 9
And here’s an automation that ensures the front lamp is automatically switched on, on work-days when my wife gets up to go catch a train:
1 2 3 4 5 6 7 8 9 10 11
You can group things for convenience:
1 2 3 4 5 6
You can compose scripts for more complex actions, like this one that saves me having to go downstairs when I inevitably forget to switch a light off:
1 2 3 4 5 6
and getting third-party devices to send events is fairly straight-forward (taken from an Ansible Jinja2 template):
1 2 3
It’s pretty straightforward to install and operate. I’m currently running it on a spare Raspberry Pi Zero W with my own install of their Python package and my configuration living in GitHub – they offer a convenient all-in-one image for the Raspberry Pi, but that doesn’t play nicely with my existing server management setup.
All-in-all, I’m really impressed – Home Assistant offers an excellent easy-to-operate platform for tying together “smart devices”, combining sensible and useful defaults with powerful yet simple opportunities for customisation.