SOLVED: National Weather Service

and those scripts are running flawlessly thank you very much.

1 Like

Too bad we have so few votes on this feature request. We need a lot more so it gets developers’ attention and who knows, some of them decide to write a new component for weather based on this service.

I took initiative even though i have never made a HA component before or really did any programming in python. Here is my very early version of the sensor component
I am using the noaa-sdk :slight_smile:

1 Like

I have a weather component working. See below. It probably needs to be updated to the new structure, but works in 0.89. I’ve hesitated to change it since no other weather platform had changed.

I also have modified the weather card to display day/night and precipitation probability.


I was planning on submitting a PR for this after I laid some needed groundwork by adding necessary unit conversations first. But my pressure fix PR has been dead in the water for almost three weeks.


Looks great.

FWIW I was able to add the NWS current temperature (which is what I mainly care about) by using a simple REST sensor and json parsing value template. Here is my setup. Replace the weather station and you’re good to go. You can determine your stationId using lat,long, this is a good writeup on how to use the API:

# NWS current outdoor temperature
  - platform: rest
    name: Outdoor temperature (nws)
    method: GET
    value_template: '{{ }}'
      application: vnd.noaa.dwml+xml
      User-Agent: home-assistant
    unit_of_measurement: '°C'
    scan_interval: 20
1 Like

This is soon a default integration in the upcoming v0.99.0 release, you will not need the REST sensor for this.


Sorry but can you point in the right direction I can’t seem to find any integration for NWS.

Update: Sorry found it and in case anyone else can’t find the documentation for this AWESOME integration.

1 Like

The forecasts for this integration can be 4-6 hours old. Is there anyway to increase the frequency of updating? I can’t seem to figure it out other than to maybe setup a REST sensor?

It updates every 10 minutes. You can increase your frequency by using the homeassistant.update_entity, but it will throttle you down to once a minute. This isn’t going to fix the problem I think however. Have you checked the timestamps in the dev tools page (these are in utc time) to make sure they start near the current time? Sometimes these time mismatches are caused by the system time on the browser you are using.

I switched to using openweathermap and it seems the same thing is happening as far as “Updated X minutes/hours ago”, but the temperature and humidity do seem to be updating despite that. So is the time in that message just how long ago it updated the actual state (i.e. from sunny to cloudy)? With NWS the current temperature was always way off so it didn’t give me much confidence.

I don’t know the answer to your question about x minutes ago, but I suspect you are correct that it is only when the state changes not when it is fetches new data. You can try a different nearby observation station and see if you get better data. Some stations are better than others.

I don’t have a problem with how often the NWS integration updates. My problem is that the relevant Lovelace card always shows the predicted weather from the previous 4 hours instead of the upcoming 4 hours. It’s about 9am right now as I write this and I’m being shown data from 4am to 8am. Note that when I inspect the “4-hour forecast” entity itself (by clicking the button which looks like an old-school equalizer), it contains hourly data several days into the future.

So I guess my issue is: how do I get the Lovelace card to display the next 4 hours’ worth of data instead of data from the past? I mean, it’s called a “forecast” and not an “aftcast”.

The NWS forecast should be a true forecast, so either the API is providing garbage data, there is some time zone conversion issue, or there is a bug. Can you provide one of the forecast timestamps in the datetime attribute from the tab on the developers page along with your local time and time zone?

Edit:. Please provide the first timestamp.

Here are the first several lines of data for the entity weather.kbfi_hourly (Boeing Field in Seattle). Let me know if that’s what you’re looking for:

temperature: 74
humidity: 33
pressure: 30.09
wind_bearing: 310
wind_speed: 9
visibility: 10
attribution: Data from National Weather Service/NOAA
  - detailed_description: ''
    temperature: 70
    datetime: '2020-07-13T16:00:00-07:00'
    condition: sunny
    precipitation_probability: 0
    wind_bearing: 337.5
    wind_speed: 9

When did you grab this data? Around 5:45 Seattle time, or earlier? What did your frontend say at that time?

If you grabbed it at 5:45, it looks like the forecast is only 45 minutes stale since the timestamp in home assistant is the starting time of the forecast, and it is showing 4PM, which is valid from 4-5 PM.

Off by one hour like this could be caused by some changes I recently made that make the forecast more robust to brief server outages. I could reduce the occurrence of this, but at the expense of having unavailable data sometimes.

If you see this off by more than one hour, than it is likely the data source providing stale data. If true, then we could filter this out. But I’d want to confirm it occurs first.

I obviously don’t have your exact lat/lon, but a location near the one you provided is showing up to date data on the server, with the first forecast at 6-7PM while it is currently 645. This is consistently represented in home assistant too datetime: '2020-07-13T18:00:00-07:00'


Are you thinking that maybe the KBFI station is periodically lagging by several hours, and that a different station would be better? If so, what is the station you referred to? Also, I’m not sure how to force the station to something other than one defaulted to by my lat/long.

Sorry for the confusion, your forecast is only by lat/lon. The station provides the observation. The poster above referred to humidity being off, which is only available in the observation, so I suggested trying a different station.

If your forecast has stale data, I’d have to filter it out in the code. I want to confirm it actually occurs and it isn’t caused by something else first though.