joons5834 / weather-forecast-accuracy

0 stars 0 forks source link

nws api error #34

Open joons5834 opened 2 years ago

joons5834 commented 2 years ago

nws_hr_fc_93_84_2021-09-24_01-00 nws_hr_fc_93_84_2021-09-21_00-00

{
    "correlationId": "fee70692",
    "title": "Unexpected Problem",
    "type": "https://api.weather.gov/problems/UnexpectedProblem",
    "status": 500,
    "detail": "An unexpected problem has occurred.",
    "instance": "https://api.weather.gov/requests/fee70692"
}

nws_hr_fc_93_84_2021-09-24_14-00 nws_hr_fc_93_84_2021-09-24_15-00 nws_hr_fc_93_84_2021-09-24_16-00 nws_hr_fc_93_84_2021-09-24_18-00

{
    "correlationId": "dc6da56",
    "title": "Forecast Grid Invalid",
    "type": "https://api.weather.gov/problems/ForecastMissingData",
    "status": 503,
    "detail": "The forecast grid is missing data for time 2021-09-30T18:00:00-07:00.",
    "instance": "https://api.weather.gov/requests/dc6da56"
}

nws_hr_fc_93_84_2021-09-29_05-00

<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>
An error occurred while processing your request.<p>
Reference&#32;&#35;102&#46;460dc17&#46;1632891608&#46;16075183
</BODY></HTML>

nws_hr_fc_93_84_2021-09-28_20-01 nws_hr_fc_93_84_2021-09-28_19-00

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
joons5834 commented 2 years ago

https://github.com/home-assistant/core/issues/35666#issuecomment-629408964

Thanks for the report. I see this as well. This is partially due to the upgrade to using the builtin data updator in the home assistant backend in 0.109, which removed caching of the data. This can be seen as positive change in case the data really is stale (hours old) and a user wants to set an automation on the current temperature for example.

But the NWS servers frequently have very short outages, and the NWS data doesn't update that often, particularly for forecasts. So, we should handle this better by caching the data for short amounts of time, say 15 minutes for observations and an hour for forecasts. We can also retry a data update more often when there is a failed update. I think this would be the best of both worlds: having robust information that isn't "unavailable" several times a day, while also preventing stale info being presented in home assistant.