BME680 Sensor


The bme680 sensor platform allows you to read temperature, humidity, pressure and gas resistance values of a Bosch BME680 Environmental sensor connected via an I2C bus (SDA, SCL pins). It allows you to use all the operation modes of the sensor described in its datasheet. In addition, it includes a basic air quality calculation that uses gas resistance and humidity measurements to calculate a percentage based air quality measurement.

Tested devices:

To use your BME680 sensor in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
sensor:
  - platform: bme680

Configuration Variables

name

(string)(Optional)The name of the sensor

Default value: BME680 Sensor

i2c_bus

(int)(Optional)I2C bus that the sensor is connected to.

Default value: 1

i2c_address

(int)(Optional)I2C address of the sensor. It is 0x76 or 0x77.

Default value: 119

monitored_conditions

(list)(Optional)Conditions to monitor.

Default value: [“temperature”, “humidity”, “pressure”, “airquality”]

temperature

Monitor temperature.

humidity

Monitor relative humidity.

pressure

Monitor pressure.

gas

Monitor gas resistance values on the VOC sensor.

airquality

Monitor air quality using the values of humidity and gas resistance and calculate a percentage based air quality measurement.

oversampling_temperature

(int)(Optional)Oversampling multiplier as described in the sensor datasheet. Can be 0 (no sampling), 1, 2, 4, 8, or 16.

Default value: 8

oversampling_pressure

(int)(Optional)Oversampling multiplier as described in the sensor datasheet. Can be 0 (no sampling), 1, 2, 4, 8, or 16.

Default value: 2

oversampling_humidity

(int)(Optional)Oversampling multiplier as described in the sensor datasheet. Can be 0 (no sampling), 1, 2, 4, 8, or 16.

Default value: 4

filter_size

(int)(Optional)IIR filter size as described in the sensor datasheet. Can be 0 (off), 1, 3, 7, 15, 31, 63 or 127.

Default value: 3

gas_heater_temperature

(int)(Optional)The temperature to heat the hotplate to for gas resistance measurements as described in the sensor datasheet. Can be between 200-400°C.

Default value: 320

gas_heater_duration

(int)(Optional)The duration to heat the hotplate in milliseconds for gas resistance measurements as described in the sensor datasheet. Can be between 1-4032 ms. In reality, you will likely need between 80-100ms to reach a stable temperature. Using a duration greater than 1000ms is inadvisable as it will essentially result in the heater being continually on due to the 1-second update interval.

Default value: 150

aq_burn_in_time

(int)(Optional)The duration to perform gas resistance measurements to establish a stable baseline measurements for Air Quality calculations in seconds. The burn in time is only performed when the sensor component is first initialized.

Default value: 300

aq_humidity_baseline

(int)(Optional)The baseline ideal relative humidity value for the air quality calculations.

Default value: 40

aq_humidity_bias

(int)(Optional)The bias for humidity to the gas resistance measurement in the air quality calculations expressed as a percentage of the total calculation e.g. 25% hudidtity to 75% gas.

Default value: 25

Full Examples

If you want to specify the working mode of the digital sensor or need to change the default I2C address (which is 0x77), add more details to the configuration.yaml file:

# Example of customized configuration.yaml entry
sensor:
  - platform: bme680
    name: BME680 Sensor
    i2c_bus: 1
    i2c_address: 0x77
    monitored_conditions:
      - temperature
      - humidity
      - pressure
      - gas
      - airquality
    oversampling_temperature: 8
    oversampling_humidity: 2
    oversampling_pressure: 4
    filter_size: 3
    gas_heater_temperature: 320
    gas_heater_duration: 150
    aq_burn_in_time: 300
    aq_humidity_baseline: 40
    aq_humidity_bias: 25

Customizing the sensor data

Give the values friendly names and icons, add the following to your customize: section.

# Example configuration.yaml entry
customize:
  sensor.bme680_sensor_temperature:
    icon: mdi:thermometer
    friendly_name: Temperature
  sensor.bme680_sensor_humidity:
    icon: mdi:water
    friendly_name: Humidity
  sensor.bme680_sensor_pressure:
    icon: mdi:gauge
    friendly_name: Pressure
  sensor.bme680_sensor_air_quality:
    icon: mdi:blur
    friendly_name: Air Quality

To create a group, add the following to your group section.

# Example configuration.yaml entry
group:
  climate:
    name: Climate
    entities:
      - sensor.bme680_sensor_temperature
      - sensor.bme680_sensor_humidity
      - sensor.bme680_sensor_pressure
      - sensor.bme680_sensor_air_quality

Directions for installing SMBus support on Raspberry Pi

Enable I2C interface with the Raspberry Pi configuration utility:

# pi user environment: Enable I2C interface
$ sudo raspi-config

Select Interfacing options->I2C choose <Yes> and hit Enter, then go to Finish and you’ll be prompted to reboot.

Install dependencies to use the smbus-cffi module and add your homeassistant user to the i2c group:

# pi user environment: Install I2C dependencies and utilities
$ sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev

# pi user environment: Add homeassistant user to the I2C group
$ sudo addgroup homeassistant i2c

# pi user environment: Reboot Raspberry Pi to apply changes
$ sudo reboot

Check the I2C address of the sensor

After installing i2c-tools, a new utility is available to scan the addresses of the connected sensors:

$ /usr/sbin/i2cdetect -y 1

It will output a table like this:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 76

So you can see the sensor address that you are looking for is 0x76 (there is another I2C device on that Raspberry Pi).