Can't access forecast attribute with weather cards

The forecast attribute was marked as deprecated since 2023.9
From 2024.4, you have to use the get_forecasts service.
You need to call a service or create a custom sensor like I did (thanks to adorobis)

# Old weather style
  - trigger:
    - platform: time_pattern
      hours: /1
    - platform: homeassistant
      event: start
    action:
      - service: weather.get_forecasts
        data:
          type: daily
        target:
          entity_id: weather.openweathermap
        response_variable: daily
    sensor:
      - name: Old forecast style weather
        state: "{{ states('weather.openweathermap') }}"
        attributes:
          temperature: "{{ state_attr('weather.openweathermap', 'temperature') }}"
          dew_point: "{{ state_attr('weather.openweathermap', 'dew_point') }}"
          temperature_unit: "{{ state_attr('weather.openweathermap', 'temperature_unit') }}"
          humidity: "{{ state_attr('weather.openweathermap', 'humidity') }}"
          cloud_coverage: "{{ state_attr('weather.openweathermap', 'cloud_coverage') }}"
          pressure: "{{ state_attr('weather.openweathermap', 'pressure') }}"
          pressure_unit: "{{ state_attr('weather.openweathermap', 'pressure_unit') }}"
          wind_bearing: "{{ state_attr('weather.openweathermap', 'wind_bearing') }}"
          wind_speed: "{{ state_attr('weather.openweathermap', 'wind_speed') }}"
          wind_speed_unit: "{{ state_attr('weather.openweathermap', 'wind_speed_unit') }}"
          visibility_unit: "{{ state_attr('weather.openweathermap', 'visibility_unit') }}"
          precipitation_unit: "{{ state_attr('weather.openweathermap', 'precipitation_unit') }}"
          forecast: "{{ daily['weather.openweathermap'].forecast }}"

And get from this

To this

3 Likes