NWS Integration — please consider adding daily high and low

Continuing the discussion from NWS forecast backwards:

See https://github.com/weather-gov/api/discussions/523 — in short, the gridpoint endpoint has this, but the /forecast one just has the morning / evening temps. The latter seems to be what the current integration gets. That’s useful, but daily high and low are two — and tend to be more what people expect from a weather forecast.

The problem is that NWS API does not provide a single daily forecast in any form. They provide twice daily, hourly, and asynchronous (although usually aligned by hours) data.

To make a once daily forecast is easy for temperature, since HA supports two values. But all other parts such as the forecast condition involve only choosing the data from part of that days forecast.

You definitely know more than I do about this, but isn’t it https://api.weather.gov/gridpoints/BOX/69,77? That shows a bunch of predicted values for the next week.

It doesn’t have so convenient English-language descriptions, but it seems like it’s all there — including the maxTemperature and minTemperature?

That endpoint is the one I referred to as asynchronous. It is probably better labelled as providing interval data. The maxTemperature is valid for something like 12-13 hrs and similar for the minTemperature. These would be the same as the day and night temperatures in the current integration.

This part is straightforward to get into a single daily forecast as HA supports two temperature values. But what about the forecast condition for the day? That endpoint could theoretically give you a different forecast for each hour of the day. How do we collapse it into a single condition? This is tricky.

Ah, I see. I guess I the response I got on github isn’t really right?

In the meantime… would it be awful to take the hourly temperatures and generate the minimum/maximum from the min/max for the day?

Maybe I also missed your point here. You can get the min max temperature by using the day and night forecasts. This is also what the NWS GitHub discussion indicated (the data from the forecast endpoint is copied from the other one). What do you want to do with that however?

The day-night forecasts aren’t necessarily the high-low temperatures, though, are they?

I mean, it’s usually the case that the low is overnight and the high is during the day, but not always. I’m looking at the HA weather widget right now, and it’s reporting 40°/34° for tomorrow. But when I look at the hourly, I see that it’ll be 23° at 7am — much lower than 34°.

I’ve also got the weather from whatever service my Ecobee uses, and it is saying “45° / 22°”, which, while a little different, seems to better indicate the cold morning.

The temperature at Sunday February 6th at 6 AM is typically part of the forecast for Saturday night February 5th.

Edit: if this is still incorrect after considering this, you would need to check that the endpoint you are showing has a different value for minTemperature for the interval in question.

Hmmm. Maybe I just haven’t paid enough attention to that until now. :slight_smile:

The particular thing that got me looking is that I want to compare against a historical dataset, and (as I understand it at least) that historical set is midnight-to-midnight highs and lows. I’ll try to figure something out. :slight_smile:

Thanks for your help!

Hmmm… Yeah difficult. I recommend for this purpose that you rather ingest the data directly from the API. Then it is easier to deal with these things.

I would also highlight that the NWS forecasts on their own page present the same way as in HA. One forecast for the day and one for the night, which encompasses part of the morning of the next day.

1 Like