Failures when reading JSON over local http

I’m getting intermittent failures with all 3 of my airgradient sensors (2 indoors, 1 outdoors). I have the sensors on my LAN, with no connection to the internet (blocked with a firewall rule). I am logging data every minute, and I’m seeing a failure every 15 minutes in the log, with intermittent periods of no errors about every 150 minutes, although this varies a bit. The sensor that is giving me the most trouble is the outdoor one. I just flashed it with the latest version (3.0.9 Release), and swapped the power supply, but I’m having the same issue.

Digging into it, this worked for a little while after I flashed it:

# curl "http://192.168.45.123/measures/current"
{"wifi":-50,"serialno":"84fce60bf7f8","rco2":739,"pm01":0,"pm02":0,"pm10":0,"pm003Count":141,"atmp":18.15,"rhum":78,"tvocIndex":104,"tvoc_raw":30240,"noxIndex":1,"nox_raw":16554,"boot":6,"ledMode":"co2","firmwareVersion":"3.0.9","fwMode":"O-1PST"}

But then I get this:

# curl "http://192.168.45.123/measures/current"
curl: (28) Failed to connect to 192.168.45.123 port 80 after 75084 ms: Couldn't connect to server

So I guess I’m reporting 2 problems, but they may be related. I can work around the intermittent failures, but the outdoor sensor just stops responding and never seems to recover until I power cycle it.

We would like to look into this. Could you please log the serial debug messages from the monitor and send us?

Here is some log data following a reboot - please let me know if you need anything else.

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x420696ee
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x438
load:0x403cc710,len:0x918
load:0x403ce710,len:0x25f4
entry 0x403cc710
Serial nr: 84fce60bf7f8
Detect OPEN_AIR
Server configuration: 
inF: false
inUSAQI: false
useRGBLedBar: 2
Model: 
MQTT Broker: 
S8 calibration period: -1
Firmware Version: 3.0.9
Found S8 on Serial1
Found PMS 1 on Serial0
Firmware Mode: O-1PST
Connecting to WiFi...
*wm:AutoConnect 
*wm:Connecting to SAVED AP: MEGASEGA
*wm:connectTimeout not set, ESP waitForConnectResult... 
*wm:AutoConnect: SUCCESS 
*wm:STA IP Address: 192.168.45.123
Webserver init: airgradient_84fce60bf7f8.local
Post payload: {"wifi":-64,"boot":0}
Post response failed code: -1
WiFi connected!
IP address: 
192.168.45.123
CO2 (ppm): 1112

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 132
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 0
TVOC raw: 30325
NOx index: 0
NOx raw: 17238

TVOC index: 0
TVOC raw: 30333
NOx index: 0
NOx raw: 17235

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 114
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 0
TVOC raw: 30327
NOx index: 0
NOx raw: 17221

TVOC index: 0
TVOC raw: 30324
NOx index: 0
NOx raw: 17220
CO2 (ppm): 1112

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 120
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 0
TVOC raw: 30323
NOx index: 0
NOx raw: 17206

TVOC index: 0
TVOC raw: 30329
NOx index: 0
NOx raw: 17198

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 126
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 0
TVOC raw: 30327
NOx index: 0
NOx raw: 17191

TVOC index: 0
TVOC raw: 30326
NOx index: 0
NOx raw: 17182
Post payload: {"wifi":-66,"rco2":1112,"pm01":0,"pm02":0,"pm10":0,"pm003_count":126,"atmp":19.33,"rhum":58,"tvoc_index":0,"tvoc_raw":30326,"nox_index":0,"nox_raw":17182,"boot":0}
Post response failed code: -1
CO2 (ppm): 1114

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 102
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 2
TVOC raw: 30323
NOx index: 1
NOx raw: 17139

TVOC index: 4
TVOC raw: 30312
NOx index: 1
NOx raw: 17139

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 84
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 7
TVOC raw: 30321
NOx index: 1
NOx raw: 17127
CO2 (ppm): 1117

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 84
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 26
TVOC raw: 30317
NOx index: 1
NOx raw: 17095

TVOC index: 29
TVOC raw: 30329
NOx index: 1
NOx raw: 17088

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 90
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 33
TVOC raw: 30318
NOx index: 1
NOx raw: 17077

TVOC index: 36
TVOC raw: 30321
NOx index: 1
NOx raw: 17066
CO2 (ppm): 1118

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 81
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 40
TVOC raw: 30321
NOx index: 1
NOx raw: 17066

TVOC index: 43
TVOC raw: 30320
NOx index: 1
NOx raw: 17055

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 96
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 46
TVOC raw: 30316
NOx index: 1
NOx raw: 17049

TVOC index: 48
TVOC raw: 30314
NOx index: 1
NOx raw: 17048
CO2 (ppm): 1119

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 90
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 51
TVOC raw: 30317
NOx index: 1
NOx raw: 17040

TVOC index: 54
TVOC raw: 30314
NOx index: 1
NOx raw: 17035

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 93
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 56
TVOC raw: 30324
NOx index: 1
NOx raw: 17025

TVOC index: 58
TVOC raw: 30317
NOx index: 1
NOx raw: 17022
CO2 (ppm): 1121

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 93
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 61
TVOC raw: 30305
NOx index: 1
NOx raw: 17006

TVOC index: 63
TVOC raw: 30314
NOx index: 1
NOx raw: 17007

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 99
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 63
TVOC raw: 30314
NOx index: 1
NOx raw: 17007
CO2 (ppm): 1124

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 99
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 73
TVOC raw: 30316
NOx index: 1
NOx raw: 16973

TVOC index: 74
TVOC raw: 30314
NOx index: 1
NOx raw: 16972

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 90
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 76
TVOC raw: 30313
NOx index: 1
NOx raw: 16967

TVOC index: 77
TVOC raw: 30318
NOx index: 1
NOx raw: 16956
CO2 (ppm): 1125

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 66
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 78
TVOC raw: 30312
NOx index: 1
NOx raw: 16955

TVOC index: 79
TVOC raw: 30318
NOx index: 1
NOx raw: 16950

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 75
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 81
TVOC raw: 30312
NOx index: 1
NOx raw: 16945

TVOC index: 82
TVOC raw: 30302
NOx index: 1
NOx raw: 16940
CO2 (ppm): 1126

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 69
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 83
TVOC raw: 30306
NOx index: 1
NOx raw: 16933

TVOC index: 84
TVOC raw: 30310
NOx index: 1
NOx raw: 16930

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 87
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 85
TVOC raw: 30301
NOx index: 1
NOx raw: 16924

TVOC index: 86
TVOC raw: 30307
NOx index: 1
NOx raw: 16912
CO2 (ppm): 1127

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 87
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 87
TVOC raw: 30311
NOx index: 1
NOx raw: 16916

TVOC index: 88
TVOC raw: 30304
NOx index: 1
NOx raw: 16909

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 72
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 89
TVOC raw: 30293
NOx index: 1
NOx raw: 16902
CO2 (ppm): 1130

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 72
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 92
TVOC raw: 30302
NOx index: 1
NOx raw: 16882

TVOC index: 93
TVOC raw: 30301
NOx index: 1
NOx raw: 16877

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 93
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 94
TVOC raw: 30287
NOx index: 1
NOx raw: 16867

TVOC index: 95
TVOC raw: 30292
NOx index: 1
NOx raw: 16873

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 93
[1] Temperature in C: 19.33
[1] Relative Humidity: 58
CO2 (ppm): 1132

TVOC index: 95
TVOC raw: 30292
NOx index: 1
NOx raw: 16860

TVOC index: 96
TVOC raw: 30289
NOx index: 1
NOx raw: 16855

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 102
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 96
TVOC raw: 30297
NOx index: 1
NOx raw: 16852

TVOC index: 97
TVOC raw: 30300
NOx index: 1
NOx raw: 16850

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 108
[1] Temperature in C: 19.33
[1] Relative Humidity: 58
CO2 (ppm): 1134

TVOC index: 97
TVOC raw: 30293
NOx index: 1
NOx raw: 16843

TVOC index: 97
TVOC raw: 30298
NOx index: 1
NOx raw: 16843

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 108
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 98
TVOC raw: 30295
NOx index: 1
NOx raw: 16830

TVOC index: 98
TVOC raw: 30284
NOx index: 1
NOx raw: 16837

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 105
[1] Temperature in C: 19.33
[1] Relative Humidity: 58
CO2 (ppm): 1135

TVOC index: 99
TVOC raw: 30291
NOx index: 1
NOx raw: 16820
Post payload: {"wifi":-65,"rco2":1135,"pm01":0,"pm02":0,"pm10":0,"pm003_count":105,"atmp":19.33,"rhum":58,"tvoc_index":99,"tvoc_raw":30291,"nox_index":1,"nox_raw":16820,"boot":1}
Post response failed code: -1
CO2 (ppm): 1136

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 228
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

TVOC index: 100
TVOC raw: 30292
NOx index: 1
NOx raw: 16803
CO2 (ppm): 1136

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 213
[1] Temperature in C: 19.33
[1] Relative Humidity: 58

I left the log window open for a while and eventually I got this:

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 81
[1] Temperature in C: 22.40
[1] Relative Humidity: 58

TVOC index: 100
TVOC raw: 30163
NOx index: 1
NOx raw: 15615

TVOC index: 100
TVOC raw: 30165
NOx index: 1
NOx raw: 15613

[1] PM1 ug/m3: 0
[1] PM2.5 ug/m3: 0
[1] PM10 ug/m3: 0
[1] PM3.0 Count: 87
[1] Temperature in C: 22.40
[1] Relative Humidity: 58

TVOC index: 100
TVOC raw: 30163
NOx index: 1
NOx raw: 15618
Terminal disconnected: NetworkError: The device has been lost.

Thank you. We will look into it and get back.

I have been playing with this some more. I am starting to suspect my Ubiquiti Dream Router access point. I started seeing trouble in the log files for the Airgradient on May 8th. My router updated itself on May 4th to UniFi Network Application 8.1.127.

I have been rebooting it and things seem to be working well after the reboots, so this may have been a problem with my wifi network (can we get an Airgradient POE version?? :slight_smile: ). I need to let it run for a couple of weeks and see if things are any different - I will update this thread with the results. Thanks!

I forgot to report back too and our engineers also suspected some local firewall issue. We also did not hear any similar issue from anybody else.

PoE has been discussed a few times here. Just search the forum for the posts.

Awesome, thanks guys!