MallocArray / airgradient_esphome

ESPHome definition for an AirGradient DIY device to send data to HomeAssistant and AirGradient servers
GNU General Public License v3.0
244 stars 42 forks source link

Connection refused when "Upload to AirGradient Dashboard" is enabled #47

Closed andyad8865 closed 7 months ago

andyad8865 commented 7 months ago

Device info:

this is related to #33

Error: [15:22:58][W][http_request:087]: HTTP Request failed; URL: http://hw.airgradient.com/sensors/airgradient:<MAC-ADDR>/measures; Error: connection refused; Duration: 0 ms

I have edited out the MAC address and replaced it with <MAC-ADDR>

i have made sure it is added to the dashboard and the MAC address matches on both the URL in the error and the dashboard

image

other than that everything appears to work ok with the AG-ONE V9

MallocArray commented 7 months ago

Are you setting a static IP in the YAML file, or letting it get one from DHCP? If static, make sure you have a DNS server defined.

I have the same version of ESPHome working with my ONE, so for troubleshooting you may try using the official AirGradient firmware to see if it works. That will confirm that the registration on the dashboard is correct. (Double check that what you added to the dashboard is all lower case and matches what is shown on the ONE display when it first boots up)

andyad8865 commented 7 months ago

I have just installed the stock firmware from the airgradiant firmware and the dashboard shows the data for the AG-One:

image
andyad8865 commented 7 months ago

i'm going to now reinstall esphome, currently it runs in dhcp mode with the dns server set from the dhcp server

andyad8865 commented 7 months ago

Ah, I think I have found the issue, it appears it did not pick-up the DNS entries from the DHCP Server and had both DNS entries set at 0.0.0.0, I have now added a static entry into the config and it is now reporting back.

[18:43:41][D][http_request:099]: HTTP Request completed; URL: http://hw.airgradient.com/sensors/airgradient:<MAC-ADDR>/measures; Code: 200; Duration: 603 ms

Sorry for the confusion, it appears I was a little blind when setting up the YAML file

MallocArray commented 7 months ago

Odd that it didn't grab DNS from DHCP, but glad you were able to nail it down. This will be a good reminder that if others get Connection Refused, to check DNS or add a manual entry.