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

Hello :slight_smile:

I don’t use a third-party integration but get my weather data via REST from swissmeteo in combination with my own weather station. Now I’m trying to figure out how to connect a REST entity to the weather forecast service using the sparse documentation.

The documentation shows an example which looks like this, my forecast entity actually looks the same, but can’t be determined by HA

Does anyone happen to know what the entity must look like? Is something missing, for example a type etc. ?

Thanks in advance

You are mixing things , that is why, the get forecast is for the base weather integrations, not for your private/personal/local REST setup. And not sure why you want to use this as you already have the forecast…?
EDIT: maybe explain in a bit more detail what you want to achieve and then help could be there (no promises) :slight_smile:

That is a sensor entity. Not a weather entity with a forecast attribute. You have nothing to worry about.

I do not want that :wink: But since in a few months the classic forecast within the weather entity will be removed, I have been working on how to adapt my forecast data to the new system.
My wish is just to separate the forecast data from the weather and query it using the created service.

A sensor, that helps me already, as it will probably be the goal from the RESTFul entity to create a template sensor that contains the complete dict in the sensor value?
I have failed so far :wink:

As we both keep saying, you don’t have a weather entity with a forecast attribute. You have a sensor that has a forecast attribute. The change does not apply to you.

Edit: also you can not move your forecast from the sensor attribute to its state. It will exceed the allowed 255 character limit for state values. This limit does not apply to attributes.

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)