Echo Devices (Alexa) as Media Player - Testers Needed

The Add-on works perfectly for me too. The love for Alexa is back again, this opens a world of new possibilities. I have been re-writing my scripts and automations for the past few days and Alexa updates me and my households on everything now. It’s amazing, I love it. Thank you so much @keatontaylor , this was the missing link in my home automation.

If you’re ever in Amsterdam, let me buy you a beer :smiley: :beers:

1 Like

My account works in both AU and US, so if I log into the US, it doesn’t see my echo as online.

Thanks! This fixed it

Hi,

Thanks for all the hard works. So far, it’s been working well!

I was wondering…can we can send custom commands similar to AlexaNotificationCurl?

For example the above would execute like this: ./alexa.sh “Ask ADT to arm the system”

If not, how can we pull the token data? I could then transplant the auth token to AlexaNotificationCurl

1 Like

Awesome, that worked! Still very annoying that I have to signout from multiple websites when I restart hass :confused:

1 Like

Awesome! I’m happy it worked for you. :slight_smile:

Although…, I actually reverted back to v0.5 with the add-on yesterday, it just works flawlessly for me, no captcha and allows me to use multiple accounts. (with some minor hackery)

Honestly, I’d recommend most people use the v0.5 component with the add-on.

That is, unless you are willing to test and don’t mind the possibility of issues, at least until the standalone component is more mature.


FWIW,

I don’t mind testing, the persistent captcha on restarts, or other issues right now with the standalone component right now, but not being able to use multiple accounts make the standalone component useless to me. :frowning:

Hi,

Thanks for getting this working, this is a very nice addition to my HASS setup.

Question - Is there a way to output to multiple echos at the same time? Group them into a single media player with a new name like “media_player.kids_echos”?

I believe you can, except with TTS…

for TTS I believe you need to list the entities…

{
“entity_id”: “media_player.kitchen, media_player.living_room, media_player.bedroom, media_player.outside”,
“message”: “home assistant set up test”
}

Ok, thanks - I didn’t realize you could have multiple entity_ids.

More complicated question -

I am using Alexa to trigger a HASS script - which will respond to the user via TTS in the echo.

Is there a good way to figure out which echo the request came from, so the TTS output can be directed only at that echo?

Also - I can get a single echo to play a siren sound (found on Amazon Music), but I can only stream to one device at a time. Is there a way to play it on all my echoes at the same time? One echo plays it, the other complains it can only stream from amazon music to one device at a time.

  • service: media_player.play_media
    data:
    entity_id: media_player.kitchen_echo, media_player.jasons_spot
    media_content_id: air raid siren
    media_content_type: AMAZON_MUSIC

Thanks for this solution. Sadly it does not work for me.
I still get the same error.

2018-07-31 00:14:39 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was 
never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
  result = self.fn(*self.args, **self.kwargs)
File "/root/.homeassistant/custom_components/media_player/alexa.py", line 120, in <lambda>
  track_utc_time_change(hass, lambda now: update_devices(), second=30)
File "/usr/local/lib/python3.5/dist-packages/homeassistant/util/__init__.py", line 318, in wrapper
result = method(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/homeassistant/util/__init__.py", line 318, in wrapper
result = method(*args, **kwargs)
File "/root/.homeassistant/custom_components/media_player/alexa.py", line 129, in update_devices
devices = devices.json()['devices']
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 896, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 8 column 1 (char 7)

I have logged in with the capcha but no alexa medai players show and I get this in the logs…

1 Like

I am getting exactly the same error…

note that even if i intentionally fail the captcha logins, login.status is showing a login successful.

i.e., login.status = {‘login_successful’: True}
i am still learning the code. but that seems weird.

@VladTepz posted the “remedy” in post #397

… to anyone getting the error ending with this:

JSONDecodeError: Expecting value: line 8 column 1 (char 7)

… you’re welcome :slight_smile:

1 Like

it says that we need to log out of amazon and that would fix it

That hasnt worked for me Smartmedia…

I went on and:

  1. logged out of my account,

  2. logged back in,

  3. while logged in, I pressed the Switch Accounts link :

  4. I was presented with this:
    image

  5. I signed out there / at this step also

  6. I signed in, again … :slight_smile:

  7. restarted Home Assistant … and it all worked from there on … for me at least.

tried following those instructions precisely.

Still got “simplejson.errors.JSONDecodeError: Expecting value: line 8 column 1 (char 7)”

Update1:
Getting closer with my debugging
the code: devices = AlexaAPI.get_devices(url, login_obj._session)
returns: <Response [200]>

and if i cycle through the devices array, i see a bunch of html - not JSON. so need to track down the website its going to and what its pulling in.

Update2:
when, on my laptop, i go to “https://alexa.amazon.com/api/devices-v2/device” on my computer, i get the JSON that the python script is looking for. But when i look at the code is pulls in from the script (from my server), i clearly see that it has NOT succeeded in logging in. However, the script is incorrectly still interpreting that page as a “successful login”.

i.e. the following code isnt working the way it is intended. just finding the word ‘devices’ in what you pull from the post response is insufficient as even the web page has that word in it,.

if ‘devices’ in post_resp.text:
status[‘login_successful’] = True
else:
status[‘login_failed’] = True

Update3:

I can confirm that even if it can access the json file (i set up my own locally hosted version), it still crashes out with the same error. i can also confirm it is this line: devices = devices.json()[‘devices’]
but it is beyond me to diagnose further.

2 Likes

Same for me.

Any idea/suggestion how to temporary increase the volume (e.g. during a tts message) and restore the previous (before message) volume?

Any help/suggestion is appreciated.

I remember now, that, the first time this happened to me, the component and alexa.py were at version 6.1.
I did the login / logout / switch account / sign in sequence, but also deleted the alexa.cpython-36.pyc file from /custom_components/media_player/__pycache__ folder.

Please, just do it once more:

  1. Do the sequence
  2. Delete that file
  3. Restart HA

… please, I’m curious why it worked for me !
It worked from ver. 6.1 so when I upgraded to 7.1, I needed not to delete the file. but you must, if you did not.
I did not mention this (the deletition part) because I thought you did that part earlier … sorry.