Skip to content

Commit 937a282

Browse files
azoguefabaff
authored andcommitted
add BME280 sensor platform doc (home-assistant#2797)
* add BME280 sensor platform doc * little fix * yaml identifier * review changes * review fixes
1 parent 504b48d commit 937a282

File tree

1 file changed

+143
-0
lines changed

1 file changed

+143
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
layout: page
3+
title: "BME280 Sensor"
4+
description: "Instructions how to integrate a BME280 sensor in a Raspberry PI into Home Assistant."
5+
date: 2017-06-10 00:00
6+
sidebar: true
7+
comments: false
8+
sharing: true
9+
footer: true
10+
logo: raspberry-pi.png
11+
ha_category: Sensor
12+
ha_release: 0.47
13+
ha_iot_class: "Local Push"
14+
---
15+
16+
17+
The `bme280` sensor platform allows you to read temperature, humidity and pressure values of a [Bosch BME280 Environmental sensor](https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf) connected via [I2c](https://en.wikipedia.org/wiki/I²C) bus (SDA, SCL pins) to your [Raspberry Pi](https://www.raspberrypi.org/). It allows you to use all the operation modes of the sensor described in its datasheet.
18+
19+
To use your BME280 sensor in your installation, add the following to your `configuration.yaml` file:
20+
21+
```yaml
22+
# Example configuration.yaml entry
23+
sensor:
24+
- platform: bme280
25+
```
26+
27+
Or, if you want to specify the working mode of the digital sensor or need to change the default I2c address (which is 0x76), add more details to the yaml config:
28+
29+
```yaml
30+
# Example of customized configuration.yaml entry
31+
sensor:
32+
- platform: bme280
33+
name: Ambient
34+
i2c_address: 0x77
35+
operation_mode: 2 # forced mode
36+
time_standby: 5
37+
oversampling_temperature: 4
38+
oversampling_pressure: 4
39+
oversampling_humidity: 4
40+
delta_temperature: -0.5
41+
monitored_conditions:
42+
- temperature
43+
- humidity
44+
- pressure
45+
scan_interval: 40
46+
```
47+
48+
This sensor is somehow famous for generating relatively high temperature measurements compared to other sensors (it looks like self-heating does not feel good for some encapsulations). If you experience this problem, you can define an absolute delta of temperature correction using a negative number.
49+
50+
Configuration variables:
51+
52+
- **name** (*Optional*): The name of the sensor
53+
- **i2c_address** (*Optional*): I2c address of the sensor. It is 0x76 or 0x77.
54+
- **i2c_bus** (*Optional*): I2c bus where the sensor is. Defaults to 1, for Raspberry Pi 2 and 3.
55+
- **operation_mode** (*Optional*): Power mode for the sensor. Use 2 for forced mode or 3 for normal mode. Defaults to normal mode.
56+
- **time_standby** (*Optional*): Standby time in ms for normal mode of operation as described in the sensor datasheet. Defaults to 5 ms.
57+
- **oversampling_temperature** (*Optional*): Oversampling multiplier as described in the sensor datasheet. Can be 0 (no sampling), 1, 2, 4, 8, or 16. Default is 1.
58+
- **oversampling_pressure** (*Optional*): Oversampling multiplier as described in the sensor datasheet. Can be 0 (no sampling), 1, 2, 4, 8, or 16. Default is 1.
59+
- **oversampling_humidity** (*Optional*): Oversampling multiplier as described in the sensor datasheet. Can be 0 (no sampling), 1, 2, 4, 8, or 16. Default is 1.
60+
- **filter_mode** (*Optional*): IIR filter coeficient as described in the sensor datasheet. Default is 0, for filter off.
61+
- **delta_temperature** (*Optional*): Absolute delta for temperature correction.
62+
- **monitored_conditions** array (*Optional*): Conditions to monitor. Available conditions are *temperature*, *humidity* and *pressure*. By default all three are displayed.
63+
64+
#### Customizing the sensor data
65+
66+
**Give the values friendly names & icons**
67+
68+
Add the following to your `customize`
69+
70+
```yaml
71+
# Example configuration.yaml entry
72+
customize:
73+
sensor.ambient_temperature:
74+
icon: mdi:thermometer
75+
friendly_name: "Temperature"
76+
sensor.ambient_humidity:
77+
icon: mdi:weather-rainy
78+
friendly_name: "Humidity"
79+
sensor.ambient_pressure:
80+
icon: mdi:gauge
81+
friendly_name: "Pressure"
82+
```
83+
84+
**Create a group**
85+
86+
Add the following to your `groups`
87+
88+
```yaml
89+
# Example configuration.yaml entry
90+
group:
91+
ambient_sensor:
92+
name: BME280 Environment sensor
93+
entities:
94+
- sensor.ambient_temperature
95+
- sensor.ambient_humidity
96+
- sensor.ambient_pressure
97+
```
98+
99+
100+
### Directions for installing smbus support on Raspberry Pi:
101+
102+
Enable I2c interface with the Raspberry Pi config utility:
103+
```bash
104+
# pi user environment: Enable i2c interface
105+
sudo raspi-config
106+
```
107+
Select `Interfacing options->I2C` choose `<Yes>` and hit `Enter`, then go to `Finish` and you'll be prompted to reboot.
108+
109+
Install dependencies for use the `smbus-cffi` module and enable your _homeassistant_ user to join the _i2c_ group:
110+
```bash
111+
# pi user environment: Install i2c dependencies and utilities
112+
sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev
113+
114+
# pi user environment: Add homeassistant user to the i2c group
115+
sudo addgroup homeassistant i2c
116+
117+
# pi user environment: Reboot Raspberry Pi to apply changes
118+
sudo reboot
119+
```
120+
121+
###### Check the i2c address of the sensor
122+
123+
After installing `i2c-tools`, a new utility is available to scan the addresses of the connected sensors:
124+
125+
```bash
126+
/usr/sbin/i2cdetect -y 1
127+
```
128+
129+
It will output a table like this:
130+
131+
```text
132+
0 1 2 3 4 5 6 7 8 9 a b c d e f
133+
00: -- -- -- -- -- -- -- -- -- -- -- -- --
134+
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
135+
20: -- -- -- 23 -- -- -- -- -- -- -- -- -- -- -- --
136+
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
137+
40: 40 -- -- -- -- -- UU -- -- -- -- -- -- -- -- --
138+
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
139+
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
140+
70: -- -- -- -- -- -- -- 77
141+
```
142+
143+
So you can see the sensor address what you are looking for is **0x77** (there are more i2c sensors in that Raspberry Pi).

0 commit comments

Comments
 (0)