airgradient_esphome icon indicating copy to clipboard operation
airgradient_esphome copied to clipboard

Near-constant reboots on Airgradient One

Open amarshall opened this issue 9 months ago • 4 comments

Running v5.0.0, ESPHome 2025.2.2. Some time ago I tried upgrading to v4.0.7, but ultimately downgraded back to v2.0.5 because of this same issue. Reboots are so frequent (sometimes no more than every few minutes!) that it in fact becomes challenging even to flash the device, as there is often not enough time to do so before a restart. Even on v2.0.5 I didn’t have great uptime, but not this bad.

uptime graph

Config, with some things removed from the “default” based on suggestions from previous issues:

# AirGradient ONE - Board v9
# https://www.airgradient.com/open-airgradient/instructions/overview/

binary_sensor:
  - id: !extend config_button
    pin:
      ignore_strapping_warning: true # Acknowledging that this is a strapping pin and should not have external pullup/down resistors  https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
mqtt:
  broker: mymqtt.example
  password: !secret mqtt-password
  reboot_timeout: 0s
  username: airgradient-01
ota:
  password: !secret ota-password
  platform: esphome
packages:
  board: !include ./packages/airgradient_esp32-c3_board.yaml
  captive_portal: !include ./packages/captive_portal.yaml
  co2: !include ./packages/sensor_s8.yaml
  config_button: !include ./packages/config_button.yaml
  display: !include ./packages/display_sh1106_multi_page.yaml
  hardware_watchdog: !include ./packages/watchdog.yaml
  led: !include ./packages/led.yaml
  led_co2: !include ./packages/led_combo.yaml
  pm_2.5: !include ./packages/sensor_pms5003.yaml
  temp_humidity: !include ./packages/sensor_sht40.yaml
  tvoc: !include ./packages/sensor_sgp41.yaml
  uptime: !include ./packages/sensor_uptime.yaml
  wifi: !include ./packages/sensor_wifi.yaml
substitutions:
  config_version: 5.0.0
  friendly_name: "airgradient-01"
  name: "airgradient-01"
  name_add_mac_suffix: "false" # Must have quotes around value
text_sensor:
  - hide_timestamp: true
    name: "ESPHome Version"
    platform: version
wifi:
  password: !secret wifi-password
  ssid: My WiFi

amarshall avatar Mar 23 '25 20:03 amarshall

I've had some pretty inconsistent results as well, where it looks like a particular ESPHome version causes issues, then I revert and it keeps doing the same. I've often found that if I power cycle my wifi access points (I have 2) then it usually makes it more stable and I don't know why.

There is also an issue with ESPHome 2025.2.0 and later where it looks like the http_requests module won't change the watchdog settings on this chip, that I think can cause an issue. It is being tracked by: https://github.com/esphome/issues/issues/6767

But you don't appear to have the AirGradient API package enabled, so I wouldn't think that is related.

Depending on how far you want to go, you could enable some diagnostics that will give a bit more insight into why it rebooted, but usually it just tells me a watchdog.

diagnostic: github://MallocArray/airgradient_esphome/packages/diagnostic_esp32.yaml

Then check in HomeAssistant for this device under Diagnostic. It will show last reboot reason, how much free memory you have, etc.

I don't have MQTT enabled on mine, but can't image it eats up that much memory.

In the 5.x line I changed the framework to ESP-IDF, which is the major change, but mine has been up for 22 hours since my last firmware install without issue, so I don't think it is a universal problem, but I've certainly had situations where it would keep rebooting without reason.

You can also change the board package to one that keeps the Arduino framework, but recent changes to the LED package won't be compatible, so it would need to be an earlier version as well

Something like:

  board: github://MallocArray/airgradient_esphome/packages/[email protected]
  led: github://MallocArray/airgradient_esphome/packages/[email protected]

MallocArray avatar Mar 23 '25 21:03 MallocArray

Thanks for the info. Just flashed with the diagnostic package, it restarted after ~400 s with the reason as watchdog. Then restarted two more times after <60 s uptime, again with watchdog as the reason. Heap free is >151k, temp is <37°C. It is quite possible the problem is more correlated with newer ESPHome than anything in this config. I dont think the framework is the issue, since I had the same problem with very frequent restarts on v4.x.

amarshall avatar Mar 23 '25 23:03 amarshall

My Heap Free is around 171k with the base config plus diagnostic.

If you wanted to dig deep, you could collect logs from your ESPHome server so they are fully decrypted and then get on the ESPHome discord to post them for assistance.

Also, with the change to IDF, you need to do one USB flash so it can reformat the internal storage, or the device may reboot to the older firmware. Not sure that is related to what you are encountering, but something to be aware of.

MallocArray avatar Mar 24 '25 00:03 MallocArray

This is the difference of rebooting one of my 2 Access Points when a device is in a regular reboot state

Image

MallocArray avatar Mar 24 '25 17:03 MallocArray