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.
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.
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.
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.
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.
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
Just an update. My sensor is now showing consistently available except for one minute every two hours.
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.
No, unfortunately you would have to use template sensors to recreate those.
Ok got you, thanks!
I’m very new to Home Assistant. Can someone tell me how to add these helper entities to my Home Assistant setup? Thank you.
Items like this would go in the configuration.yaml if you want to remain on your dashboard youll need the settings>add on>File editor.
Details in the yaml might need to be changed for your setup.
The file editor will give you access to multiple yaml areas and other custom scrips in custom intigrations.
Sometimes helpers can ge added with gui in setting > devices and services >helpers
Thank you. I think my issue was that I was running Home Assistant Core, which doesn’t have add ons, when I needed to be running Home Assistant OS. I just reinstalled, and now I shall tinker some more. Thank you again.