SOLVED: National Weather Service

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
forecast:
  - 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'

Matthew,

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.

I’ve taken two screen shots about 3 hours apart, one at 7:53AM and one at 10:50AM. Both of them depict the forecast from 4am to 8am. The more recent one has the higher / updated current temperature. The following text from the developer tab is from 10:50am.

image
image

temperature: 65
humidity: 58
pressure: 30.17
wind_bearing: 290
wind_speed: 5
visibility: 10
attribution: Data from National Weather Service/NOAA
forecast:
  - detailed_description: ''
    temperature: 55
    datetime: '2020-07-14T04:00:00-07:00'
    condition: clear-night
    precipitation_probability: 0
    wind_bearing: 45
    wind_speed: 5

I think this nails it pretty good. Thanks. You could consider postimg this as an issue on the home assistant GitHub.

I’ll work on filtering out stale (>1 hr old data) from the forecast. There is still the possibility of having 1 hr old data, but I think that is acceptable.

I’ve started experiencing this issue too, and the data being provided by NWS is old. In my case, the data was over 2 days old. The complicating factor is that different information is supplied depending on whether you use a browser.

See https://github.com/weather-gov/api/issues/86