US NWS weather observations and forecast

I see one other report of this error in hassio for a custom component. Do you have any other custom components that work?

Yes I do. The only one that doesn’t work is “NWS”. When I get a few minutes, I thought I would remove it and put in a clean set of files for it and restart it again.

Do you have the manifest.json file? The first version did not have this and then home assistant changed structure and I had to add it. If not, adding it should hopefully fix it.

Just checked. NO manifest file. Will pull new files when I get home.
I’ll let you know if that clears things up.


Pulled new files and restarted. Everything is working fine now with no errors.
Thank you

I updated to .97.0 yesterday. Seems that this stopped working. See log info:

2019-08-08 08:08:08 WARNING (MainThread) [] Setup of platform nws is taking over 10 seconds.
2019-08-08 08:08:08 ERROR (MainThread) [] nws: Error on device update!
Traceback (most recent call last):
File “/config/custom_components/nws/”, line 195, in async_update
self._forecast = await self._nws.forecast_hourly()
File “/usr/local/lib/python3.7/site-packages/pynws/”, line 44, in forecast_hourly
return await forecast_hourly(*self.latlon, self.session, self.userid)
File “/usr/local/lib/python3.7/site-packages/pynws/”, line 116, in forecast_hourly
res = await get_hour_forc_from_pnt(lat, lon, websession, userid)
File “/usr/local/lib/python3.7/site-packages/pynws/”, line 109, in get_hour_forc_from_pnt
async with websession.get(url, headers=header) as res:
File “/usr/local/lib/python3.7/site-packages/aiohttp/”, line 1005, in aenter
self._resp = await self._coro
File “/usr/local/lib/python3.7/site-packages/aiohttp/”, line 497, in _request
await resp.start(conn)
File “/usr/local/lib/python3.7/site-packages/aiohttp/”, line 844, in start
message, payload = await # type: ignore # noqa
File “/usr/local/lib/python3.7/site-packages/aiohttp/”, line 588, in read
await self._waiter

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/”, line 291, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/”, line 417, in async_device_update
await self.async_update()
File “/config/custom_components/nws/”, line 195, in async_update
self._forecast = await self._nws.forecast_hourly()
File “/usr/local/lib/python3.7/site-packages/async_timeout/”, line 45, in exit
File “/usr/local/lib/python3.7/site-packages/async_timeout/”, line 92, in _do_exit
raise asyncio.TimeoutError

******* Seems to be working now. I guess a few hours of patience was needed… ********

Looks like the request timed out, could have been on the NWS side. It looks like both the setup call to get the station and the forecast update were slow. Glad it is working overall.

The PR is moving along so this may be an officially supported integration soon.

NWS integration was just merged into dev branch of homeassistant! Look for the integration probably starting in v0.99.0.

Make sure to delete your custom component nws folder when that happens, but the configuration should be identical. I don’t think that there are any breaking changes between the custom component and the official version, but user beware since I don’t know who is using what version of the custom component (as if I versioned the custom component :shushing_face:). I would consult the official documentation at that time to make sure your config is still valid.

Next up will be trying to get precip probability as a supported forecast frontend display.

Hey, congrats on the official implementation!

Thanks for your effort.

Thanks for the work on this. I haven’t had much luck with Darksky being accurate and this will be much better. Any updates on the custom card? Right now I’m out of sync with day/night as is mentioned in this post.

Someone is welcome to adjust one of the many custom cards out there to work. I had a change to the built-in card, but this cannot be made into a custom card easily.

The change to the built-in card needs changes to the weather component itself in the back and frontend, so it requires some discussion on the architecture repo. Now that nws integration is merged, it should be easier to argue for the changes, but no gaurentee that these will be accepted.

I would rather say that day and night are in sync, just the display is confusing.

Matthew I just came across this post you did, now that explain exactly how to do it… Thanks

I assume you cannot use these parameters with this integration anymore? I tried them and it stopped working until I commented them out. I was trying to come up with a custom card but it was not pulling data in right so back to the board on that.


Those should all work, can you post a more complete configuration and any errors in the logs?

Also, don’t use this custom component any more, it won’t be maintained.

I was able to get the Lat/Long working but it does not like when I put the “name” field in. No errors in the logs just will not show the data output of weather.kroa. Not a big deal I can rename it in customization and the card. Not sure why the name field would kill it but its HA strange things happen. Below is what I get when I use the below config.


  • platform: nws
    api_key: !secret nws_api
    latitude: !secret homeassistant_latitude
    longitude: !secret homeassistant_longitude
    mode: hourly
    station: !secret nws_station
    name: Lexington Weather

Checked logs each time its not giving an error on it.

The name of the entity changes when you use the name parameter, check your unused entities or the states tab in the developer tools.

Ok I am an idiot and a duh moment, yes you were right the name showed up. I totally forgot about it changing the entity name… Thanks we are on track now.

With DarkSky going away I am working on migrating to this excellent integration. It’s working great so far but I am wondering what the community thinks about the potential disconnect between current observations and forecast.

At the moment, as is documented, the observations are directly from the first listed station (e.g. KBFI). They’re true observations. But the forecast is using much more precise lat/long coordinates to give a grid-level forecast on a 2.5 square km grid (which interpolates data from up to dozens of actual stations) (example). As a result, you can have big disconnects between the observations and the actual local conditions.

I believe DarkSky was using some interpolated information to get hyperlocal weather. To emulate this with this integration, we need to allow interpolated quasi-observations.

I have been reading the API spec, the code of this integration, and the underlying pynws lib. I think the best source of hyperlocal weather predictions would be to grab the first hour out of the hourly gridpoint forecast and process it into a quasi-observation. This would be an optional mode of the integration, probably triggered with a interpolate_local_observation config flag.

What do you all think? If you like it I can make a PR.

This is an interesting idea. I think the suggestion for HA libraries is to present the data as is from the source. I would also be concerned that you would have a lag up to an hour for precipitation events.

Id suggest this start as a custom component for testing side by side.

I’ve found some local stations are better than others. My closest station never reports precipitation, so I have to use a different one farther away.