[PETITION] Don't delete the forecast attribute

all I have done so far because I have a day job. LOL is the templet for sensor.weather_hourly

#weather forcast hourly sensor 
- trigger:
    - platform: time_pattern
      hours: /1
    - platform: homeassistant
      event: start
  action:
    - service: weather.get_forecasts
      data:
        type: hourly
      target:
        entity_id: weather.home
      response_variable: hourly

  sensor:
    - name: Weather Hourly
      state: "{{ states('weather.home') }}"
      attributes:
        temperature: "{{ state_attr('weather.home', 'temperature') }}"
        dew_point: "{{ state_attr('weather.home', 'dew_point') }}"
        temperature_unit: "{{ state_attr('weather.home', 'temperature_unit') }}"
        humidity: "{{ state_attr('weather.home', 'humidity') }}"
        cloud_coverage: "{{ state_attr('weather.home', 'cloud_coverage') }}"
        pressure: "{{ state_attr('weather.home', 'pressure') }}"
        pressure_unit: "{{ state_attr('weather.home', 'pressure_unit') }}"
        wind_bearing: "{{ state_attr('weather.home', 'wind_bearing') }}"
        wind_speed: "{{ state_attr('weather.home', 'wind_speed') }}"
        wind_speed_unit: "{{ state_attr('weather.home', 'wind_speed_unit') }}"
        visibility_unit: "{{ state_attr('weather.home', 'visibility_unit') }}"
        precipitation_unit: "{{ state_attr('weather.home', 'precipitation_unit') }}"
        forecast: "{{ hourly['weather.home'].forecast }}"    

Hi,

I’m not sure I understand what you want to do. But I don’t see why you created another weather sensor. To obtain hourly forecasts, you can proceed as follows:

template:
  # Obtenir les pévisions horaire

  - trigger:
      - platform: time_pattern
        hours: /1
    action:
      - service: weather.get_forecasts
        data:
          type: hourly
        target:
          entity_id:
            - weather.forecast_shawinigan_sud
        response_variable: previsionshoraire
    sensor:
      # Date et heure

      - name: "def_heure_date_h0"
        unique_id: "def_heure_date_h0"
        state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].datetime }}"

      # Conditions

      - name: "def_previsions_condition_h0"
        unique_id: "def_previsions_condition_h0"
        state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].condition }}"

      # Temperature

      - name: "def_previsions_temperature_h0"
        unique_id: "def_previsions_temperature_h0"
        unit_of_measurement: "°C"
        state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].temperature }}"

      # Vitesse du vent

      - name: "def_vitesse_vent_h0"
        unique_id: "def_vitesse_vent_h0"
        unit_of_measurement: "km/h"
        state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].wind_speed }}"

      # precipitation probability

      - name: "def_previsions_precipitation_probability_h0"
        unique_id: "def_previsions_precipitation_probability_h0"
        unit_of_measurement: "%"
        state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].precipitation_probability }}"

      # Precipitation

      - name: "def_previsions_precipitation_h0"
        unique_id: "def_previsions_precipitation_h0"
        unit_of_measurement: "mm"
        state: "{{ previsionshoraire['weather.forecast_shawinigan_sud'].forecast[0].precipitation }}"

yhaa I got it thanks. the forums would not let me post a update I guess I was flooding LOL

     - obj: "p5b51" # Forecast time +8h
      properties:
        "text": >
          {%- if not is_state('sensor.weather_hourly','unavailable') %}
          {%- set update = states('sensor.date') %}
          {%- set midnight = now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp() %}
          {%- set event = as_timestamp(strptime(state_attr('sensor.weather_hourly','forecast')[8]['datetime'], '%Y-%m-%dT%H:%M:%S%z', default='2020-01-00T00:00:00+00:00')) %}
          {%- set delta = ((event - midnight) // 86400) | int %}
          {%- if delta == 0 %}
          Today
          {%- elif delta == 1 %}
          Tomorrow
          {%- endif %}
          {{- event | timestamp_custom(" %-I %p") }}
          {%- endif %}

    - obj: "p5b52" # Forecast temp +8h
      properties:
        "text": "{{ state_attr('sensor.weather_hourly','forecast')[8]['temperature'] if not is_state('sensor.weather_hourly','unavailable') else '-' }}"

    - obj: "p5b53" # Forecast condition +8h
      properties:
        "src": >
          {%- if not is_state('sensor.weather_hourly','unavailable') %}
          L:/w-32-{{ state_attr('sensor.weather_hourly','forecast')[8]['condition'] }}.png
          {%- endif %}

May I ask, what are “obj:” and “properties”? I’m not familiar with these.

It’s for Json.
To display and actions on a display panel

if I want to retrieve one specific value via the template way using response_variable = mydata, I’m not sure about the syntax…

How can I simulate that in developper tool ?

{% set cond0 = mydata['weather.house'].forecast[1].condition %}
{% set cond0_time = as_timestamp(mydata['weather.house'].forecast[1].datetime) %}

Edit: I’m answering myself: in template, it works.
Still I didn’t find the way to simulate or provide example data in dev tool.

Hi all, I have updated to the April HA release and found out that my Apex graph that plots meteogram of the forecast does not work. Following discussion in this thread, I created a template sensor that should substitute the original weather. I did this as follows:

template:
  - trigger:
      - platform: time_pattern
        minutes: "*"
      - platform: homeassistant
        event: start
      - platform: event
        event_type: event_template_reloaded
    action:
      - variables:
          weather: weather.domov
      - service: weather.get_forecasts
        data:
          type: hourly
        target:
          entity_id: "{{ weather }}"
        response_variable: response
      - variables:
          forecast: "{{ response[weather].forecast }}"
          start: "{{ today_at('00:00') }}"
    sensor:
      - name: Weather Forecast Hourly
        unique_id: weather_forecast_hourly
        state: "{{ states('weather.domov') }}"
        attributes:
          temperature: "{{ state_attr('weather.domov', 'temperature') }}"
          dew_point: "{{ state_attr('weather.domov', 'dew_point') }}"
          temperature_unit: "{{ state_attr('weather.domov', 'temperature_unit') }}"
          humidity: "{{ state_attr('weather.domov', 'humidity') }}"
          cloud_coverage: "{{ state_attr('weather.domov', 'cloud_coverage') }}"
          pressure: "{{ state_attr('weather.domov', 'pressure') }}"
          pressure_unit: "{{ state_attr('weather.domov', 'pressure_unit') }}"
          wind_bearing: "{{ state_attr('weather.domov', 'wind_bearing') }}"
          wind_gust_speed: "{{ state_attr('weather.domov', 'wind_gust_speed') }}"
          wind_speed: "{{ state_attr('weather.domov', 'wind_speed') }}"
          wind_speed_unit: "{{ state_attr('weather.domov', 'wind_speed_unit') }}"
          visibility: "{{ state_attr('weather.domov', 'visibility') }}"
          visibility_unit: "{{ state_attr('weather.domov', 'visibility_unit') }}"
          precipitation: "{{ state_attr('weather.domov', 'precipitation') }}"
          precipitation_unit: "{{ state_attr('weather.domov', 'precipitation_unit') }}"
          forecast: {{ forecast }}

However, the resulting sensor looks like this:

friendly_name: Weather Forecast Hourly
temperature: 11.7
temperature_unit: °C
humidity: 80
cloud_coverage: 52
pressure: 1018.2
pressure_unit: hPa
wind_bearing: 224.65
wind_gust_speed: 29.52
wind_speed: 15.84
wind_speed_unit: km/h
visibility_unit: km
precipitation_unit: mm
forecast: >-
  [{'datetime': datetime.datetime(2024, 4, 5, 10, 0), 'condition':
  'partlycloudy', 'cloud_coverage': 68, 'wind_bearing': 228.86, 'temperature':
  13.6, 'apparent_temperature': 10.1, 'pressure': 1017.8, 'wind_gust_speed':
  28.44, 'wind_speed': 17.64, 'precipitation': 0.0, 'humidity': 75},
  {'datetime': datetime.datetime(2024, 4, 5, 11, 0), 'condition':
  'partlycloudy', 'cloud_coverage': 87, 'wind_bearing': 228.47, 'temperature':
  15.3, 'apparent_temperature': 11.8, 'pressure': 1017.5, 'wind_gust_speed':
  30.6, 'wind_speed': 18.72, 'precipitation': 0.0, 'humidity': 71}, {'datetime':
  datetime.datetime(2024, 4, 5, 12, 0), 'condition': 'cloudy', 'cloud_coverage':
  92, 'wind_bearing': 243.53, 'temperature': 16.3, 'apparent_temperature': 12.8,
  'pressure': 1017.6, 'wind_gust_speed': 30.6, 'wind_speed': 18.72,
  'precipitation': 0.0, 'humidity': 67}, {'datetime': datetime.datetime(2024, 4,
  5, 13, 0), 'condition': 'cloudy', 'cloud_coverage': 67, 'wind_bearing':
  249.09, 'temperature': 17.1, 'apparent_temperature': 13.6, 'pressure': 1017.2,
  'wind_gust_speed': 32.76, 'wind_speed': 17.28, 'precipitation': 0.0,
  'humidity': 64}, {'datetime': datetime.datetime(2024, 4, 5, 14, 0),
  'condition': 'partlycloudy', 'cloud_coverage': 65, 'wind_bearing': 235.9,
  'temperature': 18.1, 'apparent_temperature': 14.6, 'pressure': 1016.7,
  'wind_gust_speed': 28.8, 'wind_speed': 17.64, 'precipitation': 0.0,
  'humidity': 63}, {'datetime': datetime.datetime(2024, 4, 5, 15, 0),
  'condition': 'partlycloudy', 'cloud_coverage': 55, 'wind_bearing': 242.57,
  'temperature': 18.9, 'apparent_temperature': 14.4, 'pressure': 1016.3,
  'wind_gust_speed': 32.4, 'wind_speed': 19.8, 'precipitation': 0.0, 'humidity':
  59}, {'datetime': datetime.datetime(2024, 4, 5, 16, 0), 'condition':
  'partlycloudy', 'cloud_coverage': 66, 'wind_bearing': 245.22, 'temperature':
  19.3, 'apparent_temperature': 17.9, 'pressure': 1015.6, 'wind_gust_speed':
  32.4, 'wind_speed': 16.2, 'precipitation': 0.0, 'humidity': 57}, {'datetime':
  datetime.datetime(2024, 4, 5, 17, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 54, 'wind_bearing': 223.14, 'temperature': 19.6,
  'apparent_temperature': 19.0, 'pressure': 1015.1, 'wind_gust_speed': 26.28,
  'wind_speed': 12.6, 'precipitation': 0.0, 'humidity': 58}, {'datetime':
  datetime.datetime(2024, 4, 5, 18, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 18, 'wind_bearing': 212.25, 'temperature': 19.5,
  'apparent_temperature': 18.1, 'pressure': 1014.9, 'wind_gust_speed': 24.48,
  'wind_speed': 14.4, 'precipitation': 0.0, 'humidity': 59}, {'datetime':
  datetime.datetime(2024, 4, 5, 19, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 38, 'wind_bearing': 214.57, 'temperature': 18.4,
  'apparent_temperature': 17.9, 'pressure': 1015.2, 'wind_gust_speed': 22.68,
  'wind_speed': 12.24, 'precipitation': 0.0, 'humidity': 65}, {'datetime':
  datetime.datetime(2024, 4, 5, 20, 0), 'condition': 'cloudy', 'cloud_coverage':
  100, 'wind_bearing': 187.52, 'temperature': 17.5, 'apparent_temperature':
  14.9, 'pressure': 1015.0, 'wind_gust_speed': 22.68, 'wind_speed': 15.12,
  'precipitation': 0.0, 'humidity': 63}, {'datetime': datetime.datetime(2024, 4,
  5, 21, 0), 'condition': 'cloudy', 'cloud_coverage': 97, 'wind_bearing':
  200.34, 'temperature': 17.3, 'apparent_temperature': 13.8, 'pressure': 1015.2,
  'wind_gust_speed': 26.28, 'wind_speed': 17.64, 'precipitation': 0.0,
  'humidity': 60}, {'datetime': datetime.datetime(2024, 4, 5, 22, 0),
  'condition': 'partlycloudy', 'cloud_coverage': 83, 'wind_bearing': 217.1,
  'temperature': 16.8, 'apparent_temperature': 13.3, 'pressure': 1015.5,
  'wind_gust_speed': 28.44, 'wind_speed': 18.72, 'precipitation': 0.0,
  'humidity': 60}, {'datetime': datetime.datetime(2024, 4, 5, 23, 0),
  'condition': 'partlycloudy', 'cloud_coverage': 61, 'wind_bearing': 243.0,
  'temperature': 16.3, 'apparent_temperature': 12.8, 'pressure': 1016.2,
  'wind_gust_speed': 29.16, 'wind_speed': 18.0, 'precipitation': 0.0,
  'humidity': 60}, {'datetime': datetime.datetime(2024, 4, 6, 0, 0),
  'condition': 'partlycloudy', 'cloud_coverage': 53, 'wind_bearing': 252.37,
  'temperature': 15.7, 'apparent_temperature': 11.2, 'pressure': 1016.7,
  'wind_gust_speed': 31.32, 'wind_speed': 20.16, 'precipitation': 0.0,
  'humidity': 68}, {'datetime': datetime.datetime(2024, 4, 6, 1, 0),
  'condition': 'partlycloudy', 'cloud_coverage': 90, 'wind_bearing': 250.04,
  'temperature': 15.4, 'apparent_temperature': 11.9, 'pressure': 1017.1,
  'wind_gust_speed': 30.6, 'wind_speed': 18.0, 'precipitation': 0.0, 'humidity':
  72}, {'datetime': datetime.datetime(2024, 4, 6, 2, 0), 'condition': 'cloudy',
  'cloud_coverage': 86, 'wind_bearing': 247.55, 'temperature': 14.9,
  'apparent_temperature': 11.4, 'pressure': 1017.2, 'wind_gust_speed': 27.36,
  'wind_speed': 16.92, 'precipitation': 0.0, 'humidity': 71}, {'datetime':
  datetime.datetime(2024, 4, 6, 3, 0), 'condition': 'cloudy', 'cloud_coverage':
  93, 'wind_bearing': 245.44, 'temperature': 14.2, 'apparent_temperature': 10.7,
  'pressure': 1017.1, 'wind_gust_speed': 25.92, 'wind_speed': 16.2,
  'precipitation': 0.0, 'humidity': 73}, {'datetime': datetime.datetime(2024, 4,
  6, 4, 0), 'condition': 'cloudy', 'cloud_coverage': 89, 'wind_bearing': 231.21,
  'temperature': 13.7, 'apparent_temperature': 10.2, 'pressure': 1017.2,
  'wind_gust_speed': 28.08, 'wind_speed': 19.08, 'precipitation': 0.0,
  'humidity': 75}, {'datetime': datetime.datetime(2024, 4, 6, 5, 0),
  'condition': 'cloudy', 'cloud_coverage': 97, 'wind_bearing': 254.25,
  'temperature': 13.8, 'apparent_temperature': 11.2, 'pressure': 1018.0,
  'wind_gust_speed': 30.96, 'wind_speed': 14.4, 'precipitation': 0.0,
  'humidity': 75}, {'datetime': datetime.datetime(2024, 4, 6, 6, 0),
  'condition': 'cloudy', 'cloud_coverage': 94, 'wind_bearing': 251.38,
  'temperature': 13.3, 'apparent_temperature': 12.2, 'pressure': 1018.1,
  'wind_gust_speed': 23.04, 'wind_speed': 7.56, 'precipitation': 0.0,
  'humidity': 78}, {'datetime': datetime.datetime(2024, 4, 6, 7, 0),
  'condition': 'cloudy', 'cloud_coverage': 85, 'wind_bearing': 207.4,
  'temperature': 12.9, 'apparent_temperature': 11.8, 'pressure': 1018.7,
  'wind_gust_speed': 12.6, 'wind_speed': 7.56, 'precipitation': 0.0, 'humidity':
  83}, {'datetime': datetime.datetime(2024, 4, 6, 8, 0), 'condition': 'cloudy',
  'cloud_coverage': 99, 'wind_bearing': 209.69, 'temperature': 13.4,
  'apparent_temperature': 11.6, 'pressure': 1019.0, 'wind_gust_speed': 13.68,
  'wind_speed': 9.36, 'precipitation': 0.0, 'humidity': 82}, {'datetime':
  datetime.datetime(2024, 4, 6, 9, 0), 'condition': 'cloudy', 'cloud_coverage':
  95, 'wind_bearing': 228.77, 'temperature': 14.5, 'apparent_temperature': 12.7,
  'pressure': 1019.2, 'wind_gust_speed': 18.36, 'wind_speed': 11.52,
  'precipitation': 0.0, 'humidity': 77}, {'datetime': datetime.datetime(2024, 4,
  6, 10, 0), 'condition': 'cloudy', 'cloud_coverage': 99, 'wind_bearing': 264.6,
  'temperature': 15.0, 'apparent_temperature': 13.9, 'pressure': 1019.9,
  'wind_gust_speed': 20.88, 'wind_speed': 9.0, 'precipitation': 0.0, 'humidity':
  75}, {'datetime': datetime.datetime(2024, 4, 6, 11, 0), 'condition': 'cloudy',
  'cloud_coverage': 42, 'wind_bearing': 218.84, 'temperature': 17.0,
  'apparent_temperature': 16.6, 'pressure': 1019.6, 'wind_gust_speed': 17.28,
  'wind_speed': 10.08, 'precipitation': 0.0, 'humidity': 71}, {'datetime':
  datetime.datetime(2024, 4, 6, 12, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 45, 'wind_bearing': 232.78, 'temperature': 19.1,
  'apparent_temperature': 18.5, 'pressure': 1019.2, 'wind_gust_speed': 19.08,
  'wind_speed': 10.8, 'precipitation': 0.0, 'humidity': 63}, {'datetime':
  datetime.datetime(2024, 4, 6, 13, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 50, 'wind_bearing': 228.53, 'temperature': 20.7,
  'apparent_temperature': 20.1, 'pressure': 1018.7, 'wind_gust_speed': 20.52,
  'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 59}, {'datetime':
  datetime.datetime(2024, 4, 6, 14, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 59, 'wind_bearing': 244.94, 'temperature': 22.4,
  'apparent_temperature': 21.7, 'pressure': 1018.3, 'wind_gust_speed': 20.16,
  'wind_speed': 10.8, 'precipitation': 0.0, 'humidity': 54}, {'datetime':
  datetime.datetime(2024, 4, 6, 15, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 50, 'wind_bearing': 249.14, 'temperature': 23.1,
  'apparent_temperature': 22.3, 'pressure': 1018.0, 'wind_gust_speed': 22.68,
  'wind_speed': 12.24, 'precipitation': 0.0, 'humidity': 50}, {'datetime':
  datetime.datetime(2024, 4, 6, 16, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 48, 'wind_bearing': 253.46, 'temperature': 23.3,
  'apparent_temperature': 22.5, 'pressure': 1017.7, 'wind_gust_speed': 21.6,
  'wind_speed': 11.16, 'precipitation': 0.0, 'humidity': 49}, {'datetime':
  datetime.datetime(2024, 4, 6, 17, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 57, 'wind_bearing': 222.53, 'temperature': 23.1,
  'apparent_temperature': 22.3, 'pressure': 1017.8, 'wind_gust_speed': 19.8,
  'wind_speed': 11.88, 'precipitation': 0.0, 'humidity': 51}, {'datetime':
  datetime.datetime(2024, 4, 6, 18, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 43, 'wind_bearing': 209.56, 'temperature': 22.4,
  'apparent_temperature': 21.7, 'pressure': 1017.5, 'wind_gust_speed': 19.08,
  'wind_speed': 10.44, 'precipitation': 0.0, 'humidity': 55}, {'datetime':
  datetime.datetime(2024, 4, 6, 19, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 33, 'wind_bearing': 215.93, 'temperature': 20.9,
  'apparent_temperature': 20.3, 'pressure': 1017.4, 'wind_gust_speed': 16.2,
  'wind_speed': 9.36, 'precipitation': 0.0, 'humidity': 62}, {'datetime':
  datetime.datetime(2024, 4, 6, 20, 0), 'condition': 'clear-night',
  'cloud_coverage': 12, 'wind_bearing': 209.09, 'temperature': 18.7,
  'apparent_temperature': 18.9, 'pressure': 1017.6, 'wind_gust_speed': 12.96,
  'wind_speed': 8.28, 'precipitation': 0.0, 'humidity': 67}, {'datetime':
  datetime.datetime(2024, 4, 6, 21, 0), 'condition': 'clear-night',
  'cloud_coverage': 26, 'wind_bearing': 194.42, 'temperature': 17.0,
  'apparent_temperature': 16.6, 'pressure': 1018.2, 'wind_gust_speed': 11.88,
  'wind_speed': 9.0, 'precipitation': 0.0, 'humidity': 68}, {'datetime':
  datetime.datetime(2024, 4, 6, 22, 0), 'condition': 'clear-night',
  'cloud_coverage': 21, 'wind_bearing': 178.52, 'temperature': 15.8,
  'apparent_temperature': 14.0, 'pressure': 1018.5, 'wind_gust_speed': 12.6,
  'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 74}, {'datetime':
  datetime.datetime(2024, 4, 6, 23, 0), 'condition': 'clear-night',
  'cloud_coverage': 28, 'wind_bearing': 193.53, 'temperature': 14.9,
  'apparent_temperature': 13.1, 'pressure': 1018.3, 'wind_gust_speed': 14.4,
  'wind_speed': 10.8, 'precipitation': 0.0, 'humidity': 81}, {'datetime':
  datetime.datetime(2024, 4, 7, 0, 0), 'condition': 'clear-night',
  'cloud_coverage': 5, 'wind_bearing': 196.75, 'temperature': 14.2,
  'apparent_temperature': 12.4, 'pressure': 1018.2, 'wind_gust_speed': 15.84,
  'wind_speed': 11.16, 'precipitation': 0.0, 'humidity': 82}, {'datetime':
  datetime.datetime(2024, 4, 7, 1, 0), 'condition': 'clear-night',
  'cloud_coverage': 1, 'wind_bearing': 181.62, 'temperature': 13.5,
  'apparent_temperature': 11.7, 'pressure': 1018.6, 'wind_gust_speed': 15.48,
  'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 79}, {'datetime':
  datetime.datetime(2024, 4, 7, 2, 0), 'condition': 'clear-night',
  'cloud_coverage': 1, 'wind_bearing': 173.52, 'temperature': 13.0,
  'apparent_temperature': 11.2, 'pressure': 1018.9, 'wind_gust_speed': 12.96,
  'wind_speed': 9.0, 'precipitation': 0.0, 'humidity': 76}, {'datetime':
  datetime.datetime(2024, 4, 7, 3, 0), 'condition': 'clear-night',
  'cloud_coverage': 0, 'wind_bearing': 178.96, 'temperature': 12.8,
  'apparent_temperature': 11.0, 'pressure': 1019.1, 'wind_gust_speed': 15.12,
  'wind_speed': 11.16, 'precipitation': 0.0, 'humidity': 73}, {'datetime':
  datetime.datetime(2024, 4, 7, 4, 0), 'condition': 'clear-night',
  'cloud_coverage': 6, 'wind_bearing': 176.45, 'temperature': 12.6,
  'apparent_temperature': 10.8, 'pressure': 1019.0, 'wind_gust_speed': 15.12,
  'wind_speed': 10.44, 'precipitation': 0.0, 'humidity': 76}, {'datetime':
  datetime.datetime(2024, 4, 7, 5, 0), 'condition': 'clear-night',
  'cloud_coverage': 20, 'wind_bearing': 178.65, 'temperature': 12.3,
  'apparent_temperature': 10.5, 'pressure': 1018.8, 'wind_gust_speed': 14.4,
  'wind_speed': 10.08, 'precipitation': 0.0, 'humidity': 75}, {'datetime':
  datetime.datetime(2024, 4, 7, 6, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 54, 'wind_bearing': 176.78, 'temperature': 11.9,
  'apparent_temperature': 10.1, 'pressure': 1018.8, 'wind_gust_speed': 14.76,
  'wind_speed': 9.72, 'precipitation': 0.0, 'humidity': 73}, {'datetime':
  datetime.datetime(2024, 4, 7, 7, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 67, 'wind_bearing': 153.28, 'temperature': 11.0,
  'apparent_temperature': 9.9, 'pressure': 1019.4, 'wind_gust_speed': 13.68,
  'wind_speed': 6.12, 'precipitation': 0.0, 'humidity': 77}, {'datetime':
  datetime.datetime(2024, 4, 7, 8, 0), 'condition': 'partlycloudy',
  'cloud_coverage': 71, 'wind_bearing': 130.91, 'temperature': 12.0,
  'apparent_temperature': 11.5, 'pressure': 1019.8, 'wind_gust_speed': 9.72,
  'wind_speed': 5.04, 'precipitation': 0.0, 'humidity': 76}]

The forecast attribute is different to what it used to be (not formated datetime, attribute is a string instead of an iterable object; e.g., forecast[1] is a single character).

In the plotting part (apex) I have entries like this

      - entity: sensor.weather_forecast_hourly
        name: Teplota předpověď
        yaxis_id: temp
        unit: °C
        type: line
        color: '#FFBF00'
        data_generator: |
          return entity.attributes.forecast.map((entry) => 
          {
            var date = new Date(entry.datetime);
            
            return [date, entry.temperature];
          });
        show:
          datalabels: false
          extremas: true

Does anyone have an idea how to fix it? Many thanks in advance and sorry if I failed to find a post that might have addressed this (but I tried).

Your weather provided uses datetime.datetime objects in the forecast, instead of datetime strings. This makes your template weather entity fail rendering it’s forecast attribute and it puts it all in a big string.

You need to iterate over all the forecast data, and replace the datetime.datetime objects with a datetime isoformat string. Or you need ot use another weather provider which already uses strings :slight_smile:

1 Like

I just think that not many people look into the forum…

Currently over 228100 registered users of this forum.

Anyway, moot point because the forecast attribute has been eliminated.

Yes I am registered and found this vote today, despite I rant about this problem before via github and made a forum post here…

I am super busy and just getting around to dealing with this change now… I have a couple of automations/scripts that are pulling old forecast attribute data and erroring out. I’ve known since March they stopped working, but just getting to deal with it now. I’m not super advanced here, so please bear with me. Here is an example of script I have running “Good Morning” that is called by a separate automation.

alias: Good Morning
sequence:
  - service: alarm_control_panel.alarm_disarm
    data:
      code: "XXXX"
    entity_id: alarm_control_panel.home_alarm
  - service: light.turn_on
    data:
      brightness_pct: 30
      color_name: fuchsia
    target:
      entity_id: light.kitchen_lights
  - wait_for_trigger:
      - type: motion
        platform: device
        device_id: a04404d353f445b4b78b838cc103efaa
        entity_id: binary_sensor.presence_8
        domain: binary_sensor
  - service: media_player.volume_set
    data:
      volume_level: 0.2
    target:
      entity_id: media_player.echo_plus
  - delay: "00:00:02"
  - service: notify.alexa_media
    data:
      data:
        type: announce
      message: >-
        Good morning! It is currently {{states.weather.thermostat.state}} and
        {{state_attr('weather.thermostat', 'temperature')}}. Todays high is
        {{state_attr('weather.thermostat', 'forecast')[0]['temperature']}} with
        a low of {{state_attr('weather.thermostat', 'forecast')[0]['templow']}}.
        Now, get out there and kick ass!
      target:
        - media_player.echo_plus
mode: single

Obviously the service call to notify.alexa_media at the bottom is erroring.
Can anyone point me in the right direction? From skimming 323 relies here, the answer lies in calling a new get weather service, but then what? And can I do that right in the automation/scripts I have, or is this done elsewhere?

Thanks.

call get forcasts as a service directly before your notify.alexa_media. Store the information in a response variable, then get it out in the message.

Thanks. Regarding the “Store the information in a response variable” part of your guidance, can this be done in the script/automation, or does this require making a Helper/Template?

it’s built into the get_forecast service call,

response_variable: my_variable

then later in whatever template…

my_variable[...

I’m guessing I’m missing something really basic here… Here is an example of something.

action:
  - service: weather.get_forecasts
    data:
      type: daily
    target:
      entity_id: weather.thermostat
    response_variable: forecast_daily
  - service: notify.mobile_app_iphone_13
    data:
      title: Morning Flash
      message: >-
        It is currently {{states.weather.thermostat.state}} and
        {{state_attr('weather.thermostat', 'temperature')}}. Today's high is {{
        forecast_daily['weather.thermostat']['forecast'][0].temperature }} with
        a low of {{ forecast_daily['weather.thermostat']['forecast'][0].templow
        }}.

Yes, you are missing your “intentions” , for ones :wink: , and there are multiple Answers/solutions above in this Topic, so maybe you also “missed” Reading

You are mixing old “way” with “new” way"

.forecast[0].temperature }}

1 Like

That should work, is it not?

Nah, not working…
websocket_api script: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: ‘forecast_daily’ is undefined

140710661310784] Error handling message: Error rendering data template: UndefinedError: ‘forecast_daily’ is undefined (home_assistant_error)