Temperature Sensor Monitoring


After already having set up the database and Grafana panel in this blog post, I decided to also finally use my Sensirion Bluetooth low energy temperature and humidity sensors that were already in my room. The idea is to log the temperature and humidity into the database to create a Grafana dashboard where I can see the current values as well as trends over time.

Getting the Data

To acquire the data from the Bluetooth sensors I’m using a Python script that is running on a Raspberry Pi 3B and interfaces with it over Bluetooth and logs the data periodically to the timescale database roughly every 30s.


As already mentioned I’m using a Grafana dashboard to present the data which is pretty simple at the moment but could be easily extended to include things like long-term average temperatures and humidities. For now, it is used to show the current values as well as the historical data for a time range that the user can select.

Bluetooth Issues

The Bluetooth implementation on either the Raspberry Pi or the sensors themselves is not reliable and when trying to connect to the sensors the Bluetooth request are running into timeouts. There are two things in place at the moment to mitigate this issue. The first one is that I use a watchdog timer that will automatically restart the Bluetooth module on the Raspberry Pi if it runs into any issues. While this helps and can resolve some of the issues by itself, as a second measure I also set up Grafana alerts which notifies me with a Telegram message if no new data is being written to the database.
Update: The problem was solved by changing a line in the configuration file of the Raspberry Pi such that the bluetooth module is now managed by the kernel. This together with reseting the UART connection to the bluetooth module, when no value can be read, has solved the issues for now.


Even though this is not a very large project it still had its challenges and made me discover new Grafana features like alerts which I wouldn’t have used otherwise. Using measures that alert if things aren’t going smoothly are an important part of any live system.

Scroll to Top