Core: NWS integration Error Bad Gateway

Created on 15 May 2020  路  1Comment  路  Source: home-assistant/core

The problem

NWS integration Error and becomes unavailable, after reboot comes back for 1 min or 2 and then errors out again.

Environment

  • Home Assistant Core release with the issue: 0.109.6
  • Last working Home Assistant Core release (if known): 0.109.5
  • Operating environment (Home Assistant/Supervised/Docker/venv): Docker Raspberry Pi3
  • Integration causing this issue: NWS
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/nws

Problem-relevant configuration.yaml


Traceback/Error logs

Log Details (ERROR)
Logger: homeassistant.components.nws
Source: helpers/update_coordinator.py:111
Integration: National Weather Service (NWS) (documentation, issues)
First occurred: 10:40:11 AM (9 occurrences)
Last logged: 12:32:03 PM

Error requesting NWS forecast hourly station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/gridpoints/ILN/44,48/forecast/hourly
Error requesting NWS observation station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/stations/KHAO/observations/
Error requesting NWS forecast station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/gridpoints/ILN/44,48/forecast
Error requesting NWS observation station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/stations/KHAO/observations

2020-05-15 12:31:46 ERROR (MainThread) [homeassistant.components.nws] Error requesting NWS forecast hourly station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/gridpoints/ILN/44,48/forecast/hourly
2020-05-15 12:32:03 ERROR (MainThread) [homeassistant.components.nws] Error requesting NWS forecast station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/gridpoints/ILN/44,48/forecast
2020-05-15 12:03:15 ERROR (MainThread) [homeassistant.components.nws] Error requesting NWS observation station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/stations/KHAO/observations/
2020-05-15 11:21:13 ERROR (MainThread) [homeassistant.components.nws] Error requesting NWS forecast hourly station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/gridpoints/ILN/44,48/forecast/hourly
2020-05-15 11:21:13 ERROR (MainThread) [homeassistant.components.nws] Error requesting NWS forecast station KHAO data: 502, message='Bad Gateway', url='https://api.weather.gov/gridpoints/ILN/44,48/forecast

Additional information

nws

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings