As often happens, new projects arise from practical problems… a chilly bedroom was mine.
I wanted a way to monitor temperature in the room and – depending on the time of the day – switch on or off the heater to keep the temperature as close as possible to the desired one.
While studying the problem and what solutions are available I realised that the vast majority of systems assumes the presence of a hub, a device which collects all the data, runs the programs for the automations and dialogue with the external world. The hub is the device you talk to when you want to switch on the oven while you are still in the gym.
I had a Raspberry Pi 3 which I did not use very much, so it was the ideal candidate to become the hub for my home automation. It turns out that to be a quite popular choice: cheap, readily available, plenty of accessories, runs on little power.
I found out that many platforms do exist, some of them linked to a specific brand, some looking at cross-platform use (like ‘IFTTT’) and others interestingly talking about open-source hardware (like ‘Home assistant’ and ‘OpenHub’). Personally, I loved the idea of open-source hardware!
After a little research I opted for ‘Home Assistant‘. You can have it running in a virtual environment on your Raspberry (which was running on Raspbian) or – as I did for peace of mind – install hass.io, a dedicated OS.
Cool! Now I had a very smart hub, but my plugs were as dull as they come and temperature could not be measured. Little improvement so far…
I needed a ‘smart plug’ and the choice fell on this:
a simple one, which contains the ESP8266 – you will hear a great deal about this module – and was object of a nice project of reverse engineering by Nathan Chantrell (which I would like to try soon!). For the moment I have been using its original firmware which support IFTTT, which in turn works with Home Assistant (from what I could see with IoT you are often caught in this mechanism of Chinese boxes).
Now I needed a sensor to monitor the temperature. First I looked from ready-made stuff – slightly unadventurous I know, but I was freezing – and I found that it was costly and often came with its proprietary untouchable software.
So I went on to read others’ experience and decided to build my own sensor! A sensor which could communicate with Home Assistant using MQTT, a protocol particularly suited for IoT applications.
How I did and how did it go?