CCS811 CO_2 and Volatile Organic Compound Sensor¶
ccs811 sensor platform allows you to use CCS811 CO_2 and volatile organic compound sensors
(Adafruit) with ESPHome.
The communication with this sensor is done via I²C Bus, so you need to have
i2c: section in your config for this integration to work.
# Example configuration entry i2c: sda: D0 scl: D1 sensor: - platform: ccs811 eco2: name: "CCS811 eCO2 Value" tvoc: name: "CCS811 Total Volatile Organic Compound" address: 0x5A update_interval: 60s
eco2 (Required): The eCO_2 data from the sensor in parts per million (ppm).
tvoc (Required): The information for the total volatile organic compound sensor in parts per billion (ppb).
update_interval (Optional, Time): The interval to check the sensor. Defaults to
address (Optional, int): The I²C address of the sensor.
baseline (Optional, int): The baseline value for the unit, for calibration purposes. See Calibrating Baseline for more info.
temperature (Optional, ID): Give an external temperature sensor ID here. This can improve the sensor’s internal calculations.
humidity (Optional, ID): Give an external humidity sensor ID here. This can improve the sensor’s internal calculations.
The CCS811 sensor will re-calibrate itself each time it is powered on. Unfortunately that also means that if the sensor reboots at a time when the air is less clean than normal, the values will have a constant offset and cannot be compared to the values before the last boot.
To have consistent values, you need to specify a static baseline value (the calibration factor).
To do this, first let the sensor boot up with no baseline set and let the sensor calibrate
itself. After around 20-30 minutes you can then view the remote logs on the ESP. The next
time the sensor is read out, you will see a log message with something like
Now set the baseline property in your configuration file like so with the value you got via the logs:
# Example configuration entry sensor: - platform: ccs811 # ... baseline: 0xA483
The next time you upload the code, the CCS811 will be informed of this static baseline and you will get consistent values.
Please note that after some time (a couple of months), the baseline will need to be re-calibrated because the internal sensor has a slight value drift over time.