This is an extension for the MagicMirror². It monitors temperature, humidity and air pressure from BME-280 sensor.
- Navigate into your MagicMirror's
modulesfolder - Clone repository
git clone https://github.com/awitwicki/MMM-BME280 - Go to newly created directory (
cd MMM-BME280) - Execute
npm installto install the node dependencies. - Connect the BME280 to your Raspberry Pi
Add it to the modules array in the config/config.js file:
modules: [
...
{
module: 'MMM-BME280',
position: 'top_left',
config: {
updateInterval: 5 //seconds
}
},
...
]Configurations properties
| Property | Description |
|---|---|
titleText |
Widget title text
Type: string
Default: Home weather
|
updateInterval |
Wait interval between readings of BME280 sensor values in seconds
Type: int
Default: 100
|
deviceAddress |
BME280 I2C address, default is 0x76
Type: hex string
Default: "0x76"
|
temperatureScaleType |
Different temperature scales
Type: int
Default: 0
Scale types: 0 Celsius, 1 Fahrenheit
|
pressureScaleType |
Different pressure scales
Type: int
Default: 0
Scale types: 0 hPa, 1 inHg
|
For more details about BCM pin numbers check here
python3(should be installed on Raspberry Pi)smbus(Python library, install viapip3 install smbus)
- Navigate into your
MagicMirror/modules/MMM-BME280folder - Run script
python3 bme280.py <"optional I2C address">- If you get
FileNotFoundError: [Errno 2] No such file or directoryyou habe to enable i2c interface (raspi-config nonint do_i2c 0) - If script prints
OSError: [Errno 121] Remote I/O errorthen you are using wrong I2C address. Try to runi2cdetect -y 1console command to find out your device address.
- If you get
- Script should print sensor values like this
24.7 38.3 996.6- that meanstemperature humidity pressure- If you only see
0 0 0make sure you are not setting the PINs you are using in another program.
- If you only see
Using the BME280 I2C Temperature and Pressure Sensor in Python

