tlskinneriv / awnet_local

Enables local support for Ambient Weather personal weather stations.
27 stars 5 forks source link

Errors in AWSNET to HASS #6

Closed ObiWanCanOweMe closed 2 years ago

ObiWanCanOweMe commented 2 years ago

Hi,

Trying to set this up and things aren't working correctly. I followed the instructions and configured the addon, the integration, and the WS-5000 Weather Services. Once everything is running here is what I get from the addon logs:

AWNET to HASS.log

When I go into developer tools to check the service, this is what happens when I call the Ambient Weather Local: Update Weather Information service:

service_call_error.txt

Running on the latest versions of everything. Appreciate any guidance you can offer :)

tlskinneriv commented 2 years ago

Hi!

Based on the AWNET to HASS log, it looks like the information coming from the weather station is not coming through with the right formatting. The add-on is expecting a query string at any path (the '?' in the config). The logs from the service call further confirms that it was unable to parse properly.

Have you checked the custom setup in the app to make sure that the format is set to use the Ambient Weather format and not the Wunderground format? Also, which version of firmware and app are you using? Unfortunately, I do not have a WS-5000 to test with and only a WS-2902C, but I would expect them to behave the same on the same firmware.

EDIT: missed that last line for the latest versions, disregard.

ObiWanCanOweMe commented 2 years ago

Here’s the config from the WS-5000 interface:

Screenshot 2022-07-30 232037

I'm running Version: WH2682B_V2.1.7on the station. I also double-checked the MAC address to make sure it is consistent as well.

tlskinneriv commented 2 years ago

Interesting. Based on the changelog for the firmware, it seems that the custom server feature came out in 4.2.8 (https://ambientweather.com/support, WiFi Firmware Update and Changes section). I am currently running firmware 4.3.3, but started to develop and use this add-on at 4.2.9, and it has been the same format since. Is the above configuration performed through the app?

Also, here is an example of a query string that the add-on is expecting to receive:

?stationtype=AMBWeatherV4.3.3&PASSKEY=C4:5B:BE:XX:XX:XX&dateutc=2022-07-31+03:37:53&tempinf=75.4&humidityin=52&baromrelin=30.219&baromabsin=30.148&tempf=75.2&battout=1&humidity=98&winddir=283&windspeedmph=0.0&windgustmph=0.0&maxdailygust=6.9&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=2.520&monthlyrainin=11.039&totalrainin=48.461&solarradiation=0.00&uv=0&batt_co2=1

The PASSKEY parameter is what the add-on uses to parse the MAC address and send the data to the right instance of the integration in HA. You should see output like that in the add-on logs if things are setup as the add-on needs.

ObiWanCanOweMe commented 2 years ago

I'm configuring the customized weather services on the station through the web server that runs on the console.

I set up netcat to capture the output from the station and this is what it sends:

GET ?MAC=E8:68:E7:XX:XX:XX
&stationtype=WH2682B_V2.1.7&dateutc=2022-07-31+03:49:33&tempf=72.50&humidity=99&windspeedmph=0.00&windgustmph=2.01&maxdailygust=7.38&winddir=164&winddir_avg10m=97&uv=0&solarradiation=0.00&hourlyrainin=0.898&dailyrainin=1.535&weeklyrainin=1.752&monthlyrainin=4.236&yearlyrainin=4.236&totalrainin=4.236&battout=1&battrain=1&tempinf=71.42&humidityin=54&baromrelin=30.156&baromabsin=29.226&battin=1&temp1f=68.54&humidity1=53&batt1=1&temp2f=74.12&humidity2=43&batt2=1&soilhum1=81&battsm1=1&pm25_in=23.0&pm25_in_24h=15.5&aqi_pm25_in=74&aqi_pm25_in_24h=58&batt_25in=1 HTTP/1.1
Host: homeassistant.local
Connection: close
User-Agent: WH2682B

Don't see anywhere to view or set a passkey, maybe that isn't a thing in the WS-5000?

tlskinneriv commented 2 years ago

It's quite possible that the WS-5000 does send the MAC as a different field. However, this is enough information for me to be able to patch in support for it since we've got the full format of a message from it now. Currently the integration is only checking for PASSKEY, but there's no reason the integration can't check for PASSKEY or MAC. I should have some time this afternoon to put a patch in for this. Standby for an update.

ObiWanCanOweMe commented 2 years ago

This looks to have resolved the issue. Seeing 200s in the logs now:

s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
192.168.1.104 - - [01/Aug/2022 00:12:02] "GET ?MAC=E8:68:E7:XX:XX:XX" 200 0
192.168.1.104 - - [01/Aug/2022 00:12:13] "GET ?MAC=E8:68:E7:XX:XX:XX" 200 0
192.168.1.104 - - [01/Aug/2022 00:12:24] "GET ?MAC=E8:68:E7:XX:XX:XX" 200 0

However entities are not getting updated. I'll open another issue for that though. Thanks!