TTS automation, "random" not working

Hey guys, I have a problem with this automation… This is my code:

update:
  alias: 'update available'
  sequence:
    - service: notify.ios_iphone
      data_template:
      title: "New Version"
        message: "Home Assistant {{ states.updater.updater.state }} is available to download."
    - service: script.sonos_say
      data_template:
        sonos_entity: 'media_player.dormitorio_ppal'
        volume: 0.65
        message: >
          {% if now().strftime("%H")|int < 12 %}
          Good morning.
          {% elif now().strftime("%H")|int < 19 %}
          Good afternoon.
          {% else %}
          Good evening.
          {% endif %}
          {{ [
          "software {{ states.updater.updater.state }} is available to download.",
          "please, update my software to version {{ states.updater.updater.state }}.",
          "version {{ states.updater.updater.state }} is available now."
          ] |random }}

The problem is that “polly” mentions literally “states.updater.updater.state” instead of good morning, version 6.0 is available now.
If I remove the random part, it works …

IIt’s weird, I don’t know what I’m doing wrong, I would appreciate any help.

1 Like