I’m using the detailed_description data from the National Weather Forcast to create a spoken daily update of the day’s news and weather. With the recent update to HA the data does not seem to be available any longer.
I’ve reverted back to the previous release and will not be upgrading unless there’s a work around or resolution.
An example of the data:
forecast:
- detailed_description: Mostly cloudy, with a high near 50. North wind 10 to 15 mph.
datetime: '2024-04-04T08:00:00-05:00'
precipitation_probability: 0
is_daytime: true
condition: cloudy
wind_bearing: 0
temperature: 50
dew_point: 31
wind_speed: 12.5
humidity: 72
I’m seeing the same behavior - the detailed_descriptions are no longer being populated. Validated this on my test Home Assistant install - 2024.3 works correctly; 2024.4 does not.
I’ve been informed by developers that since the weather.get_forcast service call has been deprecated the National Weather Service integration will not be providing the STATES information any longer. Instead we’ll have to do service calls for weather:get_forcasts to get the information. Meaning that we’ll have to do some creative scripting to first get the information then extract it for our needs.
I’m fairly new to Home Assistant, so apologies if I’m restating something that’s already been said in this thread. I’ve been trying to get this to work as well. I have a template sensor that uses get_forecasts, and it works properly:
The issue is how to get the detailed_description back out. I don’t yet know enough to do the “creative scripting”. Has anyone gotten a working solution for this?
Title: Issues Storing Weather Forecast Data with New get_forecasts Service
Hello All,
I’m having trouble utilizing the new weather.get_forecasts service with the NWS integration. Historically, I used the old method where the weather entity had an attribute called forecast, which allowed me to drive my automations using weather data. Even though this method was deprecated, I can still see hourly and twice daily data in the UI when I click on the entity.
I understand that the new recommended approach is to use the get_forecasts service. I can successfully retrieve data using this service in the developer console, but I’m struggling to store this data in a way that can be parsed and used in automations.
Here are the steps I’ve tried:
Using input_text Entities:
I attempted to write the forecast data to input_text entities.
However, this exceeds the 256 character limit, resulting in errors and the state falling back to unknown.
Shell Command to Store Data in a File:
I considered using a shell command to write the forecast data to a file and then read it back into Home Assistant.
This approach seemed overly complex for what should be a straightforward task.
What am I missing here? How can I write the forecast data returned by the get_forecasts service to an entity in Home Assistant so that I can parse and use it in my automations?
Alternatively, since I can see the data in the NWS entity, how do I now access this?
This creates a new sensor called Daily Forecasts. The actual sensor data is the date/time of the forecast and each of the attributes contain the textual data. You can then get the data with a state_attr(‘sensor.daily_forecast’,‘forecast_0’), etc
Substitute the kmsp_daynight portion for the weather station you need.
This new sensor is at the top of my templates.yaml file and before all other sensors defined in the file, the sensor section is combined with all the other sensors.
Be aware — the NWS forecast has been erratic lately, and if it stops working all the sensors in the template.yaml will also stop working. Don’t know a work around at this point.
Make sure the rest of the sensors in your templates.yaml file are indented properly or you’ll experience the effect above.
In addition to sensor.daily_forecast, you’ll see sensor.daily_forecast_extra in your entities. The new entity are where you’ll find the detailed_description and a new attribute, short_description. Of course, you’ll need to appropriately reference the new entities.
Any suggestions on how to get the first three detailed descriptions from the extra forecasts? It used to work for me many months ago and after the recent changes, I cannot get it to work. I’ve tried numerous approaches and have the same issue: I can see the data in the response from the action using Developer Tools (see below), but however I try to access and parse that data, it’s not available. I use the detailed descriptions to show forecast text on my dashboards.
Response:
weather.d6637:
forecast:
- datetime: “2024-12-07T10:00:00-08:00” is_daytime: true
detailed_description: Sunny, with a high near 80. West wind 0 to 10 mph.
short_description: Sunny
- datetime: “2024-12-07T18:00:00-08:00” is_daytime: false
detailed_description: Mostly clear, with a low around 50. Southwest wind 0 to 5 mph.
short_description: Mostly Clear
- datetime: “2024-12-08T06:00:00-08:00” is_daytime: true
detailed_description: Mostly sunny, with a high near 71. Southwest wind 0 to 10 mph.
short_description: Mostly Sunny
At this point, you probably need to reload your YAML configuration or perform a restart before looking for the entity sensor.daily_forecast_extra in Developer tools >> states.
Then use the sensor to extract the attribute string:
forecast_0: Partly sunny, with a high near 26. Northwest wind 5 to 10 mph.
forecast_1: Snow showers. Mostly cloudy. Low around 6, with temperatures rising to around 13 overnight. Northwest wind 5 to 20 mph, with gusts as high as 35 mph. Chance of precipitation is 90%. New snow accumulation of less than one inch possible.
forecast_2: Mostly sunny. High near 8, with temperatures falling to around 2 in the afternoon. Wind chill values as low as -18. Northwest wind 15 to 20 mph, with gusts as high as 35 mph.
forecast_3: Mostly clear, with a low around -5. Wind chill values as low as -20. Northwest wind 5 to 15 mph, with gusts as high as 30 mph.
friendly_name: NWS Daily Forecasts
But actually, I’m not using the data because there doesn’t appear to be a way to also put a time period name (ie, Today, Tonight, Monday, etc) with the data without complicated yaml to use the datetime field. Instead I’m now just scraping the data from the NWS web forecast for my area which is essentially the same information.
Using the HACS integration Multiscrape, I use this:
period_0: Today
forecast_0: Partly sunny, with a high near 27. Northwest wind 5 to 10 mph.
period_1: Tonight
forecast_1: Snow showers, mainly before 3am. Low around 6. Blustery, with a northwest wind 5 to 10 mph increasing to 15 to 20 mph after midnight. Winds could gust as high as 30 mph. Chance of precipitation is 90%. New snow accumulation of less than one inch possible.
period_2: Wednesday
forecast_2: A 20 percent chance of snow showers before 7am. Mostly sunny, with a temperature falling to around 2 by 5pm. Wind chill values as low as -18. Blustery, with a northwest wind 15 to 20 mph, with gusts as high as 35 mph.
period_3: Wednesday Night
forecast_3: Mostly clear, with a low around -5. Wind chill values as low as -20. West northwest wind 5 to 15 mph, with gusts as high as 30 mph.
friendly_name: NWS Web Forecasts