New Forecast Service, how i can create a forecast entity?

i think so

- platform: template
  name: "Home Weather Station"
  unique_id: home_weather_station
  condition_template: "{{ state_attr('sensor.weatherdatafrom8805wae','Condition') }}"
  temperature_template: "{{ states('sensor.durchschnitt_temp_aussen') | float(0) }}"
  apparent_temperature_template: "{{ states('sensor.durchschnitt_thermal_comfort_aussen_heat_index') | float(0) }}"
  temperature_unit: "°C"
  humidity_template: "{{ states('sensor.durchschnitt_humidity_aussen') | float(0) }}"
  dew_point_template: "{{ states('sensor.durchschnitt_thermal_comfort_aussen_dew_point') | float(0) }}"
  pressure_template: "{{ states('sensor.durchschnitt_pressure_aussen')| float(0) }}"
  pressure_unit: "hPa"
  wind_speed_template: "{{ state_attr('sensor.weatherdatafrom8805wae','Current')['windSpeed'] | float(0) }}"
  wind_gust_speed_template: "{{ state_attr('sensor.weatherdatafrom8805wae','Current')['windGust'] | float(0) }}"
  wind_speed_unit: "km/h"
  wind_bearing_template: "{{ state_attr('sensor.weatherdatafrom8805wae','Current')['windDirection'] | float(0) }}"
  HERE  --- > forecast_template : "{{ state_attr('sensor.weatherdatafrom8805wae','forecast') }}"
  attribution_template : "Daten zur Verfügung gestellt via -https://app-prod-ws.meteoswiss-app.ch/v2-"

You think what?

Sorry there should be something underneath.
:arrow_down:
or are template weather entities excluded from this? That would be great :slight_smile:

and the log says…yes…you should use the new service

Logger: homeassistant.components.template.weather
Source: helpers/config_validation.py:890
Integration: Template (documentation, issues)
First occurred: 17:38:05 (12 occurrences)
Last logged: 18:10:37

The 'forecast_template' option near /config/_my/weather/cards.yaml:0 is deprecated, please remove it from your configuration
The 'forecast_template' option near /config/_my/weather/cards.yaml:18 is deprecated, please remove it from your configuration
The 'forecast_template' option near /config/_my/weather/cards.yaml:35 is deprecated, please remove it from your configuration
The 'forecast_template' option near /config/_my/weather/cards.yaml:52 is deprecated, please remove it from your configuration

It doesn’t say that.

It says that forecast_template option has been deprecated and should be removed. That’s because there are new options for specifying the forecast:

Reference:
Template Weather

Based on the data shown in your first screenshot, you should use the forecast_daily_template option.

I thought so too:

with forecast_template

with forcecast_daily_template: no forecast

You have to use this service to get the forecast now:

https://www.home-assistant.io/integrations/weather/#service-weatherget_forecast

You don’t need to if you are only displaying the forecast in the core weather card, it will call the service for you. Other third party weather cards may need to be updated to call the service when they are viewed.

However you don’t need to use that service if you want access to the data as you already have it available in your restful sensor attribute.

This brings us back to my question, how do I create the “response_variable” so I can use the service. Everyone says this must work, but it does not.

service: weather.get_forecast
target:
  entity_id: weather.home
data:
  type: daily
response_variable: weather_forecast

You.

Don’t.

Have.

To.

All your forecast data is available in your rest sensor for you to use whenever you want. No service call required.

But if you really must, try supplying your weather entity instead of the one provided in the example.

service: weather.get_forecast
target:
  entity_id: weather.home_weather_station # <- this is your weather entity
data:
  type: daily
response_variable: weather_forecast

I think the OP has a bit of a point. If I understand things correctly, he’s using a weather template sensor:

I don’t think the new way of implementing forecasts took that template sensor into account when introducing forecast services. I don’t quite see how that template weather sensor will support the new service call, unless it is going to parse the deprecated attributes to implement the service, which is the world upside down. So the weather template entities will not be compatible with other weather integrations, unless it has a way to implement the service.

The OP can, as you suggested, revert to calling the rest service to get at the forecast, but that won’t be compatible with the weather service call and it won’t use caching as discussed in the other topic (but for a local weather station it probably won’t be a problem).

If I’m rigt then this all means that his weather template sensor won’t be able to drive the weather cards that use the service to get at the forecast, unless as I said before, template weather sensors use the attributes (which are flagged deprecated) to drive the service call, or the template offers a way to implement the forecast service by calling the rest interface.

But maybe the template entities use the attribute to implement the service, even though that is a bit backwards.

Im guessing it parses the supplied forecast_daily/horly_template option, otherwise there would be no point in supplying it.

Yes that’s right, I use the Template Weather Provider Sensor, with this I show the values of my weather stations and enrich the missing information like the forecast with data from Swissmeteo.
Now came release 2023.9 with the note that the way how to include the forecast is changing. Good…I thought I’d take a look at the issue. And that’s where my questions start, how exactly is this supposed to work?

forecast_daily_template:"{{ state_attr(‘weather.my_region’, ‘forecast’) }}"
from the documentation doesn’t work, are certain records missing? If so which ones?

A creation of a new sensor that I can use in the UI for testing purposes to use the service does not work. In different ways I tried to make the sensor visible with the prediction data, nothing works.

Documentation on how to deal with this: there is none. I have so far only 3 different approaches but nothing completed but the error in the log that “forecast_template” must be out of the template.
This just makes it a mystery how to deal with it (until spring).
It’s ok if you forgot something maybe, but then the developers should write it somewhere, something like “template sensors will still be adjusted in the next releases” Or it’s like tom_l writes a magic :slight_smile:
Well, I’ll try tom_l his way.

Yes it does.

You just don’t get to see the data as an attribute. You have to call the service to use it.

Did you try the corrected service I posted?

Have you tried your weather entity in a core weather card?

Do you see the forecast there?

Not yet, the child must go to bed :wink:

core weather card? you mean this?
image
This a my Template Sensor (with legacy forecast)

When you get a chance update your sensor to use the new forecast option and see if the card changes.

Nope, first test fail :thinking:


Test with RESTfulSensor

You don’t need to call the service in the card. The card has been updated to do that automatically.

Just put your newly made entity there, the one that has no forecast attribute.

Do you still see the forecast in the card?

Please start a separate topic as opposed to jumping into this one. Answering two different people’s questions in the same topic can get confusing.

What is the template you used in forecast_daily_template?

If that’s the template you used then I suggest you change it to this:

forecast_daily_template: "{{ state_attr('sensor.weatherdatafrom8805wae', 'forecast') }}"

Be sure to execute Developer Tools > YAML > Reload Template entities after making any changes to the configuration of weather.home_weather_station.

After you make the suggested change, post the revised configuration so we can review it.

1 Like

Oh Shit… :smiley:

I have written a huge long text to describe the procedure and at the last screen shot I noticed it, which is actually also not really nice :smiley:

You have to enable “Daily” and I could swear, because I’ve tried it a dozen times, the part wasn’t showing then. But anyway, it’s there now.

After saving everything is ok :slight_smile:

It has not purely coincidentally something to do with the 2023.9.2 update released today? :wink:

In any case, thanks for the support, I’ve been dealing with HA for some time and thought myself stupid to make the forecast work. :crazy_face: