The Hive Project

Reading Time: 2 minutes

As I said in my previous post, I got a bit of a bee in my bonnet about Hive – pun fully intended. Some of it was the unreliability, a lot of it was this issue of not having a simple way to turn the heating off if the house was empty. They gave you some ill thought out fudge of a solution but the whole thing annoyed me.

Cue my journey into Python.

Using a Raspberry Pi and the unofficial Hive API hack I built a little server at home running Flask and Python. A little bit of Bootstrap, a lot of hacking of other people’s code, and I had a working occupancy detection system running that I was actually pretty pleased with.

In the image above you can see my first stab at a dashboard. The important part is down in the bottom left. The 4 tiles are the initials of the 4 occupants of the house. The 2 red tiles show that 2 people are out. The 2 green tiles show that 2 people are in. This used Bluetooth on the Pi to sniff for the Bluetooth MAC addresses of the phones for each occupant. I had it set so that if everyone was out then then heating would be at 16 degrees. If anyone returned home then it would set it to 18 degrees.

This dashboard grew and included controls for the lights around the house and views to show security cameras.

By the time I was finished I’d more or less made up my mind to move away from Hive and had started to buy IKEA Tradfri bulbs. I also wrote these into the dashboard, something I got a letter published for in the Raspberry Pi magazine. But my adventure with Python was starting to become obsolete. I’d gone from knowing nothing whatsoever about Python to knowing enough to write a whole system to control my heating and lighting with a pretty robust occupancy detection system in a few months.

Time to move on…