Echo Devices (Alexa) as Media Player - Testers Needed

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.

We really use the devices page to determine if we can update a device. If you can’t find that device on one of the domains as online, we won’t either. Others have suggested unregistering and re-registering a device between regions. I haven’t tried that though.

Is it possible to specify shuffle when calling on a playlist by any chance please?

I have a playlist called via Apple Music, but it just keeps playing the first song each time:

{
“entity_id”: “media_player.study”,
“media_content_id”: “wakeup”,
“media_content_type”: “APPLE_MUSIC”
}

Thanks.

EDIT - I found an alternative way to shuffle songs using the following:

      - service: media_player.play_media
        data_template:
          entity_id:
            - media_player.study
          media_content_type: 'APPLE_MUSIC'
          media_content_id: >
            {{ ["Song 1", 
                "Song 2", 
                "Song 3", 
                "Song 4"] | random }}
1 Like

Is it possible to play your own music with media_content_type: music? I tried this but nothing happens. Thank you!

Got this is working for Plex. This will play your own music.

{
“entity_id”: “media_player.device_name”,
“media_content_id”: “{“library_name”: “ALBUM_NAME_HERE”,“track_name”: “TRACK_NAME_HERE”, “shuffle”: “0”}”,
“media_content_type”: “AMAZON_MUSIC”
}

content_type is “AMAZON_MUSIC”

1 Like

I’m confused. This looks like it plays music from amazon music. Can you provide more details on how this works with plex?

“media_content_id”: “{“library_name”: “ALBUM_NAME_HERE”,“track_name”: “TRACK_NAME_HERE”, “shuffle”: “0”}”,= plays music from your Plex
“media_content_type”: “AMAZON_MUSIC” was by accident…
I’m not sure as to why it works, this was by accident. I was trying some services with HA Plex Music and didn’t change the content_type, from AMAZON_MUSIC to MUSIC, then clicked on call service. MY Amazon ehco started playing the song from Plex in that room. Ive tried other songs and plays them as called. I was throwing this out for others to test and maybe come up with other ideas.

Working
{ \“library_name\” : \“My Music\”,
\“track_name\” : \“hello\”, \“shuffle\”: \“0\” }

Not working
\“artist_name\” : \“Adele\”, \“album_name\” : \“25\”,

Home Assistant PLEX

Thank you very much for sharing this!!!
It works
I’ve been searching for a while for ways to do this other than voice commands.

1 Like

Would it be possible to get the ‘’last received command ‘’ in real time as a string like what openhab does? (One string entity per echo device) .

Take a look at the channel : lastVoiceCommand

Thank you so much.

That way I would be able to completly remove openhab from my setup.