NWS integration quit working

This was working, but suddenly it quit. I am now getting the following in the log file:

2020-02-06 18:05:27 WARNING (MainThread) [homeassistant.components.weather] Setup of weather platform nws is taking over 10 seconds.
2020-02-06 18:05:35 ERROR (MainThread) [homeassistant.components.nws.weather] Error updating observation from station KBUR: 502, message=‘Bad Gateway’, url='https://api.weather.gov/stations/KBUR/observations
2020-02-06 18:05:35 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 424, in _async_add_entity
await entity.async_update_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 284, in async_update_ha_state
self._async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 327, in _async_write_ha_state
attr.update(self.state_attributes or {})
File “/usr/src/homeassistant/homeassistant/components/weather/init.py”, line 169, in state_attributes
self.precision,
File “/usr/src/homeassistant/homeassistant/helpers/temperature.py”, line 23, in display_temp
raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: 68

My config is about as simple as it gets:

weather:

Is this just a situation where the NWS server is down, or is something else going on? The bad gateway error would point to a server issue, but why am I getting the rest of the errors?

API seems to be down at the moment. The other errors are just the result of it being unable to get a proper temperature value.

Awesome. Thought I broke something :slight_smile:

This integration is down for me also, as well as a similar one - NOAA Alerts Custom Sensor (found in the HACS).

The NWS API server was down for awhile. When it came back up they also switched the API data format. There is a fix that will hopefully go live in the next 0.105.x release.

1 Like

What was changed and where did you get the info that a change was made?

There is no indication on the NWS website that the API has changed.

https://www.weather.gov/documentation/services-web-api

https://www.weather.gov/documentation/services-web-alerts

The server at least for weather info seems to be down again or I could check whether it is still true…

It was reported by a few users and my own observation that all numeric values except for a rare few are now being reported as strings. I tried randomly picking forecast points and observation stations and they all had the same behavior.

I have almost never seen the weather API service issues page provide info on actual outages. But they are obviously systemic outages, as I get reports from multiple users that it is all down simultaneously.

Yeah, I wasn’t really too concerned about the outage situation just the statement that “they also switched the API data format”.

I would hope if they changed that that they would issue some form of formal notice/documentation change.

The weather API has a disclaimer that they can change it at any time.

Well…yeah, but again, I would think that it would be accompanied by some sort of “hey, just so you know, this changed…” type of thing.

Maybe not. :man_shrugging:

I guess we’ll see…

EDIT:

But just as an FYI I just got a local alert a couple of hours ago about a winter weather advisory so the component I’m using is still working.

I think the disclaimer doesn’t apply to the weather alerts end point. It is very possible these are two separate server infrastructures

Looks like it’s down again. Is this just another outage, or another API change?

Here is what it says in the log:

2020-05-03 09:39:56 ERROR (MainThread) [homeassistant.components.weather] The nws platform for the weather integration does not support platform setup. Please remove it from your config.
2020-05-03 09:39:58 WARNING (zeroconf-Engine) [zeroconf] Exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/zeroconf/init.py”, line 1275, in handle_read
data, (addr, port, *v6) = socket.recvfrom(_MAX_MSG_ABSOLUTE)
OSError: [Errno 9] Bad file descriptor

I’m assuming you just upgraded to 0.109.x. Check the breaking change section in the release notes. It is only configured through the UI now (not decided by me).

You mean we are supposed to read that stuff???

Just kidding. Thanks for the quick response. Yes, that was my problem.

Mine is configured through the UI and it still giving a bad gateway this week. I assume the service is down or there was further breaking changes.

I think it is a convergence of a change in the code and reduced reliability of the NWS servers. I’m working on a fix to increase data availability.

1 Like

I had it working again after Matthew pointed out the changes in 0.109.x, but it quit working again yesterday.

For someone having issues, can someone put an issue on the home assistant GitHub? This will probably help motivate the core devs to accept the change I am going to make.

@MatthewFlamm If you tell me the best way to word the issue I would be more than happy to open an issue for this. I “can’t” even edit the UI to try the Lovelace configuration for NWS so it’s a bit frustrating for them to just pull the plug on handling your own configuration.