The ESP8266 module for the emonTx runs what I’d describe as a pretty basic sketch. It’s functional, but it’s not very good at telling me what’s gone wrong.
On Monday, I re-imaged the router to upgrade it. A side effect was a setting I’d changed for the DHCP options (what the local DNS is) wasn’t present in my scripts for auto-configuring the router.
On Wednesday, I rebooted the ESP8266 + emonTx because data wasn’t showing up in the dashboard. I sort of connected this event to the re-image of the router, but more as a “oh, perhaps it got annoyed about losing the connection somehow”; it’s been flaky before about Wi-Fi signals (and there’s a whole separate rant about how USB Wi-Fi dongles are terrible at doing AP mode).
This morning, things still weren’t working, so I started poking some more. It turns out I’d not propagated that DNS setting properly when I rebuilt the router, and the ESP8266 module only does IPv4 connectivity – my PC does IPv4 and IPv6 and I didn’t notice the lack of IPv4 DNS server being advertised by the router, because the DNS server also listens on the IPv6 interface. Fixed that, restarted the ESP8266 and presto, I can see GET requests showing up on the emoncms server.
Wait. Why 401?
Turns out I used the device key as an API key, and that doesn’t work.