Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 989 Bytes

File metadata and controls

60 lines (44 loc) · 989 Bytes

📦 Installation

Prerequisites

  • 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 reboot

Clone & install

git clone https://github.com/guillaumedelre/bme280.git
cd bme280

pip install -r requirements.txt

Configure

cp .env.example .env
nano .env   # fill in your MQTT broker details

See Configuration for the full list of available variables.

Verify hardware

# 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.py

Expected output:

Chip ID  : 96
Version  : 0
Temperature : 21.55 °C
Pressure    : 1005.16 hPa
Humidity    : 44.57 %RH

Start the API

python sensor_api.py
# Listening on http://0.0.0.0:5000