custom-components / weatheralerts

A sensor that gives you weather alerts from alerts.weather.gov.
MIT License
123 stars 15 forks source link

https://alerts.weather.gov does not exist anymore - this plugin works with https://alerts-v2.weather.gov/#/ #45

Closed catchthemonster closed 3 years ago

catchthemonster commented 3 years ago

Version of the custom_component

Describe the bug A clear and concise description of what the bug is.

Log

Add your logs here.
ericklindberg commented 3 years ago

Unfortunately I cannot locate any logs specific to the entity, however it seems daily I am having to disable then enable and restart to have the entity functioning properly. If I do not, it just shows unavailable indefinitely.

catchthemonster commented 3 years ago

I know, i found another python script that somehow integrates with home assistant ...

jlverhagen commented 3 years ago

@catchthemoster : To address this and clear up any possible confusion, the WeatherAlerts integration does not use the alerts.weather.gov endpoint, which does still exist (for now), to grab weather alerts. WeatherAlerts uses the official api.weather.gov API endpoint to fetch weather alerts. 3rd party access to weather alerts (such as via apps like Home Assistant) should be done using the official weather alerts API at api.weather.gov, as stated on the alerts-v2.weather.gov web page. WeatherAlerts currently only calls alerts.weather.gov to validate the zone and county IDs whenever Home Assistant starts up. The main weather alerts API had some inconsistencies that made it inaccurate for zone and county ID validation. Those inconsistencies appear to have been resolved, so the next version of WeatherAlerts will stop using alerts.weather.gov for zone and county ID validation and switch to api.weather.gov. All other weather alert requests are directed to the official NWS weather alert API at api.weather.gov. Since this API is free and likely processes a very high volume of requests, there will be frequent errors and timeouts. When they happen, they are logged in the home-assistant.log file if logging hasn't been disabled or restricted in the Home Assistant configuration. The timeouts and errors should not be fatal, and WeatherAlerts will keep trying until the request succeeds. If it's not succeeding, it's most likely a problem on the weather.gov side.

If WeatherAlerts isn't able to connect to the weather alerts API during Home Assistant startup, Home Assistant will continue to retry to setup WeatherAlerts but won't fully load it until it succeeds connecting to the alerts API. Until it succeeds, the associated entity will be unavailable. I will try to alter that behavior so when an API error occurs during startup, it will still setup WeatherAlerts, store the error in a weatheralerts entity attribute, log the error in the home-assistant.log file, and then continue trying to fetch the alerts.

jlverhagen commented 3 years ago

@ericklindberg : If you are still having issues, please post your state, zone, and county ID configuration so I can set them up to monitor for API errors. If disabling/re-enabling and then restarting gets things working again, I'd be interested in seeing the full home-assistant.log file before and after restarting to see exactly what errors Home Assistant is logging. Or at least a grep of the home-assistant.log file to filter out everything except the weatheralerts log lines. I've seen similar behavior with one other integration, but have not yet seen it with WeatherAlerts. If the entity becoming unavailable is something that is frequently occurring, I'd really like to track down the cause and get that fixed. I suspect it is caused by API errors when Home Assistant starts up, but the entity should come back after WeatherAlerts successfully connects to the API. To know exactly what's going on, I'd need the logs to see if there are any clues.