AirGradient v. ESPHome 2023.9.2 Temperature Issue since ESPHome upgrade

I have 2 AirGradient units (Basic 3.0 Units : The AirGradient DIY Air Quality Sensor (Basic Version PCB Version 3.0))

Previously, both units were running with ESPHome 2023.8.2 and working properly. However, yesterday I upgraded to 2023.9.2 and wirelessly reflashed both units and the temperature sensor results instantly jumped +2.5c

I had initially set them both up with a Temperature Offset of -2.0 as their readings were +2c above actual.

sensor:
  - platform: sht3xd
    temperature:
      id: temp
      name: "Temperature"
      filters:
        - offset: -2.0

The local unit (Unit1) would not respond to a new “- offset: -4.5” and I finally got it to report the correct temperature using “lambda”

sensor:
  - platform: sht3xd
    temperature:
      id: temp
      name: "Temperature"
      filters:
        - lambda: return (x - 4.5);

Unit2 (8,000 miles away - seriously), would not report the correct temperature no matter what I tried. An offset of -4.5 dropped the result -2c below normal. A lambda of (x - 4.5) did the same. Finally after reverting back to a offset of -2.0 it reported the correct temperature, again:

sensor:
  - platform: sht3xd
    temperature:
      id: temp
      name: "Temperature"
      filters:
        - offset: -2.0

Until just an hour ago. Then Temperature reading on Unit2 instantly jumped +2.0c for no apparent reason. I had not updated any software in HA, including ESPHome. It just jumped.

So I tried lambda (x - 4.5) (same as Unit1 code):

sensor:
  - platform: sht3xd
    temperature:
      id: temp
      name: "Temperature"
      filters:
        - lambda: return (x - 4.5);

And it caused the reading to drop -2.5 below actual. I tried doing a physical Power Cycle (using a remote controlled Tasmota socket) with no change.

I feel like I’m chasing my tail with this and really hesitant to keep flashing new firmware on Unit2 as its so far away with no-one on site to do a local flash if the wireless one fails (its failed before). So I’m hoping someone can point me in right direction as to watch to change/examine/look.

esphome:
  name: "air-gradient-2"
  platform: ESP8266
  board: d1_mini
  friendly_name: "air-gradient-2"

  project:
    name: ajfriesen.ESPHome-AirGradient
    version: "1.0"

# Enable logging
logger:

# Enable Home Assistant API
api:

#  encryption:
#    key: Redacted

ota:
  

# Create a switch for safe_mode in order to flash the device
# Solution from this thread:
# https://community.home-assistant.io/t/esphome-flashing-over-wifi-does-not-work/357352/1
switch:
  - platform: safe_mode
    id: AirGradient2_safe_mode
    name: "Flash Mode (Safe Mode)"
  - platform: restart
    id: AirGradient2_restart
    name: "Air Gradient2 Restart"

button:
  - platform: template
    name: "Flash mode"
    id: flash_button
    icon: "mdi:cellphone-arrow-down"
    on_press:
      then:
        - switch.toggle: AirGradient2_safe_mode

dashboard_import:
# package_import_url: github://esphome/esphome-project-template/project-template-esp32.yaml@v6
  package_import_url: github://ajfriesen/ESPHome-AirGradient/main/air-gradient.yaml

wifi:
  # Redacted

captive_portal:

i2c:
  sda: D2
  scl: D1
  frequency: 800kHz

font:
  - file: "fonts/monofont.ttf"
    id: opensans
    size: 20

display:
  - platform: ssd1306_i2c
    id: oled
    model: "SSD1306 64x48"
    flip_x: False
    flip_y: False
    pages:
      - id: page1
        lambda: |-
          it.printf(0, 0, id(opensans), "Temp:");
          it.printf(0, 20, id(opensans), "%.1fC", id(temp).state);
      - id: page2
        lambda: |-
          it.printf(0, 0, id(opensans), "Humidity");
          it.printf(0, 20, id(opensans), "%.1f%%", id(humidity).state);
      - id: page3
        lambda: |-
          it.printf(0, 0, id(opensans), "CO2 ppm");
          it.printf(0, 20, id(opensans), "%.0f", id(co2).state);
      - id: page4
        lambda: |-
          it.printf(0, 0, id(opensans), "PM1.0");
          it.printf(0, 20, id(opensans), "%.0f", id(pm10).state);
      - id: page5
        lambda: |-
          it.printf(0, 0, id(opensans), "PM2.5");
          it.printf(0, 20, id(opensans), "%.0f", id(pm25).state);
      - id: page6
        lambda: |-
          it.printf(0, 0, id(opensans), "PM10.0");
          it.printf(0, 20, id(opensans), "%.0f", id(pm100).state);

interval:
  - interval: 3s
    then:
      - display.page.show_next: oled
      - component.update: oled

uart:
  - rx_pin: D5
    tx_pin: D6
    baud_rate: 9600
    id: uart_1
    
  - rx_pin: D4
    tx_pin: D3
    baud_rate: 9600
    id: uart_2

sensor:
  - platform: sht3xd
    temperature:
      id: temp
      name: "Temperature"
      filters:
        - lambda: return (x - 4.5);
    humidity:
      id: humidity
      name: "Humidity"
    address: 0x44
    update_interval: 60s

  - platform: pmsx003
    # type can be PMSX003, PMS5003S, PMS5003T, PMS5003ST
    # https://esphome.io/components/sensor/pmsx003.html
    type: PMSX003
    uart_id: uart_1
    pm_1_0:
      id: pm10
      name: "Particulate Matter <1.0µm Concentration"
    pm_2_5:
      id: pm25
      name: "Particulate Matter <2.5µm Concentration"
    pm_10_0:
      id: pm100
      name: "Particulate Matter <10.0µm Concentration"
#    formaldehyde:
#      id: hcho
#      name: "Formaldehyde (HCHO) concentration in µg per cubic meter"

  - platform: senseair
    uart_id: uart_2
    co2:
      id: co2
      name: "SenseAir CO2 Value"
    update_interval: 60s

The ESPHome yaml logs for that Unit2 show no errors.

Any ideas?

More Info: I got Unit2 reporting the correct Temperature again using "- lambda: return (x - 2.0); " reflash and reboot and then just an hour ago, the reported Temperature jumped instantly +2c again.

I really don’t understand what is going on and REALLY regret upgrading to 2023.9.2

I’m going to try reverting back to 2023.8.2

Did you manage? I just updated and saw the jump immediately.

I restored ESPHome 2023.8.2 from a backup and reflashed Unit1 and rebooted. With its original " - offset: -2.0" its been reporting the correct temperature for 2 hours now with no issues.

I just reflashed Unit2 (the remote one) with the same offset and rebooted, and so far its been reporting correcting for the past 30 minutes. I’ll monitor it for the next 24 hours to ensure its stable again.

Here’s a screenshot of Unit2 AirGradient running with 2023.9.2 from before I downgraded to 2023.8.2.
Note that I had not touched the unit or changed the temperature at that location during those 3 mystery spikes (circled) and Google Nest Thermostat showed no changes in temperature during those spikes.

The previous temperature spikes and drops where from me trying different offsets and lambdas in EPSHome 20203.9.2 with totally wild results

I’m also seeing this issue across all 3 of my deployed SHT31-D sensors. It started for me when going from ESPHome 2023.6.3 to 2023.9.2. I have since upgraded to 2023.9.3, no change.

Has anyone seen this issue with 2023.9.1?

Edit: It also caused a jump in humidity values as well from the SHT31’s. I suspect because of the temperature jump.

I found the fix:

# Sensirion SHT31-D Temperature / Humidity
  - platform: sht3xd
    i2c_id: bus_a
    address: 0x44
    temperature:
      name: "Shop Temp SHT31"
    humidity:
      name: "Shop Humidity SHT31"
      filters:
      # Corrects calibration filter
      - offset: -3
      accuracy_decimals: 0
    update_interval: 60s
    heater_enabled: false

The new parameter heater_enabled: needs to be explicitly specified as false, as of 2023.9.x it defaults true.

More background info:

https://github.com/esphome/esphome-docs/pull/3149

https://github.com/esphome/esphome/pull/5161

And the revised sht3xd setup info is now here:
https://esphome.io/components/sensor/sht3xd

And it looks like it will be fixed in code to default it false once this github code commit is released:
https://github.com/esphome/esphome/commit/b3dc2d43a52b181b700477db78a762a228ec2747

https://github.com/esphome/esphome/pull/5445

1 Like

Its been nearly 24 hours since reverting back to ESPHome 2023.8.2 and both AirGradient Units are working properly and reporting the correct temperature. I too was getting dips in Humidity readings at the same points the temperature spiked with ESPHome 2023.9.2 (and 3).

I have now applied @ThisWayToo find of the “heater_enabled: false” parameter the the sht3xd platform in AirGradient on Unit1 and upgraded ESPHome to 2023.9.3. So far, both temperature and humidity reportings are stable and accurate.

I’m going to wait a few hours before applying the changes to Unit2 with EPSHome 2023.9.3 and then watch for the next 24 hours before declaring this a solution. But its looking very positive thus far.

Thanks!

Thank you for your initial reply and thank you @ThisWayToo for the heads up with regard to heater_enabled. I used that to alter my yaml and it fixed my airgradient without restoring.

It’s been nearly 24 hours since applying that heater_enabled parameter and upgrading to ESPHome 2023.9.3 and no spikes or dips in the temperature or humidity reporting have occurred.
Thanks again @ThisWayToo for finding this and posting it! I marked your reply as the Solution.