BlogThe Home Automation Saga

The following errors were encountered: Please rectify them and try again.

Home Automation UIHome Automation UI

Since my posts heading in to the world of home automation I've gone on a bit of a saga. I've abandoned Home Assistant, as I wasn't happy with the way it functioned; I found creating rules for it far too obtuse if you wanted to do anything more than turn things on and off based on a single event. My response to this was, of course, to write my own software for it.

The idea behind my implementation is to simply be able to set rules up through a GUI. There are 3 main parts to it: the core backend, the web interface, and the components. It is currently in active development, and by no means complete, but functions enough to have fully replaced Home Assistant for my needs.

The backend is written in C# (Mono compatible) and uses a simple message bus system to allow each object to communicate. It has triggers which contain a set of conditions and will either match against all of them or any of them. When the conditions for the trigger is met, it then performs an action on a device (currently only switches). Conditions can be set up to compare against time, numbers, or words.

The backend can also dynamically load any components that adhere to a certain interface. I have written components for time and "solar events", as well as an InfluxDB component to log sensor readings and switches. I also intend to move the MQTT functionality that's baked in to the backend in to a component, and am wondering whether I should move the time component back in to the main program. The idea behind all this is to be highly customisable.

The web interface is solely written in JavaScript (AngularJS), HTML, and CSS. It uses websockets to communicate with the backend. This allows instant updating of any sensors or switches. It uses a responsive UI to adapt to phone and desktop screens. The UI could easily be rewritten by someone with actual design skills and it would have no impact on the backend at all. Here are some screenshots:

HomepageHomepage

Here is the main homepage. You can see that there are groups of switches and sensors. If there are switches in a group there are buttons to turn them all on and off.

Device ListDevice List

Here is where you add and remove devices and groups, as well as adding devices to said groups.

Device List part 2Device List part 2

Further down the page is the ability to remove devices from groups

ActionsActions

Here is where you set up your actions (or triggers). The list on the left is existing ones, where you can remove them. The controls on the right allow you to input a set of conditions and set the action to take upon their completion. Currently you type the message topic which you want to compare against, however I plan to make that a dropdown list of available topics. You can select devices, as well as their available actions, from a dropdown list to use when the trigger is fired.

SettingsSettings

This is the settings screen. I want to make a way for components to add their own settings to this.

So as you can see there's a lot of work left, however it's only been 5 months in the making in my spare time so progress is slow. And despite being written in C#, it's fully Linux compatible as that what I run it on. As for the heating, which is a core focus of home automation for me, I've got that working by strapping a servo to the front of the boiler controlled by an ESP-12F:

Servo strapped to boilerServo strapped to boiler

Posted on Saturday the 30th of September 2017