Hey, this is also the kind of behaviour I was expecting from an ‘open-source’ product. Thanks for putting this together.
I’ve almost got it working, but something’s wrong, I wonder if you have any ideas…
- I’m redirecting hw.airgradient.com to a local IP
- I’m running the custom cloud, and it has connected to the MQTT broker:
> airgradient2mqtt@1.0.0 start
> node app.js
[2024-04-04T14:53:31.370Z] [INFO] Airgradient DummyCloud listening on port 80
[2024-04-04T14:53:31.871Z] [INFO] Connected to MQTT broker
[2024-04-04T14:53:31.879Z] [INFO] Successfully subscribed to MQTT command topics [ { topic: 'airgradient2mqtt/+/+/set', qos: 0 } ]
But there is no traffic on the log there. When I look at traffic using tcpdump, it seems like the device is trying to configure itself on the server before sending data:
$ tcpdump port 80 -A
09:45:24.813854 IP 192.168.1.70.63430 > hw.airgradient.com.http: Flags [F.], seq 207, ack 451, win 5294, length 0
E..(......7....F...f...P.h....D.P.......... ..
09:45:24.814239 IP hw.airgradient.com.http > 192.168.1.70.63430: Flags [F.], seq 451, ack 208, win 64034, length 0
E..(..@.@..#...f...F.P....D..h..P.."....
09:45:24.820162 IP 192.168.1.70.63430 > hw.airgradient.com.http: Flags [.], ack 452, win 5293, length 0
E..(......7....F...f...P.h....D.P........ ....
09:45:25.817167 IP 192.168.1.70.63431 > hw.airgradient.com.http: Flags [S], seq 3311957983, win 5744, options [mss 1436], length 0
E..,......7....F...f...P.hw.....`..p.q......ai
09:45:25.817257 IP hw.airgradient.com.http > 192.168.1.70.63431: Flags [S.], seq 2579958856, ack 3311957984, win 64240, options [mss 1460], length 0
E..,..@.@......f...F.P.....H.hw.`...=.......
09:45:25.819769 IP 192.168.1.70.63431 > hw.airgradient.com.http: Flags [.], ack 1, win 5744, length 0
E..(......7....F...f...P.hw....IP..p9.........
09:45:25.828429 IP 192.168.1.70.63431 > hw.airgradient.com.http: Flags [P.], seq 1:207, ack 1, win 5744, length 206: HTTP: GET /sensors/airgradient:84fce6099488/config?attempt=3&fw=0.4.0 HTTP/1.1
E.........6....F...f...P.hw....IP..p....GET /sensors/airgradient:84fce6099488/config?attempt=3&fw=0.4.0 HTTP/1.1
Host: hw.airgradient.com
User-Agent: ESP32HTTPClient
Connection: keep-alive
Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
09:45:25.828462 IP hw.airgradient.com.http > 192.168.1.70.63431: Flags [.], ack 207, win 64034, length 0
E..(..@.@..F...f...F.P.....I.hx.P.."Uu..
09:45:25.829605 IP hw.airgradient.com.http > 192.168.1.70.63431: Flags [P.], seq 1:451, ack 207, win 64034, length 450: HTTP: HTTP/1.1 404 Not Found
E.....@.@......f...F.P.....I.hx.P.."....HTTP/1.1 404 Not Found
X-Powered-By: Express
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 178
Date: Thu, 04 Apr 2024 15:45:25 GMT
Connection: keep-alive
Keep-Alive: timeout=5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /sensors/airgradient:84fce6099488/config</pre>
</body>
</html>
09:45:25.835695 IP 192.168.1.70.63431 > hw.airgradient.com.http: Flags [F.], seq 207, ack 451, win 5294, length 0
E..(......7....F...f...P.hx.....P...9'..HTTP..
09:45:25.835918 IP hw.airgradient.com.http > 192.168.1.70.63431: Flags [F.], seq 451, ack 208, win 64034, length 0
E..(..@.@..D...f...F.P.......hx.P.."S...
09:45:25.838453 IP 192.168.1.70.63431 > hw.airgradient.com.http: Flags [.], ack 452, win 5293, length 0
E..(......7....F...f...P.hx.....P...9'..HTTP.,