[example] Indoor Air Quality text sensor using CCS811 sensor

only in rare cases when CCS811 has i2c 5B address instead 5A, but only changing letters

Hi @HFsi @Bouke_Regnerus @dhabib29,

I’m trying to set up my CCS811 sensor with ESPHome but I always recive the same errors:

Component ccs811.sensor was marked as failed.

Results from i2c bus scan:
Found no i2c devices!

Communication failed! Is the sensor connected?

This is the connection:


SDA => 21
SCL => 22

And this is the code:

esp32:
  board: nodemcu-32s
  framework:
    type: arduino

# Enable logging
logger:


i2c:
  sda: GPIO21
  scl: GPIO22
  scan: true
     
sensor:
  - platform: homeassistant
    id: living_room_temperature
    entity_id: sensor.broadlink_ir_salon_temperature
  - platform: homeassistant
    id: living_room_humidity
    entity_id: sensor.broadlink_ir_salon_humidity
  - platform: ccs811
    eco2:
      name: "Livingroom eCO2"
      id: eco2
    tvoc:
      name: "Livingroom TVOC"
      id: tvoc
    temperature: living_room_temperature
    humidity: living_room_humidity
    baseline: 0xD3BE
    address: 0x5A
    update_interval: 60s

Could you help me, please?

Do you have another I2C sensor to test it out?
Maybe some pin is dead

For future reference because I had the exact same error and it took me about an hour to figure out.

My CCS811 sensor needed the i2c Bus to be set to 400kHz via the “frequency” variable. Wasn’t mentioned anywhere in the docs and in the end I found it on the Amazon page in the product details section.

i2c:
  sda: GPIO21
  scl: GPIO22
  frequency: 400kHz
  scan: true