National Weather Service (NWS) frequently "unavailable"

Another suggestion is that in the next version 0.110 you can use the update_entity service to force a data refresh. So you can set up an automation to check if the entity is unavailable every x s and force a refresh if it is unavailable.

1 Like

Up until today I was on 0.108.something and never had an issue. I have had nothing but trouble since I upgrade to 0.109.6 and used the newer integration.

Something is definitively different with the 0.109 version of this integration. Always a “bad gateway” error.

Edit: Just to check, I can pull the data in my browser no problem. So it is not the server.

The NWS integration was changed. It now follows the home assistant preferred method to show unavailable when the last update failed for either the forecast or observation IO. It only updates every X minutes, so if the server is down for even 10s and you happen to update during those 10s, you won’t have data for X minutes. You can shorten this by using the refresh strategy above for now.

1 Like

Just my $0.02. I think the NWS is having problems with their servers. I created a sensor to get the count of alerts for my area (used in a node-red flow). It works on a 60-second interval. I used to be pretty steady but for the last few days, it has been giving me problems. The pic attached below shows the results for the last six hours or so. The grey areas are ‘unavailable’ or ‘unknown’. The tan areas are when I actually got a result.

1 Like

I’ve been using the NWS integration for months, it was stable up until the last 24 hours, so this isn’t normal…for those of you that just jumped from DarkSky.

1 Like

I created “helper entities” to store the current state of some items whenever a state change occurs and it’s not to “unavailable”. Here is my automation (a portion – input_text.nws_forecast_1d is the helper storing “cached” data):

- alias: 'Update NWS Helper Fields'
    initial_state: true
    trigger:
      platform: state
      entity_id: weather.nws_entity
    condition:
      condition: template
      value_template: >
        {{ trigger.to_state.state not in ['unavailable'] }}
    action:
      - service: input_text.set_value
        entity_id: input_text.nws_forecast_1d
        data_template:
          value: "{{ states.sensor.nws_forecast_1d.state }}"

And then the sensor:

      nws_forecast_1d:
        friendly_name: "1 Day"
        value_template: >
          {% if states.weather.nws_entity.state == 'unavailable' %}
            "{{ states.input_text.nws_forecast_1d.state }}!"
          {% else %}
            "{{ states.weather.nws_entity.attributes.forecast[24].condition }}"
          {% endif %}
        icon_template: >-
          etc...

Any time NWS is reported as unavailable the stored text is used, and I added an exclamation point at the end as an alert that this is “cached” information.

3 Likes

I found this… but there is no date. I think it is current: https://www.weather.gov/mkx/weboutage

Will this bring back temperature and forecasts?

All it does is update text and number fields from the forecasts I care about every time the NWS entity updates, unless it is unavailable. The sensors that pull from the NWS entity then use these fields instead of trying to pull from the entity when it’s unavailable.

So no, it won’t bring back forecasts until the actual entity updates successfully but derived sensors at least display the last known good value (and I added the exclamation point so I know this is happening).

We probably are not the only group looking for a new source of weather data right now. Perhaps there are enough people making the switch that our combined queries are overwhelming their servers?

Good point.

1 Like

We only poll the server every 10-15 minutes with 3 API calls. I doubt we are overloading the server, but maybe I’m underestimating the number of home assistant users :). If we were, they would surely contact us.

No, but all the apps that used DarkSky’s API are probably trying to move to something else.

1 Like

I meant to put this request here, but can someone put an issue on the GitHub for home assistant for this. For my planned fix, it will require core dev buy in, for which a filed issue will help.

Totally misread the original post, you are right

1 Like

Just an update. My sensor is now showing consistently available except for one minute every two hours.

1 Like

So, a new custom component appeared on HACS using the weatherbit.io api. I set it up last night and it appears to be a perfect drop in replacement for Dark Sky! Almost all of the attributes are even named the same, and this is the first weather service I have tried to include the forecasted low temp for each day! This has made it a quick search and replace drop in for me.

@BrianHanifin do you know if weatherbit creates sensors in the same way Dark Sky does?

No, unfortunately you would have to use template sensors to recreate those.

Ok got you, thanks!