SHT31 vs SHT40 do either work?

Hello!

I was looking at the DIY Pro v4.2 parts list and it lists the SHT31 temp/humidity sensor whereas the Pro pre-soldered kit lists it as SHT40.

Can either be used? Is there any difference?

Thanks!

Looks like there are differences, and I would assume the code would need to be adjusted slightly to support the different ones, but overall, they should measure the same things, with slightly different accuracies:
Transition_Guide_SHT3x-SHT4x_Analog_Sensors.pdf (sensirion.com)

We are switching to the SHT40 as the SHT3x is not recommended anymore by Sensirion. The arduino code is already adjusted. It would be great if the ESP home version could also be adjusted.

Should be really easy. This is what I’m using for SHT31

  - platform: sht3xd
    # https://esphome.io/components/sensor/sht3xd.html?highlight=sht31
    temperature:
      name: "${upper_devicename} Temperature"
      id: temp
    humidity:
      name: "${upper_devicename} Humidity"
      id: humidity

To update it to the SHT40, you would only change the platform line, since the parameters are the same
SHT4X Temperature and Humidity Sensor — ESPHome

  - platform: sht4x
    # https://esphome.io/components/sensor/sht4x.html
    temperature:
      name: "${upper_devicename} Temperature"
      id: temp
    humidity:
      name: "${upper_devicename} Humidity"
      id: humidity
1 Like

Thanks everyone! I’ll give the SHT40 a try for my build.

I’ve made a PR upstream to set the sensor to SHT4x. This means this issue should go away for new users, and users with older models can still uncomment the previous sensor config.