New weather forecast template

You need to create a triggered template similar to this for an hourly or daily forecast:

- trigger:
  - platform: state
    entity_id: yourweatherentity
  action:
    - service: weather.get_forecast
      data:
        type: daily
      target:
        entity_id: yourweatherentity
      response_variable: daily
  sensor:
    - name: Weather Forecast Daily
      unique_id: weather_forecast_daily
      state: "{{ now().isoformat() }}"
      attributes:
        forecast: "{{ daily.forecast }}"

Then, you can create your sensor templates from the service data returned from that triggered template like this:

 sensor:
  - unique_id: forecasted_high_temp
    attributes:
      friendly_name: "Today's High"
    state: >
      {{state_attr('sensor.weather_forecast_daily', 'forecast')[0].temperature}}
2 Likes