National Weather Service (NWS) wrong temperature?

I found the NWS weather integration always gives wrong temperature.
In the screenshot, upper panel is the default " Meteorologisk" results, which is correct;
the lower panel is from National Weather Service (NWS), which is wrong:
Screen Shot 2

The daily highest/lowest temperature seems correct, but not the current temperature.
Is there a way I can look into this problem? Thanks.

Are you sure the locations for both are correct (and the same)?

Yes. Additionally, I went to KDAL and checked the temperature, it is 22C right now,
but the KDAL card still shows 13C. That’s why I guess there is probably something wrong with the NWS integration.

The URL I am using is: https://forecast.weather.gov/MapClick.php?lat=32.85416&lon=-96.85506#.X7QVKS2ZNTY

You know now that you mention it I remember seeing the same thing a while back when I first installed the NWS integration. It was always several degrees off which is why I decided to not use it until I dug into it more. I must have forgot to go any further.

I just went back and checked it again just now and my temperature from NWS is 5 degrees F lower than both Darksky and the NWS website say that it is. But strangely the NWS integration is correct on the forecast compared to the NWS website. Darksky is close but not the same (which I guess is to be expected since they are forecasts based on different models from different services).

So it does seem that the NWS integration is faulty. You should probably file an issue with the integration on the HA github page. If you link to it here I’ll add my info to it if needed.

Thanks @finity . I am not sure it is an issue with Home Assistant, the NWS integration, or the api from NWS. It is hard to report an issue on GitHub before I can dig into this.

Any help on debugging the NWS integration script will be helpful. Thanks.

Right, that’s why you file an issue on github and let the person who is responsible for the integration dig into it and do the debugging by providing them with the information you have. And if you link to your issue i will add my details as further to assist in troubleshooting.

the only other person I know that can possibly help is @MatthewFlamm. From interactions on the forum I believe he’s the one who wrote the integration. If not then maybe he can point you (us…) in the right direction.

I am not 100% sure on the cause, but it is very possible that it is related to the already reported bug that the NWS servers will supply stale data possibly for several days at a time for certain endpoints on the API. You could be seeing data from a few hours before, say in the early morning hours.

I implemented logic to go around this issue on the forecasts, but I can’t remember if this also occurs for the observations. If you see this again, you can retrieve the API response from https://api.weather.gov/stations/KDAL/observations. The tricky part is that when you do this, you won’t be requesting the data using the exact user key that home assistant uses when it requests. So, you may get up to date information when you do this even though home assistant is getting stale data. But, you can look at the previous time points in the response and see if a previous timepoint matches your HA data. If so, that would further confirm this behavior.

Right now at this moment the two values from the NWS (API & website) match for my location.

I’ll try to watch it a bit over the next few days and see if I can see a trend.

Thanks @finity and @MatthewFlamm. I think what Matthew described makes sense. After one day, the results from NWS appear to be correct.

I made a scrape sensor to pull the current temp from the NWS website for my location and I have it updating every 10 minutes so I can track any discrepancies over the next few days.

Here is the code if you want to use it:

- platform: scrape
  name: Local Temp NWS Scrape
  resource: https://forecast.weather.gov/MapClick.php?lat=32.85416&lon=-96.85506#.X7amG8g3mUl
  select: "#current_conditions-summary > p.myforecast-current-lrg"
  value_template: "{{ value.split('°')[0] }}"
  unit_of_measurement: "°F"
  scan_interval: 600
  headers:
    User-Agent: Mozilla/5.0

I already put in your URL from your link from above.

Thanks @finity . I added your script to my dashboard. It works and reports the correct temperature for now. I will report back if I observe the difference between this Local Temp NWS Scrape and the NWS Add-on.

1 Like

It is a bit off-topic, but the NWS scrape script sometimes reported the wrong temperature. See below for an example: the correct temperature is around 9C, but scrapped temperature is 18C.

Mine is generally OK but it does get off the mark occasionally. But it seems like it’s tracking the actual temp better than the NWS sensor does in general.

ex1

red is darksky
purple is the scrape sensor
green is the NWS “realfeel” temp

Thank you for the information!

I’m seeing wild fluctuations from sensor.(station)_temperature

On the history of the observations page, the temp data are smooth and do not fluctuate
https://forecast.weather.gov/data/obhistory/metric/KDYL.html

I’m running hass in docker from homeassistant/home-assistant:stable image

Can you try on 2021.10.3? A potential fix was made.

Cool, thanks!
Is there a way to get an updated docker image with this version? I can try to update it in the running container as well, but not sure what’s the internal plugin’s structure there…

You would upgrade like you normally would to a new homeassistant version (I’m not a user of homeassistant on docker) . The version I indicated is currently the latest stable version.

You will automatically get the updates to the library that fetch the data from NWS.

Ok
I’ve used homeassistant/home-assistant:stable image and tried ghcr.io/home-assistant/home-assistant:stable

Looking inside container, both have the same versions:

bash-5.1# pip list | grep "homea\|nws"
aioesphomeapi                     9.1.5
anel-pwrctrl-homeassistant        0.0.1.dev2
homeassistant                     2021.10.3    /usr/src/homeassistant
homeassistant-pyozw               0.1.10
pynws                             1.3.2

Still watching if ghcr.io/home-assistant/home-assistant:stable makes any difference…

Cool, now working properly.
image

Is it possible to get more frequent updates from the NWS API? It is updated every hour or so