#How can I fix my weather template

1 messages · Page 1 of 1 (latest)

lucid light
#

Hallo,
I´ve made my own weather station template via my config.yaml

weather:

  name: "My Weather Station"
  condition_template: "{{ states('weather.forecast_home') }}"
  temperature_template: "{{ states('sensor.my_temperature') | float }}"
  temperature_unit: "°C"
  humidity_template: "{{ states('sensor.my_humidity') | float }}"
  forecast_daily_template: "{{ state_attr('weather.forecast_home', 'forecast') }}"```

Since 2024.3 this "{{ state_attr('weather.forecast_home', 'forecast') }}" don´t work anymore. 
I know that it should work with the service weather.get_forecasts.
How can I get the output from the service call into forecast_daily_template?
lethal ermine
#

petro already gave you an answer before you moved your post to a thread

#

please also format your YAML as code

lofty rockBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

lethal ermine
#

unfortunately there is no trigger based template weather entity, so you'll need to use a trigger based tempate senosr to get the forecast in this template weather

lethal ermine
#

really?

trail pawn
#

gotta be new, yeah, it's in the docs

#

scroll up

#

you'll see it listed

#

FFS, the example I linked uses sensor

#

but there's definitely a weather using the new style

trail pawn
#

also

#

which fits in with a trigger

lethal ermine
#

the link at the top should be adjusted then

#

okay, I need to change my combined weather package then 😉

trail pawn
lucid light
#

Got it!

      - platform: time_pattern
        hours: /1
      - platform: state
        entity_id: input_boolean.test_switch
    action:
      - service: weather.get_forecasts
        target:
          entity_id:
            - weather.forecast_home
        data:
            type: daily
        response_variable: myforecast
    sensor:
      - name: Wettervorhersage OldSchool-Entität
        unique_id: my_weather_forecast
        state: "{{ now().isoformat() }}"
        icon: mdi:hours-24
        attributes:
          forecast: "{{ myforecast['weather.forecast_home'].forecast }}"````

Thanks guys!
trail pawn
lethal ermine
lucid light
#

@trail pawn Doesn`t matter. It works! 😆

lethal ermine
lucid light
#

ok, but how? I can´t use the service call weather.get_forecasts directly in forecast_daily_template, or can I?

lethal ermine
#

No, you need to do it similar as above, but instead of using sensor: use weather: