Echo Devices (Alexa) as Media Player - Testers Needed

hi, I have tested alexa.py on my account .com and works good, I’m also have an echo dot in italian , I’m a betatester for this language I have set “amazon.it” and my echo is imported in home assistant, but when I try to use it sending tts don’t read and say in italian " I don’t understand this message" can you fix it also for italian users? thanks

Thank you. Now after trying the version 0.9.2 it works. I get all my devices from my alexa app, but maybe i didnt see it in the topic but is it possible that i dont import the sonos from my alexa account?

Update: After no changes to the Alexa config but multiple restarts as I was doing something else all my devices just appeared again. Weird…

Works perfectly for me now. Nice job. Thanks.

Ken

As mentioned by others, it works and works well. It also picked up my other Amazon stuff (fireTV’s), records them as an entity but shows no attributes other than “supported_features: 23357”, (the same as the echo’s).
Any idea what can be done with these?

Nothing and honestly I should exclude them from showing up as meida_player entities. Those devices do not support media controls in the way the API I found and use supports.

1 Like

Can we run multiples of this component? I’m thinking of putting my kids echos on their own accounts so that they can’t torture each other by controlling each other’s lights- but I would love to play music to them through this component.

Thanks for your work on this.

I’ve managed to add my alexa devices to home assistant but unfortunately I can’t interact with them. I can see updates, just not actually update the device (e.g clicking pause doesn’t pause)

I entered the captcha and then afterwards was presented with a blank modal, not sure if this could have caused anything.

Anyone managed to resolve this?

Help!

Total noob here. Keaton, great job this looks awesome.
I tried to follow your directions but got nowhere. Probably something simple that I missed.

I created a folder in my config folder named custom_components, then created a folder in that called media_player, then put the downloaded file alex.py in there.
I then added the following to my configuration.yaml:
media_player:

When I go to check config in hass.io it just spins and never completes checking.

What am I doing wrong? Thanks for your help!!!

after restart, there is another folder in there, besides the alexa.py file.
, the __pycache__ folder, isn’t it ?, and it has a file inside ?
… the alexa_media.pickle file appeared ? in your main config directory ?

Enable, debug level logging on alexa component, I believe using this, in your configuration.yaml:

logger:
  default: error
  logs:
    custom_components.media_player.alexa: debug 
    homeassistant.components.alexa: debug

… restart and report here with some messages in the logs.

Since update to newest HA release and alexa.py I am getting the following error:

2018-08-27 15:15:19 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform alexa
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/media_player/alexa.py", line 115, in setup_platform
    login = AlexaLogin(url, email, password, hass)
  File "/config/custom_components/media_player/alexa.py", line 584, in __init__
    self.login(cookies=cookies)
  File "/config/custom_components/media_player/alexa.py", line 688, in login
    self._data = self.get_inputs(soup)
  File "/config/custom_components/media_player/alexa.py", line 596, in get_inputs
    for field in form.find_all('input'):
AttributeError: 'NoneType' object has no attribute 'find_all'

I’m currently putting Google Home and Alexa to battle to determine which device to buy multiples of and scatter about the house. This Media Player you’ve created has gone a LONG way toward making Alexa the better choice.

As it stands now, Alexa is winning for several reasons.

  1. I can send a TTS notification to a SINGLE device (with Google it’s ALL devices or none at all unless you’re willing to stop whatever is playing on that device at the moment and not have it start back up again). This is a big deal as I don’t want to interrupt a sleeping child in one room with a notification that child doesn’t need to hear anyway. There is a work around for this with Google Home, but it’s really tedious.

  2. I can “drop in” on other Alexa devices in order to use Alexas as an Intercom system. Again, with Google Home, it’s everything or nothing, and even then, using it as an Intercom is cumbersome.

  3. Alexa has more skills available and connects to more things.

There are a few areas where Google Home wins (aside from things that it just does better that don’t relate to Home Automation at all). I’m hoping there’s a way to do these things with Alexa too, and I just haven’t figured it out.

  1. The Google Home integration I’m using it all using supported, documented APIs. This means they will likely not break in the future. I’m not sure if what you’re doing here is based on undocumented features and reverse engineering, or an official API. Can you shed some light?

  2. I can ask Google or Alexa, with my own voice, to do things, answer questions, etc. As an example (though I truly mean anything at all), I can ask them both “What time it is?” and they’ll tell me. With my Google Home integration, I’m able to make a request from home assistant to ask that question and then broadcast the response (to all speakers… not a single device… since that’s a google limitation at the moment). It’s pretty useless for something like the time, but, for instance, I have a device that has no published API. However, it has Google/Alexa integration. I can use my google Integration to say “Turn my Living Room Party Light Green” via a Home Assistant automation, and it’ll send the command to Google and beyond as though I actually spoke those words myself. Is there a way to do this with Alexa? I’ve looked over your code and there’s nothing in there that supports it, but I’m hopeful that there’s a way and you just haven’t implemented it and that it could possibly be exposed in a new HASS service call. If you have any direction on how to do this, I’d be happy to investigate and submit a PR to your code with the functionality.

1 Like

I’ve read and re-read this thread several times. It allowed me to install and get working the alexa media player service. I really like it. It adds a lot to HA. Thanks to @keatontaylor and everyone else who worked on this.

The best part of this thread is reading @SMARTMEDIA 's responses to people who have not read the rest of the thread. Keep up the good work!

That being said, I’d like to have announcements made on groups or all echo devices on the account. The only thing I’ve come up with is an automation that sequentially sends the phrase to every device on my account. Is there a better way? It gets kind of noisy with them all talking out of sync.

1 Like

just as a point of information in case it’s necessary in the future…

What do I need to do if I change my Amazon account password to get everything to refresh and use the new password?

Obviously I will need to change the entry in the config to the new password but is there anything else or will it just pick up the new password and continue to log in as usual?

Assuming cookies are instantly disabled by Amazon when you change passwords, you will get the configurator the next time you restart. We do not have the logic to detect the password has changed and restart the login process (although we can probably add an issue for that).

I’ve been able to specify built-in Alexa groups and they’re fairly in sync when they speak. I wouldn’t rely on using HA entities as I don’t think we can guarantee all will get it at the same time.

That looks like a plex bug, not alexa.

  1. This is a hack, so Amazon can shut it down at any moment by changing the API. We haven’t looked at doing a skills API yet but I don’t think it will give you the native forwarding without triggering the skill.
  2. You may be confusing the Alexa component that is based off the skills API with this media_player. However, since this media_player is using the Amazon App API, in theory if the App can do it, we may be able to reverse engineer it. I don’t think we’ve looked to see if we can send direct commands to Alexa yet.

We’ll need to see the debugging output and potentially the HTML page causing the issue. The error is indicating it’s running into an unexpected page.

Blank modal is because of the way the configurator doesn’t allow updates so we’re hacking a series of modals. We haven’t run into the issue where if it’s playing you can’t pause it. Can you use the media_player.tts service? Can you change the volume?

Not yet; you may want to submit a feature request.

1 Like

No… I definitely mean the media_player component. A lot of the work is based off of a shell script called alexa-remote-control.

At any rate, I’ve done more digging. It seems the best way to support this is with “routine” triggering, which is something that shell script handles. So I’m assuming it can be replicated. The shell script, however, doesn’t work for me, while this media_player does. So I’m unable to fully test in order to add the code myself.

I already have
homeassistant.components.media_player.alexa: debug
so how do I best debug the actual wrong html page?

Works good with Node Red. Anyone have it working with Kindle devices? I use wall mounted Kindles for music. My Kindles are listed as “Unavailable”.

Finally got this working yesterday :smile:

However, I’ve been setting up something very similar to this:

Now I have my echo’s showing as media players I’m trying to get it to play an icecast stream but looking at the issues section the “media_player.play_media” service doesn’t work, best I can get is when I start playing music and the automation starts the script the echo says something about “Text to speech can only be called by the…”

Any ideas on when the play_media service may work, or can anyone think of another way around this?

Thanks!!

How do I do that?