Need help with tts template and alexa

So i’m trying to incorporate CCostan’s greeting automation into my own. It works for the google devices but not my echo i just got today. This is what I currently have…thanks

- id: '1588627574447'
  alias: Test Greeting
  description: ''
  trigger:
  - entity_id: device_tracker.big_daddy
    from: not_home
    platform: state
    to: home
  condition: []
  action:
  - data:
      data_template:
        type: tts
      message: '{% set person = state_attr(trigger.entity_id, "friendly_name")%} {%-
        macro greeting_sentence(person) -%} {{ [ "Welcome back home " ~ person, "Guess
        who is home?" ~ person +" is!", person + " is now in the house.", "Welcome
        Home " ~ person + ".  We have missed you. Or at least Molly did.", "Welcome
        home "~person+"! Having sex is like playing bridge. If you don’t have a good
        partner, you’d better have a good hand", "Welcome home "~person+"! War does
        not determine who is right , only who is left", "Welcome home "~person+"!
        Politicians and diapers have one thing in common. They should both be changed
        regularly, and for the same reason", "Welcome home "~person+"! If sex is a
        pain in the ass, then you’re doing it wrong", "Welcome home "~person+"! If
        you think nobody cares if you’re alive, try missing a couple of payments",
        "Welcome home "~person+"! Women will never be equal to men until they can
        walk down the street with a bald head and a beer gut, and still think they
        are sexy", "Welcome home "~person+"! The voices in my head may not be real,
        but they have some good ideas", "Welcome home "~person+"! Laugh at your problems,
        everybody else does", "Welcome home "~person+"! Artificial intelligence is
        no match for natural stupidity", "Welcome home "~person+"! Crowded elevators
        smell different to midgets", "Welcome home "~person+"! Why do Americans choose
        from just two people to run for president .... and 50 for Miss America?",
        "Welcome home "~person+"! My psychiatrist told me I was crazy .... and I said
        I want a second opinion .... He said okay .... you’re ugly too", "Welcome
        home "~person+"! I always take life with a grain of salt .... plus a slice
        of lemon .... and a shot of tequila", "Welcome home "~person+"! Jesus loves
        you .... but everyone else ..... thinks you’re an asshole", "Welcome home
        "~person+"! Did you know that, Squirrels are nature’s speed bumps?", "Welcome
        home "~person+"! Being in a nudist colony .... probably takes all the fun
        out of Halloween", "Welcome home "~person+"! Everyone has the right to be
        stupid, but you are abusing the privilege", "Welcome home "~person~"! If Wal-Mart
        is lowering prices every day, why isn’t anything in the store free yet", "Welcome
        home "~person~"! What has four legs and an arm? A happy guard dog", "Welcome,
        to the, Hotel, California, ~ person~", "Welcome home "~person+"! Employee
        of the month is a good example of how somebody can be both a winner and a
        loser at the same time", "Welcome home "~person+"! My drug test came back
        negative. My dealer sure has some explaining to do", "Welcome home "~person+"!
        I have 3 kids and no money, why I can’t I have no kids and 3 money", "Welcome
        home "~person+"! Circumcision is popular because ......... Jewish girls won’t
        touch anything ..... that’s not at least 15% off", "Welcome home "~person+"!
        I have a lot of growing up to do ........... I realized that the other day
        inside my fort" "Our home is now complete, Rest your head and relax your feet!
        Welcome Back " ~ person, "Life is like a song, you’re back where you belong.
        Welcome home " ~ person, "Hey there " ~ person + " Welcome Home!", "Knock
        Knock. Who is There, "   ~ person +" is!", "Welcome home "~person~"! Sex is
        not the answer. Sex is the question. Yes, is the answer.", "Welcome home "~person~"!
        Light travels faster than sound. This is why some people appear bright until
        you hear them speak", "The garage door opener just told me that "   ~ person
        +" is home.", person + " can not hide from the system. Welcome home.", person
        ~ "! You are home!", "I know a secret! "  ~ person +" is home!", "Hey "  ~
        person +". Your arrival has been recorded by the Smartest house on the block.",
        "Take note kids! "  ~ person +" is home.", "I am sensing a disturbance in
        the force. "  ~ person +" must be home!", "And the house becomes a home. Welcome
        back " ~ person, person + " is now here.  Hash tag Welcome Home.", person
        + " is now here.  Hash tag Home.", person + " is now here.  Hash tag Smart
        Home.", "Just a quick announcement. " ~ person +" has arrived!", "Pardon the
        interruption but " ~ person +" is home!", "My systems are picking up the presence
        of additional humans. " ~ person +" has been identified as home.", "Welcome
        home "~person~"! It is nice to see you again!", "It looks like "~person~"
        is finally home!" ] | random }} {%- endmacro -%} {{greeting_sentence(person)}}

        '
    service: notify.alexa_media_martin_s_echo_dot

what are you using to set up the communication to the alexa app?

I’m using Alexa Media Player installed from HACS. I have no issues with using the cloud part or other automation messages like:

- id: '1588020615931'
  alias: Reminder Fertilize The Lawn
  description: ''
  trigger:
  - at: 08:00:00
    platform: time
  condition:
  - condition: time
    weekday:
    - tue
  action:
  - data:
      data:
        type: tts
      message: Time to fertilize the lawn and plants.
    service: notify.alexa_media_martin_s_echo_dot

It’s just the template is giving me issues for some reason with not wanting to work on the Dot but works on the google Mini.

try like this:

action:
  - service: notify.alexa_media
    data_template:
      data:
        target: media_player.your_media_player_dot_entity_here
        type: tts
      message: >
        {% set person = state_attr(trigger.entity_id, "friendly_name") %} 
        {%- macro greeting_sentence(person) -%} 
        {{ [ 
           "Welcome back home "~person, 
           "Guess who is home?"~person+" is!", 
           person+" is now in the house.", 
           "Welcome Home "~person+". We have missed you. Or at least Molly did.", 
           "Welcome home "~person+"! Having sex is like playing bridge. If you don’t have a good partner, you’d better have a good hand", 
           "Welcome home "~person+"! War does not determine who is right , only who is left", 
           "Welcome home "~person+"! Politicians and diapers have one thing in common. They should both be changed regularly, and for the same reason", 
           "Welcome home "~person+"! If sex is a pain in the ass, then you’re doing it wrong", 
           "Welcome home "~person+"! If you think nobody cares if you’re alive, try missing a couple of payments",
           "Welcome home "~person+"! Women will never be equal to men until they can walk down the street with a bald head and a beer gut, and still think they are sexy", 
           "Welcome home "~person+"! The voices in my head may not be real, but they have some good ideas", 
           "Welcome home "~person+"! Laugh at your problems, everybody else does", 
           "Welcome home "~person+"! Artificial intelligence is no match for natural stupidity", 
           "Welcome home "~person+"! Crowded elevators smell different to midgets", 
           "Welcome home "~person+"! Why do Americans choose from just two people to run for president .... and 50 for Miss America?",
           "Welcome home "~person+"! My psychiatrist told me I was crazy .... and I said I want a second opinion .... He said okay .... you’re ugly too", 
           "Welcome home "~person+"! I always take life with a grain of salt .... plus a slice of lemon .... and a shot of tequila", 
           "Welcome home "~person+"! Jesus loves you .... but everyone else ..... thinks you’re an asshole", 
           "Welcome home "~person+"! Did you know that, Squirrels are nature’s speed bumps?", 
           "Welcome home "~person+"! Being in a nudist colony .... probably takes all the fun out of Halloween", 
           "Welcome home "~person+"! Everyone has the right to be stupid, but you are abusing the privilege", 
           "Welcome home "~person~"! If Wal-Mart is lowering prices every day, why isn’t anything in the store free yet", 
           "Welcome home "~person~"! What has four legs and an arm? A happy guard dog", 
           "Welcome to the Hotel California, "~person,
           "Welcome home "~person+"! Employee of the month is a good example of how somebody can be both a winner and a loser at the same time", 
           "Welcome home "~person+"! My drug test came back negative. My dealer sure has some explaining to do", 
           "Welcome home "~person+"! I have 3 kids and no money, why I can’t I have no kids and 3 money", 
           "Welcome home "~person+"! Circumcision is popular because ......... Jewish girls won’t touch anything ..... that’s not at least 15% off", 
           "Welcome home "~person+"! I have a lot of growing up to do ........... I realized that the other day inside my fort", 
           "Welcome home "~person+"! Our home is now complete, Rest your head and relax your feet!",
           "Welcome Back "~person+"! Life is like a song, you’re back where you belong.",
           "Welcome home "~person, 
           "Hey there "~person+", Welcome Home!",
           "Knock Knock. Who is There?, "~person+" is!", 
           "Welcome home "~person~"! Sex is not the answer. Sex is the question. Yes, is the answer.", 
           "Welcome home "~person~"! Light travels faster than sound. This is why some people appear bright until you hear them speak", 
           "The garage door opener just told me that "~person+" is home.", 
           person+ " can not hide from the system. Welcome home.", 
           person~ "! You are home!", 
           "I know a secret! "~person+" is home!", 
           "Hey "~person+". Your arrival has been recorded by the Smartest house on the block.",
           "Take note kids! "~person+" is home.", 
           "I am sensing a disturbance in the force. "~person+" must be home!", 
           "And the house becomes a home. Welcome back "~person, 
           person+ " is now here.  Hash tag Welcome Home.", 
           person+ " is now here.  Hash tag Home.", 
           person+ " is now here.  Hash tag Smart Home.", 
           "Just a quick announcement. "~person+" has arrived!", 
           "Pardon the interruption but "~person+" is home!", 
           "My systems are picking up the presence of additional humans. "~person+" has been identified as home.", 
           "Welcome home "~person~"! It is nice to see you again!", 
           "It looks like "~person~"is finally home!" 
          ] | random }} 
        {%- endmacro -%} 
        {{greeting_sentence(person)}}

It’s way more readable.

And by making it more readable I found some typo’s and fixed them.

But I also fixed the syntax and service call/data.

That worked!!! Thanks. but it still ended up making it unreadable…lol

1 Like