Restored VM Text To Speech now Broke - None has no element 0

I had to restore a VM today, old machine finally crashed…of course I had no backups :frowning:

Looking over my stuff, I am fixing things here and there, but something has popped up that I have no clue what is going on.
This automation WAS working before I did the restore.
When my automation runs, it fails on this part.

service: tts.cloud_say
data:
  entity_id: media_player.pool_nest_audio
  message: >-
    {% set forecast = state_attr('weather.home', 'forecast')[0] %} Today will be
    {{forecast.condition}} with a high of {{forecast.temperature}} and a low of
    {{forecast.templow}}. Currently it is
    {{states('sensor.home_apparent_temperature')}} degrees. The pool water is
    currently at {{states('sensor.pool_temp')}} degrees
  options:
    gender: male

Now, I looked up all those sensors, they all show data.

Adding to this, I am using Accuweather.

I tried a search, but from the answers I am seeing, I am not getting it to work still.

I set this up in the config file, restarted. But could not locat the sensor, plus I think I did it wrong as I dont see accuweather but it shows me ‘weather’

template:
  - trigger:
      - platform: state
        entity_id: AccuWeather.forecast_local  # this is my weather provider
    action:
      - service: AccuWeather.get_forecasts
        data:
          type: daily  # change to hourly if you want hourly forecasts
        target:
          entity_id: AccuWeather.forecast_local
        response_variable: daily
    sensor:
      - name: Local Weather Forecast Daily
        unique_id: local_weather_forecast_daily
        state: "{{ now() }}"
        attributes:
          forecast: "{{ daily['weather.forecast_local'].forecast }}"

you’re right that AccuWeather is wrong :slight_smile:

looking at your original code, i’m guessing your weather entity is weather.home. i’m not exactly sure what you want the sensor to be but i’ll get you started i hope…

if you do something like this:

template:
  - trigger:
      - platform: time_pattern
        hours: 1   
    action:
      - service: weather.get_forecasts
        data:
          type: daily  
        target:
          entity_id: weather.home
        response_variable: daily
    sensor:
      - name: Local Weather Forecast Daily
        unique_id: local_weather_forecast_daily
        state: "{{ daily['weather.home'].forecast[0].temperature}}"
        unit_of_measurement: °C    

it will get the temperature forecast for the next day and put it in the sensor.
the hours: 1 part asks for it to happen every morning at 1am. (so on immediate load, it’d not be fetched… you could switch it to something like minutes: /1 to fetch it every minute just for testing…

you shouldn’t specify AccuWeather, that’s behind your weather entity. use the weather entity you have instead.

this should create a sensor called sensor.local_weather_forecast_daily if i did it all right… ie, warning i free typed it, didn’t load and test it on my config… but hopefully this gets you going in the right direction.

it changed It to have the forecast temperature as the state… you had the time it was queried, which i don’t think is all that useful… but change as you please. perhaps you might want condition instead of temperature ? and move temp into an attribute? in any case… follow the format there and customize as you please