Getting a room sensor to send its first reading is one milestone. Keeping a houseful of battery-powered sensors reporting for months is another. In a project shared on Hackaday.io, Javier used a Raspberry Pi Zero, Node-RED, Bash and gatttool to read nine Xiaomi temperature and humidity sensors—and found that a working data connection wasn't the same thing as a sustainable monitoring system.
Created on December 15, 2021, the project started with a straightforward goal: buy inexpensive, battery-powered sensors, distribute them around the house and collect their readings in a database. Javier reported prices of roughly €5 from AliExpress or €10 from Xiaomi's store at the time. Node-RED also fit an existing setup that logged MQTT messages, making these sensors an addition to a familiar workflow rather than a reason to rebuild it.
Nine connections worked; a tenth did not
Javier decoded the BLE characteristic carrying temperature, humidity and battery voltage. In the December 15, 2021 log, he reported maintaining nine simultaneous BLE connections, enabling notifications and decoding the incoming payloads.
A tenth device would not connect through gatttool. Javier also described the radio as struggling when opening more than five connections. Those observations establish a limit for this particular setup, not a universal nine-sensor ceiling for Bluetooth or every Raspberry Pi.
The later logging tests were smaller. On January 17, 2022, Javier reported saving readings to InfluxDB and displaying them in Grafana, with two devices connected for 12 uninterrupted hours. The following day's update reported two days of working connections and emerging daily temperature and humidity patterns. The nine-device connection demonstration and the longer-running database test are separate results.
Cold weather exposed a decoding mistake
The sensors also supplied an effective test case for the software: temperatures below zero.
In the January 26 log, Javier identified a signed-number problem in the Node-RED JavaScript. Parsing a hexadecimal string with parseInt() didn't interpret the sensor's 16-bit two's-complement encoding as a negative number.
The posted correction checks bit 0x8000 after parsing. If that sign bit is set, it subtracts 0x10000, then divides the result by 100 to obtain the temperature. It's a small fix with a useful lesson: successful byte reception doesn't guarantee a correct measurement. A decoder can look fine throughout warm-weather testing and fail only when a value crosses zero.
The batteries set the harder limit
The decisive update arrived on February 10, 2022. Javier reported that the sensors had exhausted their coin cells after about a month of constant streaming. They stopped broadcasting one after another over roughly a week; only one remained working when he wrote the log.
Javier attributed the drain to maintaining open BLE connections and proposed two changes:
Neither remedy is shown as implemented in these logs. They are proposed ways to change the system's communication pattern, not demonstrated battery-life improvements.
The advertising approach had already surfaced in the discussion. Tom Nardi suggested Aaron Christophel's firmware, which he described as broadcasting readings without requiring a separate connection to each thermometer. Javier initially chose to keep experimenting with the factory firmware.
That leaves a more useful next test than simply adding a tenth sensor: compare periodic connected reads with advertising-based collection, measuring both battery life and missed readings. For this household logger, the important question became how little radio activity could still capture the daily patterns Javier wanted—not how much data the Pi could continuously receive.