siku2 / hass-weatherlink

Home Assistant integration for Davis Instruments' WeatherLink and AirLink
MIT License
27 stars 7 forks source link

Entities Becoming Unavailable #7

Closed NRutt2005 closed 3 years ago

NRutt2005 commented 3 years ago

Any reason why the entities keep becoming unavailable on a regular basis? Everyday I have to "reload". Something keeps causing the integration to break each day. Anyone else having this issue?

siku2 commented 3 years ago

Logs would certainly help here

lanky8804 commented 3 years ago

I also have this issue, some logs to help hopefully

`This error originated from a custom integration.

Logger: custom_components.weatherlink Source: helpers/update_coordinator.py:193 Integration: WeatherLink (documentation, issues) First occurred: 8:52:05 AM (14 occurrences) Last logged: 11:20:37 AM

Error requesting state data: Cannot connect to host 192.168.1.199:80 ssl:default [Connect call failed ('192.168.1.199', 80)]`

`Logger: homeassistant.components.rest.data Source: components/rest/data.py:69 Integration: RESTful (documentation, issues) First occurred: 8:52:28 AM (6 occurrences) Last logged: 11:02:19 AM

Error fetching data: http://192.168.1.199/v1/current_conditions failed with [Errno 111] Connect call failed ('192.168.1.199', 80)`

lanky8804 commented 3 years ago

`Logger: homeassistant.components.rest.data Source: components/rest/data.py:69 Integration: RESTful (documentation, issues) First occurred: 8:52:28 AM (7 occurrences) Last logged: 11:25:19 AM

Error fetching data: http://192.168.1.199/v1/current_conditions failed with [Errno 111] Connect call failed ('192.168.1.199', 80)`

siku2 commented 3 years ago

This looks like the issue is with the WeatherLink hardware, not this integration. Have you adjusted the polling interval by any chance? The WeatherLink station is not a powerful device by any means, so if you request data too often it will cause issues.

Either way, I believe this should be handled more gracefully. Perhaps the integration could only actually mark the data as "unavailable" if it failed more than 3 times in a row?

lanky8804 commented 3 years ago

So for me personally I have the polling interval at 10sec mainly as I am after having the wind update as quickly as possibly, 2.5sec would be even better to match the live output.

Yes having a clause like after 3 failures is a good idea.

Or if possilbe split the rain and wind off with a poll rate of 2.5sec then the rest as 10, 20, 30 sec etc??

Keep up the good work this is an excellent integration.

siku2 commented 3 years ago

Or if possilbe split the rain and wind off with a poll rate of 2.5sec then the rest as 10, 20, 30 sec etc??

Unfortunately that's not possible (the WeatherLink API is very underwhelming from a technical perspective). There's only a single API endpoint which yields all the data at once. Hopefully that should no longer be a problem once I get around to #8 though.

NRutt2005 commented 3 years ago

@siku2 Here is my logs data. At least I think this is the information you're looking for. Let me know if this isn't it and I will try to find what you are looking for. My refresh interval is set to the default of 30. Thank you for your continued work!

Error requesting state data: Cannot connect to host 192.168.0.54:80 ssl:default [Connect call failed ('192.168.0.54', 80)] 5:03:20 PM – (ERROR) WeatherLink (custom integration) - message first occurred at June 4, 2021, 12:12:35 AM and shows up 10 times TemplateError('UndefinedError: 'None' has no attribute 'conditions'') while processing template 'Template("{{ state_attr("sensor.davis_vantage_pro_curr", "data")["conditions"][0]["temp"] }}")' for attribute '_state' in entity 'sensor.temp' 5:03:18 PM – (ERROR) Template - message first occurred at June 5, 2021, 12:06:13 AM and shows up 40 times Empty reply found when expecting JSON data 5:03:18 PM – (WARNING) RESTful - message first occurred at June 5, 2021, 12:06:13 AM and shows up 14 times

NRutt2005 commented 3 years ago

Also, when I clicked on the error in the logs I received these details.

"This error originated from a custom integration.

Logger: custom_components.weatherlink Source: helpers/update_coordinator.py:200 Integration: WeatherLink (documentation, issues) First occurred: June 4, 2021, 12:12:35 AM (10 occurrences) Last logged: 5:03:20 PM

Error requesting state data: Cannot connect to host 192.168.0.54:80 ssl:default [Connect call failed ('192.168.0.54', 80)] Error requesting state data: Server disconnected"

siku2 commented 3 years ago

Should be fixed by #9 which will be released as part of v0.5.0