esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
418 stars 26 forks source link

Add CJMCU-8128 support #791

Closed riochicken closed 2 years ago

riochicken commented 4 years ago

Hi,

It would be excellent to get CJMCU-8128 support to ESPhome, my new home will have a CO2 system installed and I would like to keep monitoring this constantly since new houses don't seem to have any natural ventilation systems anymore.

Thank you in advance!

Kind regards Richard

idavydov commented 3 years ago

CJMCU-8128 is three different sensors on the same board:

All of them are already supported by ESPHOME (amazing, I'm really impressed).

Here is the config which works for me:

sensor:
  - platform: bmp280
    temperature:
      name: "Temperature (BMP280)"
      id: bmp280_temperature
      oversampling: 16x
    pressure:
      name: "Pressure"
    address: 0x76
    update_interval: 60s
  - platform: htu21d
    temperature:
      name: "Temperature (Si7021)"
    humidity:
      name: "Humidity"
      id: si7021_humidity
    address: 0x40
    update_interval: 60s
  - platform: ccs811
    eco2:
      name: "CCS811 eCO2 Value"
    tvoc:
      name: "CCS811 Total Volatile Organic Compound"
    temperature: bmp280_temperature
    humidity: si7021_humidity
    address: 0x5A
    update_interval: 60s

Please note that:

christiaangombert commented 3 years ago

To build up on the work of @idavydov as posted above, I made some minor adjustments to the configuration:

i2c:
  sda: 21
  scl: 22

sensor:
  - platform: bmp280
    temperature:
      name: "Temperature (BMP280)"
      id: bmp280_temperature
      oversampling: 16x
    pressure:
      name: "Pressure (BMP280)"
      id: bmp280_pressure
    address: 0x76
    update_interval: 60s
  - platform: hdc1080
    temperature:
      name: "Temperature (HDC1080)"
      id: hdc1080_temperature
    humidity:
      name: "Humidity (HDC1080)"
      id: hdc1080_humidity
    address: 0x40
    update_interval: 60s
  - platform: ccs811
    eco2:
      name: "eCO2 (CCS811)"
      id: ccs811_eco2
    tvoc:
      name: "Total Volatile Organic Compound (CCS811)"
      id: ccs811_tvoc
    temperature: bmp280_temperature
    humidity: hdc1080_humidity
    address: 0x5A
    update_interval: 60s

This code was tested om a Wemos D1 R32 board (device type: Generic ESP32 WROVER module) with ESPhome version 1.16.2.

WIRING DIAGRAM:

CJMCU-8128 == Wemos D1 R32 VCC == 3v3 GND == GND SDA == SDA (IO21) SCL == SCL (IO22) WAKE == GND