Echo Devices (Alexa) as Media Player - Testers Needed

Yes please @Corey_Maxim - thanks!

Just to let you know I’ve just updated to 1.2.5 and also updated my HA to 0.92.2, and I’m now no longer getting the services.yaml error on startup, everything looks to be working as intended. :slight_smile:

1 Like

@keatontaylor just a hint, could you update the installation instruction on top, the links to the github repo are not valid anymore. :wink:

It’s not possible to update the first post. That’s an issue with the forum settings. It may make sense to just start a new thread and let this one die.

Either that or get a forum admin to edit for you.

automation.yaml

 - id: family_greeting
      alias: Family Greeting
      trigger:
        platform: state
        entity_id:
          - binary_sensor.cameron_home
          - binary_sensor.corey_home
          - binary_sensor.courtney_home
          - binary_sensor.mom_home
          - binary_sensor.morgan_home
          - binary_sensor.wendy_home
          - binary_sensor.jasmine_home
          - binary_sensor.brandon_home

        from: 'off'
        to: 'on'
        for: '00:01:45'
      condition:
        condition: time
        after: '10:00:00'
        before: '02:00:01'
      action:
        - delay: "00:00:10"
        - wait_template: "{{ is_state('script.say_greeting', 'off') }}"
        - wait_template: "{{ is_state('binary_sensor.diningroom_door', 'on') }}"
        - delay: "00:00:10"
        - service: script.say_greeting
          data_template:
            entity_id: "media_player.livingroom"
            person: >
              {{ trigger.to_state.name }}
              {%- for s in states.binary_sensor
                    |rejectattr('entity_id','eq',trigger.entity_id)
                    |selectattr('state','eq','on')
                    if '_home' in s.entity_id and
                       (now() - s.last_changed).total_seconds() < 2 -%}
                {{ (' and ' if loop.last else ', ') ~ s.name }}
              {%- endfor %}
            message: >
              {{ ["Hey there PERSON Welcome Home, Did you hear about the restaurant on the moon? Great food, no atmosphere.",
                  "Sometimes you feel like a nut, Sometimes you don't, Sometimes you feel like PERSON, l o l  Welcome Back",
                  "Hello PERSON, How many apples grow on a tree, All of them",
                  "Welcome home PERSON, Want to hear a joke about paper, , , , ,  Nevermind it's tearable",
                  "Welcome home PERSON, I just watched a program about beavers, It was the best, dam program I have ever seen",
                  "Welcome home PERSON,  Why did the coffee file a police report, It got mugged",
                  "Welcome home PERSON, How does a penguin build its house, Igloos it together",
                  "Welcome home PERSON, I once, asked my Dad, did you get a haircut, No, he replied, I got them all cut",
                  "Welcome home PERSON, What do you call a Mexican who has lost his car? Carlos",
                  "Welcome home PERSON, Why did the scarecrow win an award? Because he was outstanding in his field",
                  "Welcome home PERSON, Why don't skeletons ever go trick or treating, Because they have no body to go with",
                  "Welcome home PERSON, What do you call an elephant that does not matter? An irrelephant ",
                  "Welcome home PERSON, Want to hear a joke about construction, I am still working on it",
                  "Welcome home PERSON, What do you call cheese that is not yours, Nacho Cheese",
                  "Welcome home PERSON, do you know Why the bicycle could not stand up by itself, It was two tired",
                  "Welcome home PERSON, What did the grape do when he got stepped on, He let out a little wine",
                  "Welcome home PERSON, I would not buy anything with velcro. It is a total rip-off",
                  "Welcome home PERSON, The shovel was a ground-breaking invention",
                  "Welcome home PERSON, This graveyard looks overcrowded, People must be dying to get in there",
                  "Welcome home PERSON, Two goldfish are in a tank, One says to the other, do you know how to drive this thing?",
                  "Welcome home PERSON, What do you call, a man with a rubber toe, Roberto",
                  "Welcome home PERSON, What do you call a fat psychic, A four-chin teller",
                  "Welcome home PERSON, I would avoid the sushi if I was you, It is a little fishy",
                  "Welcome home PERSON, To the man in the wheelchair, that stole my camouflage jacket,... You can hide but you can not run",
                  "Welcome home PERSON, The rotation of earth, really makes my day ",
                  "Welcome home PERSON, I thought about, going on an, all-almond diet, But that is just nuts",
                  "Welcome home PERSON, What is brown and sticky, A stick, he he",
                  "Welcome home PERSON, I have never gone, to a gun range before, I decided to give it a shot!",
                  "Welcome home PERSON, Why do you never, see elephants hiding in trees, Because, they are so good at it",
                  "Welcome home PERSON, Did you hear about the kidnapping at school, It is fine, he woke up",
                  "Welcome home PERSON, A furniture store keeps calling me, All I wanted was, one, night, stand",
                  "Welcome home PERSON, I used to work, in a shoe recycling shop, It was sole destroying",
                  "Welcome home PERSON, Did I tell you the time, I fell in love during a backflip, I was heels, over head",
                  "Welcome home PERSON, I do not play soccer because, I enjoy the sport, I just do it for kicks",
                  "Welcome home PERSON, People do not like having to bend over to get their drinks, We really need to raise the bar",
                  "Welcome home PERSON, You are so ugly, you scared the crap out of the toilet",
                  "Welcome home PERSON, Your family tree, must be a cactus because, everybody on it is a prick",
                  "Welcome home PERSON, No, I am not insulting you, I am describing you",
                  "Welcome home PERSON, If I had, a face like yours, I would sue, my parents",
                  "Welcome home PERSON, Your birth certificate, is an apology letter from, the condom factory",
                  "Welcome home PERSON, The only way, you will ever get laid, is if you, crawl up a chickens arse, and wait",
                  "Welcome home PERSON, You are so fake, Barbie is jealous",
                  "Welcome home PERSON, I am jealous of people, that do not know you!",
                  "Welcome home PERSON, You are so ugly, when your mom dropped you off at school, she got a fine, for littering",
                  "Welcome home PERSON, If I wanted to, kill myself, I would climb your ego, and jump to your I Q",
                  "Welcome home PERSON, You must have been born on a highway, because that is where most accidents happen",
                  "Welcome home PERSON, Brains are not everything, In your case, they are nothing",
                  "Welcome home PERSON, Roses are red violets are blue, God made me pretty, what happened to you",
                  "Welcome home PERSON, Behind every fat woman, there is a beautiful woman, No seriously, your in the way",
                  "Welcome home PERSON, Calling you an idiot, would be an insult, to all the stupid people",
                  "Welcome home PERSON, Please shut your mouth, when you are talking to me",
                  "Welcome home PERSON, I would slap you, but that would be, animal abuse",
                  "Welcome home PERSON, They say opposites attract, I hope you meet someone who is, good-looking, intelligent, and cultured",
                  "Welcome home PERSON, The last time, I saw something like you, I flushed it",
                  "Welcome home PERSON, If ugly, were a crime, you would get, a life sentence",
                  "Welcome home PERSON, Shock me, say something, intelligent",
                  "Welcome home PERSON, If your gonna be two faced, honey at least, make one of them pretty",
                  "Welcome home PERSON, I do not know, what your problem is, but I would bet, it is hard to pronounce",
                  "Welcome home PERSON, so you claim, You get ten times more girls than me, well lets do the math, ten times, zero is, still zero",
                  "Welcome home PERSON, You are the reason, the gene pool needs, a lifeguard",
                  "Welcome home PERSON, Of course, I talk like an idiot, how else would you, understand me?",
                  "Welcome home PERSON, All day I thought of you.., I was at the zoo ",
                  "Welcome home PERSON, I would like to see things, from your point of view, but I can not seem to get, my head that far up, my own arse",
                  "Welcome home PERSON, Stupidity, is not a crime, so you are free to go",
                  "Welcome home PERSON, You so dumb, you think Cheerios, are doughnut seeds",
                  "Welcome home PERSON, Is your body, from McDonalds?, , , , , , , , Cause, I am loving it ",
                  "Welcome home PERSON, You are so dumb, that you got hit, by a parked car",
                  "Welcome home PERSON, Are you always, this stupid or, is today a special occasion?",
                  "Damn, how, you, doin PERSON, question, Are you Israeli?, , , ,  Cause you Israeli hot",
                  "PERSON is finally here, hey PERSON , Are you from, dunkin donuts, , , ,   because I like you, a latte",
                  "Are you my appendix PERSON, Because I do not understand, how you work, but this feeling in my stomach, makes me want to take you out, Oh welcome home PERSON",
                  "Do you like sales, PERSON, Because, if you are looking for a good one, clothing is, 100% off at my place.",
                  "hey PERSON, Are you from, Japan,  cause im trying, to get in, Japanties ",
                  "Are you craving Pizza, PERSON,  Because I would love, to get a, pizza you, welcome home",
                  "Is your dad, a terrorist, PERSON, Because you are, the bomb",
                  "PERSON, Are you, Australian? ,,,,Because you meet all of my, koala,fications",
                  "PERSON, If I had a garden, I would put your tulips, and my, tulips together",
                  " welcome home PERSON, Did you hear, of the new disease, called beautiful, I think you are,  infected",
                  " PERSON, If you were a vegetable, you would be a, cute-cumber, welcome home",
                  " Hello PERSON, You should change your name to, Coca Cola, because, you are so-da-licious",
                  " hey finally PERSON is here, I wanted to ask you, if I cook you dinner, would you cook me breakfast, PERSON, I have to say your so HOT",
                  "Hey PERSON,  my name is, Microsoft"  "Can I crash, at your place, tonight"
                 ] | random }} 

script.yaml

say_greeting:
  sequence:
  - service: media_player.volume_set
    data:
      entity_id: media_player.livingroom
      volume_level: 1
  - service: notify.alexa_media
    data_template:
      data:
        type: tts
      target: "{{ entity_id }}"
      message: "{{ message.replace('PERSON',person) }}"
4 Likes

Hey, cool work. Thanks for sharing. Corey_Maxim

2 Likes

Dear,
sorry to ask question, but the thread is too big to go through
i would like guidance for playing music on alexa echo dot from
i would like to play music which is stored

  1. on my raspberry pi on which hass.io on docker is installed
  2. from my samba server which is on another pi.
    please guide
    thanks

Hi All,

Sorry if I’ve already missed a reply to this particular issue, this is a very long thread :slight_smile:

I’ve just enabled the Alexa addon, and I can see my Echo devices in Home Assistant just fine - however, when playing TuneIn radio - the Echo just shows as standby.

I am using the amazon.co.uk domain - and I have checked the API from https://alexa.amazon.co.uk/api/devices-v2/device - and I can confirm that the API shows “online”:true" - yet Home Assistant is convinced the device is in Standby.

Home Assistant version is 0.91.3 and Alexa Media player addon is the latest as of 1st May 2019.

Any Help would be appreciated.

Thanks

Check the alexa app, is tunein playing there ?
If yes, look in your entity register. Maybe there is an “_2” duplicate of your player.

Hi Dielee - I can confirm that the Alexa App is showing the station playing, and I don’t have any second entries.

Thanks

make sure you write in home assistant whatever station you’re tuning exactly the way it’s written in the alexa app

Where abouts would I code this? Does the media_player entity not just pull it back?

Ok, interesting one here - if I press play on the TuneIn Radio station from Inside the Alexa app - then Home Assistant updates with what is playing.

If I just ask Alexa to start playing it, then it won’t display what it is doing.

Did you read this?

1 Like

I’ve tried installing this - the UI shows what’s playing in lovelace and I can control the volume, skip tracks pause/play from lovelace fine - but I can’t get announcing or playing media to work either via node-red or via call services.

The only issue I had when installing pyalexa into my home assistant docker container was:
ERROR: mycroftapi 2.0 has requirement websocket-client==0.44.0, but you’ll have websocket-client 0.56.0 which is incompatible.
I don’t know if that could be causing these issues, and if so, how do I resolve it?

I’ve turned on debug mode, and get a bunch of lines about testing items, which I haven’t included here, and then finish on this:

2019-05-09 20:27:33 DEBUG (SyncWorker_3) [alexapy.alexaapi] Running sequence: AlexaAnnouncement data: {“behaviorId”: “PREVIEW”, “sequenceJson”: “{”@type": “com.amazon.alexa.behaviors.model.Sequence”, “startNode”: {"@type": “com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode”, “type”: “AlexaAnnouncement”, “operationPayload”: {“deviceType”: “DEVICETYPEID”, “deviceSerialNumber”: “SERIALNUMBER”, “locale”: “en-gb”, “customerId”: “CUSTOMERID”, “expireAfter”: “PT5S”, “content”: [{“locale”: “en-gb”, “display”: {“title”: “Home Assistant”, “body”: “test”}, “speak”: {“type”: “text”, “value”: “test”}}], “target”: {“customerId”: “CUSTOMERID”, “devices”: [{“deviceSerialNumber”: “SERIALNUMBER”, “deviceTypeId”: “DEVICETYPEID”}]}}}}", “status”: “ENABLED”}
2019-05-09 20:27:33 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140683093321264] Sending {‘id’: 10, ‘type’: ‘result’, ‘success’: True, ‘result’: None}

But nothing plays. Any ideas?

I should add I’m on the latest docker version of HASS, and have just downloaded the master of alexa_media_player, so should be up to date

I’m getting these errors :

ERROR (MainThread) [homeassistant.loader] Unable to find component media_player.alexa_media
ERROThis text will be hiddenR (MainThread) [homeassistant.setup] Unable to prepare setup for platform media_player.alexa_media: Platform not found.ERROR (MainThread) [homeassistant.loader] Unable to find component notify.alexa_media
ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform notify.alexa_media: Platform not found.
ERROR (MainThread) [homeassistant.components.notify] Unknown notification service specified

Any ideas ?

Just tried this today but after working out the captcha stuff, media players appear but the default media_player.myname_alexa_apps is unavailable. Going here https://alexa.amazon.com/api/devices-v2/device? shows my last device (MyName Alexa Apps) as online: false.

Added debug to config but it is creating an unreadable .pickle file?

N.B My account was originally with the US but now all three dots are set to AU.

Restarted Hassio several times running under 0.92.2. Any clues where to look?

Not possible. Amazon doesn’t allow local playback unless you have a specific skill that enables the local playback (it will have to emulate internet streaming like Spotify).

That is odd. If it updates at all from using the app, it should also update when you speak vocally. We use the same mechanism to update from both sets of info. Can you turn on debugging per the wiki for “alexapy”. You will either see websocket messages indicating a change of state or you’ll see something about “refreshing devices” which is fallback polling feature. It’d be helpful to compare the logs depending on if you’re speaking to the device or using the app.

Can you do the announce using Alexa routines in the app? If it sends the sequence info you posted, it should work. My next debuggin step would be to create the same announcement via the routine, and then reviewing how it stores that command in the routines page (fix the url for your region). You should see the same exact values as in the debug data. If something is different, please open up an issue and I can try to help you.

Check you files in the custom_component directory. Please make sure you downloaded them in raw mode.

Make sure you set your Alexa domain in your configuration.yaml to the au domain. I believe it’s amazon.com.au? If you check the devices page with the au domain you should see them as online there.

Thanks. I did try that but I got no media players set up at all with amazon.com.au but I’ll have another crack. All media players are online under the current US domain except the main domain one, media_player.myname_alexa_apps. When I go to the API page under the AU domain, it redirects to the .com domain anyway.