Having searched for a long time we bought and renovated a house end of 2013. As we were on a budget, parental leave and blessed with supporting family members we did a lot of stuff ourself. In total we had a bit more than three month between getting keys and moving in.
When planning and execution hits a narrow timewindow there are a lot of decision to make. Along with all the ‘traditional ones’ (renew central heating, introduce floor heating, tear down 3 walls, rebuild some others, pick wall colors, choose sanitary objects, flooring, nurse, the newborn….) - I decided to have a Not-So-Smart home.
I bought a plain doorbell (I still regret that choice) and when adding auto shutters to the windowsI put individual auto timers next to each one. This way i wouldn’t run into “darling, while you’re on a business trip the impact of the change you made yesterday keeps us from having sun light in the house” situation.
Same again two years later when we redid the garden - a friend told to take care about water extensions for automated watering. ‘Rich guys toys’ I thought and skipped that part. Another moment for regret when two years later trying to beat water piplines throught the ground under the new walkways.. Because - once you’re done with the basics you start with the extras. Still beeing far from rich I do have automated watering meanwhile (Hunter stuff operated by Raspberry) and the amazing world of IOT generates an itching “to do a bit more”.
In this blog I’m going to describe a bit of what I did / considered or might look into in the future.
The ‘architecture’ in 2017
Keep in mind that the aim was to play with new technologies and cool stuff - so I’ll willingly admit that the functionallity provided hardly justifies the efforts spend. But isn’t that a core element of hobbies - while you enjoy doing things time flies by?
Docker containers - self documenting functionallity packs
So, I started off with a small set of docker images. I had replaced my old raspberry with a USB 3.0 capable ODROID XU4 and had booked (mainly because it was a special offer :-) a 6GB RAM, 320GB disk, dual core debian KVM image hosted ‘in the cloud’ at NetCup.de I really liked the easy of getting into Docker ( I don’t pretend understanding all concepts, e.g. I don’t make use of any swarm feature as of now). I liked the idea of a selfdocumented container that I can build and start from git on either machine. I under estimated the efforts involved in creating Dockerfiles (more than some samples) - and the number of available builds for ARM. On the other hand, roughly knowing the content of your Dockerfiles isn’t bad from a security standpoint, i guess.
TODO: Link: Port knocking
TODO: Test: Did Docker make my live easier when rebuilding my server?
MQTT - connecting devices
Now, I must admit that I’m a slow adaptor. I tend to reuse concepts that I’ve used before, so it took a bit of discussion with a colleague to get started with MQTT. By now, I really like the ease of publishing an event as well as the ability to have multiple subscribers. I’m amazed how robust the combination of 7€ ESP8266 (TODO: Link) and MQTT runs - the one in my garden is up and running for 5 month 24/7 without a single manual reboot.
Keep a history - mariadb
Maybe the slow adaptor again. I started my temp messurements with RRD (time optimized database), but after using that for a while I switched back to mariadb. I just feel it provides higher flexibility to me and allows better control of my data. Belly rulez, once in a while. When you have sensors like the waterflow sensors in the garden (sending an update every 30 secs) - you want to consolidate and condense your data. I have 24h of full data averaging temperature on hourly MIN/MAX/AVG. Water consumption is good enough per day, I decided.
As of now I finished the infrastructure for data collection mainly, including things like backing up data (e.g. Dockerfiles to git, mysql dump to NAS, ..). The next step (until I loose interest in the game) might be to increase sensors, e.g. motion detection and window alarms. Once that data is available, more options for actors come into play. As of now the warmwater circulation and the HIFI receiver (Crappy Pioneer telnet interface TODO: Link) as well as the garden watering are the main actions derivated from sensor data.
Looking at GUI frameworks
I’m not a big fan of frameworks. There is always suprises (Docker, AdminLTE bootstrap template, beautiful-jekyll, ..), but quite often I find that good looking, easy stuff tends to eat your nights once you have a certain idea of what you want. Before ending up with the current architecture I played with:
- iobroker / vis / CCU.io
- native php
- js highcharts (still like & use that)
- wordpress (long ago)
Especially the GUI part of those looked pretty cool & easy, but didn’t keep me excited. Sometimes it was response time from charts, another time I didn’t manage to get a ‘log output’ type of screen up and running within a long afternoon. Again - might be me, not the frameworks, but you should pick your friends, i guess.
Flask Bootstrap was tough in the beginning. It was (again) recommended to me and while i liked the base concept I didn’t really get into it quickly. During xmas vacation I had enough playtime to reach the first summit - and from there one the decision was made. Interessting enough - similar to the Jekyll Theme I violated the ‘not a fan of framework’ rule. I found it much easier to discard & change the theme a couple of times than to adept one to my ideas. AdminLTE (bootstrap) and beautiful-jekyll (this blog) look like mates as of now.
Having a background as J2EE developer I’m really amazed how easy & standardized development of responsive websites is. Stuff just works on my mobile, too.