I've been having some temperature problems in my house, so I wanted to set up some thermometers which I could read from a computer, and look at trends.
I bought a pack of three cheap Xiaomi IoT thermometers. There's some official Xiaomi tooling to access them from smartphones and suchlike, but I wanted something more open. The thermometers have some rudimentary security on them to try and ensure you use the official tooling. This is pretty weak, and the open-source Home Assistant (HA) has support for querying them. I wasn't already running HA and it looked to do more than I needed right now.
A friend told me that it was trivial to write custom firmware to the devices. It's so easy you can do it from a web-based flasher: in fact, anyone in range can. There's a family of custom firmwares out there, and most move the sensors readings into the BTLE announce packets, meaning, you can scrape the temperature by simply reading and decoding the announcement packets, no need to handshake at all, and certainly no need to navigate Xiaomi's weird security. This is the one I used.
Next, I needed to set up somewhere to write the values.
It's been long enough since I last looked at something like this that the best in class software was things like multi router traffic grapher, and rrdtool, or things that build on top of them like Munin. The world seems to have moved on (rightly or wrongly) with a cornucopia of options like Prometheus, Grafana, Graphite/Carbon, InfluxDB, statsd, etc.
I ruled most of these out as being too complex for what I want to do, and got
something working with Graphite (front-end) and Carbon (back-end). I was
surprised that this wasn't packaged in Debian, and opted to try the Docker
container. This works, although even that is more complex than I need: it's
carbon, but also
statsd too; I'm submitting
statsd entirely. So as I refine what I'm
doing I might possibly strip that back.
I might add more sensors in my house! My scripts also need a lot of tidying up. But, I think it would be useful to add some external temperature data, such as something from a Weather service. I am also considering pulling in some of the sensor data from the Newcastle University Urban Observatory, which is something I looked at a while ago for my PhD but didn't ultimately end up using. There are several temperature sensors nearby, but they seem to operate relatively sporadically.
There's a load of other interesting sensors in my vicinity, such as air quality monitors.
I'm currently ignoring the humidity data from the sensors but I should collect that too.
It would be useful to mark relevant "events", too: does switching on or off my desktop PC, or printer, etc. correlate to a jump in temperature?
- I might get rid of that in the future as I refine my approach↩