tlskinneriv / awnet_local

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

format_mac(call.data.get('PASSKEY', None)) Error, integrations not working #4

Closed pbix closed 2 years ago

pbix commented 2 years ago

I have encountered the below error. All sensors show "unavailable" and the logs include the following:

HA Core version is 2022.5.4 HASS version 7.6

My WS-2902C Station has v4.3.3 firmware loaded. The customized server is enabled, "Ambient Weather" set as the protocol and the IP set to my HA address. I tried to set the path to '?' but it does not stick and each time I return to the page it shows blank in this field.

==================================LOG Error Observed========================================= 2022-05-21 21:48:28 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/api/init.py", line 326, in post await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1627, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1664, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/awnet_local/init.py", line 51, in async_handle_update mac = format_mac(call.data.get('PASSKEY', None)) File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 134, in format_mac if len(to_test) == 17 and to_test.count(":") == 5: TypeError: object of type 'NoneType' has no len()

tlskinneriv commented 2 years ago

Hi! I am running the same specs as you are (HA 2022.05.4, OS 7.6, and firmware 4.3.3 on the WS2902-C). I am running version 1.1.25 of the app on Android 12 (Pixel 6) and am able to set the Path part of the Customized settings okay. For the settings to be sent to the unit, the Save button must be hit at the bottom of the form and then the Finish button in the top right corner (at least on that Android version of the app).

pbix commented 2 years ago

As an update from my side, I did finally get this to work.

I agree that setting the Path in the app is tricky. You have to save it and finish. This will cause problems for many and I can only suggest that users go back and check at all the settings in the WS2902-C are correct after leaving the screen. This did cause me problems. BTW, its not even mentioned in the component documentation that these needs to be done. Its seems to be only in the Add-On Readme. It took me several hours to realize this critical step was needed, as obvious as it is after the fact.

The other issue I have seen is that not all the sensors defined in the integration are supported by the WS2602-C. This causes python execution errors to appear in the logs when they are enabled. I resolved these by disabling all sensors and then just enabling the few I wanted. Not sure what the best course here might be other than to only enable the sensors that work in all the stations by default.

Finally, there is a bug in the Add-On that causes the overlay error that Doonga notes in the issue over there. I had to switch to his Fork to get the add on to work. I can confirm that his Fork works.

Thanks for your work on this. Its nice to finally have local access to information from my weather station.

tlskinneriv commented 2 years ago

@pbix Updated the docs both here and in the add-on to help folks in the future. Thanks for the feedback! Also updated the add-on to take care of that bug.