weather-chart-card icon indicating copy to clipboard operation
weather-chart-card copied to clipboard

From 2024.4.0, attributes.forecast will be removed

Open OToussaint opened this issue 1 year ago • 8 comments

Starting this 3rd of April 2024, the new release of HA is no longer publishing the forecast as an attribute. The code accessing attributes.forecast must be replaced by a call the get_forecasts service:

Probably something like this.

  homeassistant.callService(weather, 'get_forecasts', {
    type: 'daily',
  }).then(function(response) {
    // Check that forecasts is in the answer
    if (!response || !response.forecasts) {
      console.error('No forecast data available');
      return;
    }

Otherwise the card will show

Please, check your weather entity

Unfortunately, as an old programmer, I'm not good enough in JS to change it myself in a fork.

OToussaint avatar Mar 29 '24 20:03 OToussaint

I just updated to 2024.4.0 and as OToussaint said, the card no longer works.

Pabsilon avatar Apr 04 '24 08:04 Pabsilon

You can create a template sensor to get the daily (and hourly) forecast. Here is my example for daily. It will create a new sensor which you can add to the card.

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

adorobis avatar Apr 04 '24 10:04 adorobis

I just updated to 2024.4.0 and as OToussaint said, the card no longer works.

Same here

CrashyNL avatar Apr 04 '24 11:04 CrashyNL

Im having the same issue.

sekonicpr avatar Apr 06 '24 22:04 sekonicpr

This hacs integegration works with 2024.4 forecasts https://github.com/mlamberts78/weather-chart-card

slecram avatar Apr 11 '24 11:04 slecram

This hacs integegration works with 2024.4 forecasts https://github.com/mlamberts78/weather-chart-card

That doesn't seem to show hourly forcasts

mbrevda avatar Apr 11 '24 11:04 mbrevda

This hacs integegration works with 2024.4 forecasts https://github.com/mlamberts78/weather-chart-card

That doesn't seem to show hourly forcasts

image

slecram avatar Apr 11 '24 11:04 slecram

Oh, cool! Thanks for correcting me 🙏

mbrevda avatar Apr 11 '24 12:04 mbrevda