Alexa Media Player

Since my original post Iā€™ve been working on getting this up and running. Mostly dissecting the bash script posted by @AlmostSerious.

I know that many have had issues getting the bash/shell script to work (myself included) so I went with the route of creating a node.js application using nightmare to ensure that logging in is seamless and doesnā€™t get you stuck against endless captchas.

I plan to make a dedicated post showing what I have, how to set it up (as an hassio plugin with auto discovery :slight_smile:) so keep on the lookout.

Essentially my component code creates a media player device in HA for each device associated with your Alexa account (including whole home audio). Play/Pause/Next/Previous/Volume all work

Obligatory Screenshot:

5 Likes

Awesome canā€™t wait to try this out, great work on what you have so far.

You gotta give us some code that we can test as a custom componet ā€¦ this is too cool Great Work :+1:

@Vasiley and @jimpower going to upload the code tonight. If anyone would like to help with development Iā€™d be happy to start a shared git repo.

1 Like

yeah boiiii.

:slight_smile:

2 Likes

Great job!!!. Iā€™ve been waiting for something like this forever. I installed it last night and itā€™s working great!

Iā€™ll be happy to keep testing. Much appreciated.

Hi Keaton. For some reason I cannot get the Alexa_media to show up in services
I have all the media_player.play.shuffle.volume.turn etc all showing unde Services. However I cannot see the Alexa_media in services. I want to be able to TTS to my Echo and Echo Dot
Have the following files in custom_components/alexa
init.py
pycache (Folder)
const.py
manifest.json
media_player.py
notify.py
services.yaml

  • platform: alexa
    email: ā€œemail addressā€
    password: ā€œpasswordā€
    url: ā€œhttps://alexa.amazon.comā€

Please help mate as keen to send TTS to Alexa echo from notifications
cheers heaps
Bruce

Also see the following in the log

  1. Unable to set up dependencies of alexa.media_player. Setup failed for dependencies: alexa_media
  2. Unable to set up dependencies of alexa.media_player. Setup failed for dependencies: alexa_media
  3. Setup failed for alexa_media: Component not found.
  4. Unable to find component alexa_media

From what I can tell itā€™s not currently possible, but wanted to ask anyway in case thereā€™s a chance someoneā€™s found a workaround :slight_smile:

Is there a way to get an Alexa speaker group to play a custom alert sound, read an announce message, and then go back to whatever it was doing previously (like streaming music from Amazon or Spotify)

Use case: I have a script that polls for severe weather alerts, and if specific alerts are active it will fire an announce TTS to my ā€œEverywhereā€ speaker group. But the beep before the announcement isnā€™t very loud/noticeable, so for an alert like that Iā€™d like to play a different tone first.

find a tone/mediaplayer file that you like on amazon music (there are sounds available)
then create a routine that first plays the sound and then says the text, or
make an automation that plays the amazon sound and then speaks the TTS.

That wouldnā€™t be able to resume other music if it were already playing, would it? We often have a station streaming from Amazon music, or music playing from Spotify

tts doesnt stop the music, but a tone/music file does.

the only way to restart the music that was playing, is by gettin the info what is playing before you send the tone (i think thats possible with the alexa mediaplayer component) and start it again afterwards.
but if you have a playlist playing, that will restart if you do that.

the automation would be like

  • retrieve what is playing with mediaplayer component and store that info somewhere
  • start the tone that you want
  • pause for as long is needed
  • send the TTS
  • pause for as long as needed
  • get the retrieved value and start the music again.

but i personally find it easier to set volume to max short before the TTS and then start the alert text with something like ā€œAlert, alert, alert, please pay attention ā€¦ā€
the music wont be stopped that way and will just play on.
dont forget to set the volume back afterwards :wink:

is there any way to make alexa open a skill? I have an surveillance camera that can be viewed by Alexa using a skill so Iā€™d like to make Alexa Media Player open a skill when there is a motion triggered.

@keatontaylor btw thanks for this great skill and the work you put in!

is there a way to make a notification work while currently having a video call on Echo Show? Right now nothing happens, but I only tried it with TTS.

all you can do is what you can do with the app.
you cant start a skill by a routine, so you cant start a skill with anything but voice.

when a video call is active, probably a notification is blocked.
try if it is possible by using the alexa app to start a notification when a video call is active.
if nothing happens its not possible

1 Like

Hey Keaton, have you heard about Whisper mode? Any chance this is something that can be added to the notify.alexa_media functionality?

AND as usual, You dah best, love your software, keep up the great work!!!

Whisper is already implemented, but you have to use announce and SSML

E.G.

Copy to clipboard

  action:
    - service: notify.alexa_media_[YOUR ECHO DEVICE NAME]
      data:
        data:
          type: announce
          method: speak
        message: '[
            "<amazon:effect name="whispered">Your TTS here</amazon:effect>",
        ]'
1 Like

Hi. Is this the Alexa Media Player in the HACS? If so - it doesnā€™t seem to be working. I get the following message from HACS when I try to install:


# 500 Internal Server Error

Server got itself in trouble

All other HACS components seem to be working well.

Any solution for playing to the everywhere group of echos?
I can play to one and to the last one used but not to all echos at once using the everywhere group.
no error, just doesnt do anything