Arrival home TTS question

This is what I’ve built so far. What I’d like to do is have mulitple messages so I’m not hearing the same one over and over everyday. Is there a way to play a different message each time? I guess I’m thinking a group of messages that it an choose from like an array… Pretty sure it’s possible not sure how to make that work… Any suggestions would be awesome!

Thank you!

- alias:  16 - Arrival Home
  id: Getting home 

  trigger:
    - platform: state
      entity_id: device_tracker.sm_f926u1
      from: not_home
      to: home

  action:
    - service: tts.cloud_say
      data:
        entity_id: media_player.sonos_five
        message: So nice to have you home John.  Is there anything I can do for you?

Various methods mentioned throughout the forum, see link below.

https://community.home-assistant.io/search?q=random%20tts%20message

FYI, you posted in the wrong section.

Oh Thank you!
I did find one…

Sorry about the wrong post…

action:
    - service: tts.cloud_say
      entity_id: media_player.sonos_five
      data_template:
        message: >
            {{ ('Great to have you home John, is there anything I can do for you?',
            'Hello Master.. what is thy bidding?'
            )|random }}

A way to get more random messages is to not write the name and use replace

action:
    - service: tts.cloud_say
      entity_id: media_player.sonos_five
      data_template:
        message: >
            {{ ('Great to have you home AAAA, is there anything I can do for you?',
            'Hello AAAA.. what is thy bidding?'
            )|random | replace("AAAA", ("John", "Master", "Johnnyboy")| random) }}

2 Likes

That made me laugh… I like that much better LOL

Had to add ‘numbnuts’ in the name field so it’ll be a 4 name random thing LOL
Thank you again!!!