TTS Weather not working after update

Hi there,

got some troubles with one of my automations. Our weather forecast via tts doesn’t work anymode since last update.
I know there where changes in how to deal with weather forecast - but my yaml knowledge isn’t strongh enough to get the code working again.

Error Message: “Error rendering data template: UndefinedError: None has no element 0”

service: tts.speak
data:
 cache: false
 language: de
 entity_id: mp.vlc_telnet
 message: "{% set t = now().hour %} {% set m = 'Guten Morgen' if t < 12 else 'Schönen Nachmittag' if t < 18 else 'Guten Abend' %} {% set e = 'erfolgreichen Tag' if t < 12 else 'tollen Nachmittag' if t < 18 else 'ruhigen Abend' %} {% set weather = { \t'clear-night': \"klare Nacht\", \t'cloudy': \"bewölktem\", \t'exceptional': \"außergewöhnlichem\", \t'fog': \"nebligem\", \t'hail': \"hageligem\", \t'lightning': \"schwer gewitterndem\", \t'lightning-rainy': \"gewittrigem\", \t'partlycloudy': \"leicht bewölktem\", \t'pouring': \"stark verregnendem\", \t'rainy': \"regnerischem\", \t'snowy': \"verschneitem\", \t'snowy-rainy': \"graupelndem\", \t'sunny': \"sonnigem\", \t'windy': \"windigem\", \t'windy-variant': \"wechselnd windigem\"   } %} {{m}} Familie. Heute ist {{ states('sensor.datum_deutsch') }}, es ist {{ now().hour}} Uhr {{ now().minute }}. Wir erwarten eine Temperatur von {{ state_attr('weather.melmax','forecast')[0].temperature}} Grad Celsius bei {{weather[state_attr('weather.melmax','forecast')[0].condition] }} Wetter und Windgeschwindigkeiten bis zu {{state_attr('weather.melmax', 'forecast')[0].wind_speed }} km/h. Ich wünsche euch einen {{e}}!"
alias: TTS-Wetter

I’m happy about any help :slight_smile:

Try putting that very long template into the template editor in HA

Thank you nickrout,

getting “TemplateSyntaxError: unexpected char ‘\’ at 328” as result.
Does this help?

Thanks

Character 328 in that line (the ) is unexpected.

Now that is a one liner! And this also I guess.

You need to make a service call to get the forecast. There has been about 1000 threads about it so far so just search for it

1 Like