I’ve been working on software to automate my home, and I thought I’d share it with anyone who’s interested.
The design is based upon a number of microservices, each providing state and controlling specific things. I used the awesome mqtt-bridge to enable access to devices on the SmartThings hub. I wrote several other similar microservices to control harmony hub, autelis pool controller, direct control of LGTVs (WebOS), a TVGuide service for fetching guide and channel info for various cable/satellite providers, Sony Bravia TVs, Nest Thermostat, TiVo DVR/Minis, and your local Weather.
The microservices report status via MQTT and you send MQTT topic/messages to them to control the associated devices (where it makes sense).
The microservices are dockerized and available already built via DockerHub.
Once you have the microservices running, you can set up cron jobs or use command line to send MQTT messages to control your devices. But that’s hardly the best of it.
The UI is done with ReactJS. The client communicates with the microservices directly via MQTT protocol, no need for a server in the middle to do that. The HTTP server is NodeJS/Express and basically only compiles the ES6/JSX for React and serves the HTML/CSS/JS and static assets.
I’ve implemented a rules engine/microservice that controls my outdoor lights - turns them on at sunset and off at sunrise. The sunrise and sunset times are retrieved with the Weather information via the Weather Microservice.
I’ve also implemented a Macro microservice that allows you to design scenes or commands that can be triggered by rule or cron job or command line or from a button in the UI.
The UI features multiple dashboards that are tiles based. You may want to hang a few tablets on the wall and mobile phones, too. I found a pay-as-you-go android phone for $29 that I keep on my nightstand. You might want one dashboard with display and controls appropriate for your home theater room and a very different one for your bedroom and one with just one or two buttons for a phone you mount on the wall near your normal switches.
The original goal was to implement a system that does not rely on the cloud. Unfortunately, this may not be entirely possible since Nest and SmartThings and Alexa and Harmony all require some interaction with the cloud.
I created a GitHub organization to host it all:
A detailed README with some nice screenshots available in the client repo:
I am happy to have anyone contribute to the project, become a contributor, etc. Just open an issue at the main repo in the 2nd link above.
This is a long term project that is only going to get better and better.
The current configuration requires editing a single JS file for the client, where you define the tiles for the dashboards, identify your TVs and other devices, and so on. The microservices use ENV variables for configuration, which can be trivially passed in on the command line.
I’ve been working on a brand new Setup program to have a UI to configure it all, including the microservices.
If you want to see how to write code to interact with the various devices and APIs, the microservice sources are a good place to start. If you only need to use a microservice or hack on it for different use, go for it.
I have one of those Aeotec USB sticks that I intend to create a microservice to support.
Alexa integration is in the plans.
This is the RoboDomo dashboard screen on iPad. There are two dashboards
defined with tabs at the top to select between the two. You might hang an iPad or
other tablet on the wall and have this screen showing 99% of the time. Everything
you care about at a glance.
More screenshots here: