Plain Python with a dash of Flask, HTML and SystemD.
To make a script/application that can:
- Interface with a BME280 sensor via I2C.
- Record and display data.
/
├── bme280-dashboard.service (the service that starts the script on pi boot)
├── bme280dashboard.py (the script that does everything)
- Must be accessible over a network.
- Must have a high uptime.
- Must have a rolling average of readings.
- Must have a rolling minimum and maximum reading.
pip3 install RPI.BME280
I put the SystemD service in:
/etc/systemd/system
The reason I chose a Raspberry Pi was because I had one spare and at the time I was very familiar with the ecosystem. Additionally I knew I could easily set up the scripts and automation without having to download too many external libraries.
I chose python because it perfectly fit my use case:
- It could interface with the sensor via I2C.
- Could do the file I/O.
- Could do the networking I needed.
I chose to output to a CSV because I had planned to use other python libraries to do more in depth graphing and data analysis. It was also what I had the most experience in. This logic is also why I limited the HTML graph to 3 days worth of data.
I made the decision early on to only record the temperature every 10 minutes. This is because I didn't need precise to the second measurements. I also didn't want to burn out an SD card doing file I/O every second.
I would like to add a current reading field for ease of use and readability.
At some point I would like to move to a BME680 for the air quality reading.
I would like to move to a different BME280 library as this one hasn't been updated since 2020. Not that BMEs are getting wild updates I just like being up to date.
This project has been a great gateway into HomeLabs and networking. I'm considering setup Home Assistant at some point to handle this a lot more nicely.