esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
294 stars 37 forks source link

m5stack ENVII sensor SHT30 not working with SHT3xd component #2522

Open lhoracek opened 3 years ago

lhoracek commented 3 years ago

The problem

Trying to get values from m5stack EnvII sensor that contains bmp280 and sht30 sensors. Having i2c set up with scan enabled. It can see device with address 0x44. But when sht3xd tries to initialize, it marks itself as failed.

Tested it with this Arduino snippet and then the sensor provides values fine:

#include "Wire.h"
#include "SHT31.h"

uint32_t start;
uint32_t stop;

SHT31 sht;

void setup()
{
  Serial.begin(115200);
  Wire.begin();

  sht.begin(0x44);    //Sensor I2C Address

  Wire.setClock(100000);
  uint16_t stat = sht.readStatus();
  Serial.print(stat, HEX);
  Serial.println();
}

void loop()
{
  sht.read();

  Serial.print("Temperature:");
  Serial.print(sht.getTemperature(), 1);
  Serial.print("\t");
  Serial.print("Humidity:");
  Serial.println(sht.getHumidity(), 1);
  delay(50);
}

Which version of ESPHome has the issue?

2021.10.0-dev

What type of installation are you using?

pip

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32

Board

m5stack core

Component causing the issue

sensor.sht3xd

Example YAML snippet

esphome:
  name: heart-rate-display
  platform: ESP32
  board: m5stack-core-esp32

# Enable logging
logger:
  level: VERBOSE

i2c:
  sda: 21
  scl: 22
  scan: true
  frequency: 100kHz

sensor:
  - platform: bmp280
    temperature:
      name: "Temperature"
      oversampling: 16x
      id: sensor_temperature2
    pressure:
      name: "Pressure"
      id: sensor_pressure
    address: 0x76
    update_interval: 1s
  - platform: sht3xd
    temperature:
      name: "Temperature"
      id: sensor_temperature
    humidity:
      name: "Humidity"
      id: sensor_humidity
    address: 0x44
    update_interval: 1s

Anything in the logs that might be useful for us?

[11:38:31][I][logger:215]: Log initialized
[11:38:31][I][app:029]: Running through setup()...
[11:38:31][V][app:030]: Sorting components by setup priority...
[11:38:31][I][i2c.arduino:156]: Performing I2C bus recovery
[11:38:31][C][spi:023]: Setting up SPI bus...
[11:38:31][C][uart.arduino_esp32:075]: Setting up UART...
[11:38:31][C][light:035]: Setting up light 'ILI9341 Display Backlight'...
[11:38:31][D][light:035]: 'ILI9341 Display Backlight' Setting:
[11:38:31][D][light:040]:   Color mode: 
[11:38:31][D][light:046]:   State: ON
[11:38:31][D][light:084]:   Transition length: 1.0s
[11:38:31][C][bmp280.sensor:056]: Setting up BMP280...
[11:38:31][C][sht3xd:019]: Setting up SHT3xD...
[11:38:31][E][component:103]: Component sht3xd.sensor was marked as failed.
[11:38:31][C][sgp30:035]: Setting up SGP30...
[11:38:31][D][sgp30:051]: Serial Number: 23847698
[11:38:31][D][sgp30:075]: Product version: 0x22
[11:38:31][V][esp32.preferences:057]: nvs_get_blob('-1604918418'): ESP_ERR_NVS_NOT_FOUND - the key might not be set yet
[11:38:31][I][app:060]: setup() finished successfully!
[11:38:31][V][bmp280.sensor:125]: Sending conversion request...
[11:38:31][V][component:206]: Component ili9341.display took a long time for an operation (0.07 s).
[11:38:31][V][component:207]: Components should block for at most 20-30ms.
[11:38:31][I][app:099]: ESPHome version 2021.10.0-dev compiled on Oct  7 2021, 11:38:19
[11:38:31][C][i2c.arduino:032]: I2C Bus:
[11:38:31][C][i2c.arduino:033]:   SDA Pin: GPIO21
[11:38:31][C][i2c.arduino:034]:   SCL Pin: GPIO22
[11:38:31][C][i2c.arduino:035]:   Frequency: 100000 Hz
[11:38:31][C][i2c.arduino:038]:   Recovery: bus successfully recovered
[11:38:31][I][i2c.arduino:048]: Scanning i2c bus for active devices...
[11:38:31][I][i2c.arduino:053]: Found i2c device at address 0x44
[11:38:31][I][i2c.arduino:053]: Found i2c device at address 0x58
[11:38:31][I][i2c.arduino:053]: Found i2c device at address 0x75
[11:38:31][I][i2c.arduino:053]: Found i2c device at address 0x76
[11:38:31][D][sgp30:290]: Got eCO2=400.0ppm TVOC=0.0ppb
[11:38:31][V][sensor:070]: 'Workshop eCO2': Received new state 400.000000
[11:38:31][D][sensor:121]: 'Workshop eCO2': Sending state 400.00000 ppm with 1 decimals of accuracy
[11:38:31][V][sensor:070]: 'Workshop TVOC': Received new state 0.000000
[11:38:31][D][sensor:121]: 'Workshop TVOC': Sending state 0.00000 ppb with 1 decimals of accuracy
[11:38:31][D][sgp30:166]: Baseline reading not available for: 43200s
[11:38:31][D][bmp280.sensor:149]: Got temperature=25.3°C pressure=989.0hPa
[11:38:31][V][sensor:070]: 'Temperature': Received new state 25.340000
[11:38:31][D][sensor:121]: 'Temperature': Sending state 25.34000 °C with 1 decimals of accuracy
[11:38:31][V][sensor:070]: 'Pressure': Received new state 989.025452
[11:38:31][D][sensor:121]: 'Pressure': Sending state 989.02545 hPa with 1 decimals of accuracy
[11:38:31][C][spi:101]: SPI bus:
[11:38:31][C][spi:102]:   CLK Pin: GPIO18
[11:38:31][C][spi:103]:   MISO Pin: GPIO19
[11:38:31][C][spi:104]:   MOSI Pin: GPIO23
[11:38:31][C][spi:106]:   Using HW SPI: YES
[11:38:31][C][uart.arduino_esp32:105]: UART Bus:
[11:38:31][C][uart.arduino_esp32:107]:   RX Pin: GPIO16
[11:38:31][C][uart.arduino_esp32:109]:   RX Buffer Size: 256
[11:38:31][C][uart.arduino_esp32:111]:   Baud Rate: 9600 baud
[11:38:31][C][uart.arduino_esp32:112]:   Data Bits: 8
[11:38:31][C][uart.arduino_esp32:113]:   Parity: NONE
[11:38:31][C][uart.arduino_esp32:114]:   Stop bits: 1
[11:38:31][C][ledc.output:094]: LEDC Output:
[11:38:31][C][ledc.output:095]:   Pin GPIO32
[11:38:31][C][ledc.output:096]:   LEDC Channel: 0
[11:38:31][C][ledc.output:097]:   Frequency: 1000.0 Hz
[11:38:31][C][logger:234]: Logger:
[11:38:31][C][logger:235]:   Level: VERBOSE
[11:38:31][C][logger:236]:   Log Baud Rate: 115200
[11:38:31][C][logger:237]:   Hardware UART: UART0
[11:38:31][C][light:097]: Light 'ILI9341 Display Backlight'
[11:38:31][C][light:099]:   Default Transition Length: 1.0s
[11:38:31][C][light:100]:   Gamma Correct: 2.80
[11:38:31][D][sgp30:290]: Got eCO2=400.0ppm TVOC=0.0ppb
[11:38:31][V][sensor:070]: 'Workshop eCO2': Received new state 400.000000
[11:38:31][D][sensor:121]: 'Workshop eCO2': Sending state 400.00000 ppm with 1 decimals of accuracy
[11:38:31][V][sensor:070]: 'Workshop TVOC': Received new state 0.000000
[11:38:31][D][sensor:121]: 'Workshop TVOC': Sending state 0.00000 ppb with 1 decimals of accuracy
[11:38:31][D][sgp30:166]: Baseline reading not available for: 43200s
[11:38:31][C][bmp280.sensor:098]: BMP280:
[11:38:31][C][bmp280.sensor:099]:   Address: 0x76
[11:38:31][C][bmp280.sensor:111]:   IIR Filter: OFF
[11:38:31][C][bmp280.sensor:112]:   Update Interval: 1.0s
[11:38:31][C][bmp280.sensor:114]:   Temperature 'Temperature'
[11:38:31][C][bmp280.sensor:114]:     Device Class: 'temperature'
[11:38:31][C][bmp280.sensor:114]:     State Class: 'measurement'
[11:38:31][C][bmp280.sensor:114]:     Unit of Measurement: '°C'
[11:38:31][C][bmp280.sensor:114]:     Accuracy Decimals: 1
[11:38:31][C][bmp280.sensor:115]:     Oversampling: 16x
[11:38:31][C][bmp280.sensor:116]:   Pressure 'Pressure'
[11:38:31][C][bmp280.sensor:116]:     Device Class: 'pressure'
[11:38:31][C][bmp280.sensor:116]:     State Class: 'measurement'
[11:38:31][C][bmp280.sensor:116]:     Unit of Measurement: 'hPa'
[11:38:31][C][bmp280.sensor:116]:     Accuracy Decimals: 1
[11:38:31][C][bmp280.sensor:117]:     Oversampling: 16x
[11:38:31][C][sht3xd:034]: SHT3xD:
[11:38:31][C][sht3xd:035]:   Address: 0x44
[11:38:31][E][sht3xd:037]: Communication with SHT3xD failed!
[11:38:31][C][sht3xd:039]:   Update Interval: 1.0s
[11:38:31][C][sht3xd:041]:   Temperature 'Temperature'
[11:38:32][C][sht3xd:041]:     Device Class: 'temperature'
[11:38:32][C][sht3xd:041]:     State Class: 'measurement'
[11:38:32][C][sht3xd:041]:     Unit of Measurement: '°C'
[11:38:32][C][sht3xd:041]:     Accuracy Decimals: 1
[11:38:32][C][sht3xd:042]:   Humidity 'Humidity'
[11:38:32][C][sht3xd:042]:     Device Class: 'humidity'
[11:38:32][C][sht3xd:042]:     State Class: 'measurement'
[11:38:32][C][sht3xd:042]:     Unit of Measurement: '%'
[11:38:32][C][sht3xd:042]:     Accuracy Decimals: 1
[11:38:32][V][bmp280.sensor:125]: Sending conversion request...
[11:38:32][C][sgp30:228]: SGP30:
[11:38:32][C][sgp30:229]:   Address: 0x58
[11:38:32][C][sgp30:249]:   Serial number: 23847698
[11:38:32][C][sgp30:255]:   Baseline: No baseline configured
[11:38:32][C][sgp30:257]:   Warm up time: 43200s
[11:38:32][C][sgp30:259]:   Update Interval: 1.0s
[11:38:32][C][sgp30:260]:   eCO2 sensor 'Workshop eCO2'
[11:38:32][C][sgp30:260]:     Device Class: 'carbon_dioxide'
[11:38:32][C][sgp30:260]:     State Class: 'measurement'
[11:38:32][C][sgp30:260]:     Unit of Measurement: 'ppm'
[11:38:32][C][sgp30:260]:     Accuracy Decimals: 1
[11:38:32][C][sgp30:260]:     Icon: 'mdi:molecule-co2'
[11:38:32][C][sgp30:261]:   TVOC sensor 'Workshop TVOC'
[11:38:32][C][sgp30:261]:     Device Class: 'volatile_organic_compounds'
[11:38:32][C][sgp30:261]:     State Class: 'measurement'
[11:38:32][C][sgp30:261]:     Unit of Measurement: 'ppb'
[11:38:32][C][sgp30:261]:     Accuracy Decimals: 1
[11:38:32][C][sgp30:261]:     Icon: 'mdi:radiator'
[11:38:32][C][sgp30:264]: Store baseline: YES
[11:38:32][C][sgp30:270]:   Compensation: No source configured

Additional information

Tried stable, beta and dev releases

anatoly-savchenkov commented 3 years ago

I have somewhat similar problem. sht31 + sgp30 + barometric pressure + luminance sensor all attached on the single I2C bus don't work with the same symptoms. My suspect is SGP30, although error is reported by sht3x like in your case.

I was able to solve this by moving sgp30 to a separate I2C bus, see example below. I'm curious if this would solve problems on your side.

sgp30 does not work for me even if attached to a dedicated I2C bus (reports very inaccurate numbers). But that's a different story which I'll try to solve once time allows.

i2c:
 - id: bus_a
   sda: 13
   scl: 15
   scan: true
 - id: bus_b
   sda: 21
   scl: 22
   scan: true
sensor:
  - platform: sht3xd
    temperature:
      name: Temperature
      id: temperature
      device_class: temperature
      state_class: measurement
      unit_of_measurement: "°C"
      accuracy_decimals: 1
    humidity:
      name: Humidity
      id: humidity
      device_class: humidity
      state_class: measurement
      unit_of_measurement: "%"
      accuracy_decimals: 1
    address: 0x44
    update_interval: 1s
    i2c_id: bus_a

  - platform: max44009
    name: Luminance
    id: luminance
    update_interval: 1s
    i2c_id: bus_a

  - platform: ms5611
    temperature:
      name: Temperature
      id: ms5611_temperature
      unit_of_measurement: "°C"
      device_class: "temperature"
      state_class: "measurement"
      accuracy_decimals: 1      
    pressure:
      name: Pressure
      id: pressure
      filters:
        - multiply: 0.75006157584566
      device_class: pressure
      state_class: measurement
      accuracy_decimals: 1
      unit_of_measurement: "mmHg"
    address: 0x77
    update_interval: 1s
    i2c_id: bus_a

  - platform: sgp30
    eco2:
      name: eCO2
      accuracy_decimals: 1
      id: office_eco2
    tvoc:
      name: TVOC
      accuracy_decimals: 1
      id: office_tvoc
    store_baseline: yes
    address: 0x58
    update_interval: 1s
    i2c_id: bus_b
    baseline:
      eco2_baseline: 0x90E8
      tvoc_baseline: 0x942C
    compensation:
      temperature_source: temperature
      humidity_source: humidity
lhoracek commented 2 years ago

Even just having the ENVII sensor with BMP280 and SHT30 alone connected, I get the error:

22:06:34][C][bmp280.sensor:056]: Setting up BMP280...
[22:06:34][C][sht3xd:019]: Setting up SHT3xD...
[22:06:34][E][component:112]: Component sht3xd.sensor was marked as failed.

And BMP280 continues to report values correctly. Not able to split the sensors in the m5stack module :-/

randybb commented 2 years ago

no issues with ENVIII (SHT30 + QMP6988, which is not supported) and BME280:

[22:39:17][D][sensor:125]: 'DEV 1 BME280 Temperature': Sending state 24.58000 °C with 1 decimals of accuracy
[22:39:17][D][sensor:125]: 'DEV 1 BME280 Pressure': Sending state 1018.23511 hPa with 1 decimals of accuracy
[22:39:17][D][sensor:125]: 'DEV 1 BME280 Humidity': Sending state 30.15820 % with 1 decimals of accuracy
[22:39:17][D][sht3xd:065]: Got temperature=24.91°C humidity=29.57%
[22:39:17][D][sensor:125]: 'DEV 1 SHT30 Temperature': Sending state 24.90654 °C with 1 decimals of accuracy
[22:39:17][D][sensor:125]: 'DEV 1 SHT30 Humidity': Sending state 29.57199 % with 1 decimals of accuracy
lhoracek commented 2 years ago

I'm getting similar issues with their RFID2 module, that shoudl be compatible with rc522_i2c. Starting to suspect my unit. Will get another one and retest. Thank @randybb