BME680 Temperature+Pressure+Humidity+Gas Sensor
The bme680 sensor platform allows you to use your BME680
(datasheet,
Adafruit_) temperature, pressure and humidity sensors with ESPHome. The I²C is required to be set up in
your configuration for this sensor to work.

# Example configuration entry
sensor:
  - platform: bme680
    temperature:
      name: "BME680 Temperature"
      oversampling: 16x
    pressure:
      name: "BME680 Pressure"
    humidity:
      name: "BME680 Humidity"
    gas_resistance:
      name: "BME680 Gas Resistance"
    address: 0x77
    update_interval: 60sConfiguration variables
- temperature (Optional): The information for the temperature sensor. - oversampling (Optional): The oversampling parameter for the temperature sensor. See Oversampling Options. 
- All other options from Sensor. 
 
- pressure (Optional): The information for the pressure sensor. - oversampling (Optional): The oversampling parameter for the temperature sensor. See Oversampling Options. 
- All other options from Sensor. 
 
- humidity (Optional): The information for the humidity sensor. - oversampling (Optional): The oversampling parameter for the temperature sensor. See Oversampling Options. 
- All other options from Sensor. 
 
- gas_resistance (Optional): The information for the gas sensor. - All options from Sensor.
 
- address (Optional, int): Manually specify the I²C address of the sensor. Defaults to - 0x76. Another address can be- 0x77.
- iir_filter (Optional): Set up an Infinite Impulse Response filter to increase accuracy. One of - OFF,- 1x,- 3x,- 7x,- 15x,- 31x,- 63xand- 127x. Defaults to- OFF.
- heater (Optional): The settings for the internal heater for the gas sensor. Set this to disable the internal heater. - temperature (Optional, int): The target temperature of the heater between 200 and 400 °C. Defaults to - 320.
- duration (Optional, Time): The duration the heater should be active. Maximum value is - 4032ms. Defaults to- 150ms.
 
- update_interval (Optional, Time): The interval to check the sensor. Defaults to - 60s.

Oversampling Options
By default, the BME680 sensor measures each value 16 times when requesting a new value. You can, however, configure this amount. Possible oversampling values:
- NONE(value is skipped)
- 1x
- 2x
- 4x
- 8x
- 16x(default)
Advanced Configuration
Add indoor air quality (IAQ) calculation and IAQ label, based on the values in the BME680 BSEC component index.
# Example configuration entry
sensor:
  - platform: bme680
    temperature:
      name: "BME680 Temperature"
      oversampling: 16x
    pressure:
      name: "BME680 Pressure"
    humidity:
      id: "humidity"
      name: "BME680 Humidity"
    gas_resistance:
      id: "gas_resistance"
      name: "BME680 Gas Resistance"
    address: 0x77
    update_interval: 60s
  - platform: template
    name: "BME680 Indoor Air Quality"
    id: iaq
    icon: "mdi:gauge"
    # calculation: comp_gas = log(R_gas[ohm]) + 0.04 log(Ohm)/%rh * hum[%rh]
    lambda: |-
      return log(id(gas_resistance).state) + 0.04 *  id(humidity).state;
    state_class: "measurement"
text_sensor:
  - platform: template
    name: "BME680 IAQ Classification"
    icon: "mdi:checkbox-marked-circle-outline"
    lambda: |-
      if (int(id(iaq).state) <= 50) {
        return {"Excellent"};
      }
      else if (int(id(iaq).state) <= 100) {
        return {"Good"};
      }
      else if (int(id(iaq).state) <= 150) {
        return {"Lightly polluted"};
      }
      else if (int(id(iaq).state) <= 200) {
        return {"Moderately polluted"};
      }
      else if (int(id(iaq).state) <= 250) {
        return {"Heavily polluted"};
      }
      else if (int(id(iaq).state) <= 350) {
        return {"Severely polluted"};
      }
      else if (int(id(iaq).state) <= 500) {
        return {"Extremely polluted"};
      }
      else {
        return {"unknown"};
      }