Smart Home Controller

Every day more and more devices are being added to the average home, these devices can help monitor and make life easier at home. They may monitor temperature, register activity, control lighting etc. But having multiple apps across multiple devices, some of which requires working internet, complicates the user and in turn the overall user experience.

A friend of mine, Steffen and myself started talking about a solution to all of this, a self-hosted hub/website that would connect all devices and allow for some degree of automation. At the time we looked around and couldn’t find a solution we liked or deemed mature enough, so we tried to make our own in the hopes we would learn something useful along the way.

Steffen focused on creating an event-based scripting language to be used for automation. And I started working on the server/hub, I choose C#/.NET for the language as it’s quick to develop in and relatively easy to maintain readable. For the UI, Angular 2 was used.

As the project pretty quickly gained basic functionality we needed some devices to control, but at the time none of the devices I had, had .NET SDKs (Sonos, KNX & Philips Hue). So I made open-source libraries for all of them, with most functionality used on an every-day basis. Out of all of them, KNX was properly the most challenging protocol to get working as it was a session-based bit/byte based UDP protocol, but after a while I got it working and a few people have even used it to my knowledge.

At this point, we had a working alpha/beta with the scripting language, basic house-setup, plugin-system and more, here’s a small demo of it I found in my archives, where it for the first time controls a Philips Hue Bulb:

Then .NET Core was announced and the first alpha/beta was released, and straight away I tried making the switch so I could start running the server on Linux as well. But given the early stages of .NET Core a lot of issues occurred, from loading DLLs at runtime was no longer possible (Which we used for our plugins) to the solution would not build consistently for no apparent reason. So the project stagnated for a while.

As the .NET Core issues slowly got solved with updates, the development continued for a while. But it became apparent that the solution would be too big to continue to develop for a two-person team, especially as device API’s changed often.

In the end, we managed to create a working solution, connecting multiple different devices, and looking back at it, our solution actually ended up pretty similar to another solution, which gained traction while we where developed our solution, OpenHAB, a Java-based home automation hub, with a similar web-interface and underlying data-structure, confirming to ourselves that some of our design choices weren’t too bad :-).

Leave a Reply

Your email address will not be published. Required fields are marked *