- Raspberry Pi Rev 2+ with Raspbian / Raspberry Pi OS
- BME280 sensor wired via I²C (see Hardware)
- Python 3.10+
- I²C enabled on the Pi
# Enable I²C
sudo raspi-config # Interface Options → I2C → Enable
sudo rebootgit clone https://github.com/guillaumedelre/bme280.git
cd bme280
pip install -r requirements.txtcp .env.example .env
nano .env # fill in your MQTT broker detailsSee Configuration for the full list of available variables.
# Check the sensor is detected on the I²C bus
i2cdetect -y 1
# Address 0x77 (or 0x76) should appear
# Run a quick CLI read
python bme280.pyExpected output:
Chip ID : 96
Version : 0
Temperature : 21.55 °C
Pressure : 1005.16 hPa
Humidity : 44.57 %RH
python sensor_api.py
# Listening on http://0.0.0.0:5000