Error rendering data template: UndefinedError: None has no element 0

Hi all, any ideas why my morning weather announcement routine stopped working with error “Error rendering data template: UndefinedError: None has no element 0”?

Yes. See “Weather” under this list:

Lots of topics on here about it.

In future, please post code as text, not screenshots. See here:

Thanks for your reply. Sorry for posting the screenshot and not the code but I’m sure volunteers here supporting the full community are tired of hearing “sorry” and thank you" :see_no_evil:
I’ve replaced “forecast” with “weather.get_forecasts” but I get the same error.
Here’s my code:

service: notify.alexa_media_kitchen
metadata: {}
data:
  message: >-
    {% set state = states('weather.openweathermap') %} {% set temperature =
    state_attr('weather.openweathermap', 'temperature') %} {% set humidity =
    state_attr('weather.openweathermap', 'humidity') %} {% set windspeed =
    state_attr('weather.openweathermap', 'wind_speed') %} {% set rain =
    state_attr('weather.openweathermap', 'weather.get_forecasts').0.precipitation_probability
    %} {% if state == 'partlycloudy' %}
      {% set state = 'Partly Cloudy' %}
    {% endif %} Good Morning! It looks like today the weather will be {{state}},
    with a temperature of {{temperature}} degrees, wind speed of {{windspeed}}
    meters per second and a {{rain}}% chance of rain. Enjoy your day!

It’s not as simple as a rename. weather.get_forecasts is a service not an attribute. If you need to work with the forecasts beyond simply using the integration’s weather card display, you’ll need to pull them in to a template sensor as described in the first example here, swapping weather.home for weather.openweathermap:

If you add the following code to that, you should get the entire forecast:

        attributes:
          forecast: "{{ hourly['weather.openweathermap'].forecast }}"

Then you’ll need to update your announcement to use the rainfall probability attribute from that sensor instead.