Echo Devices (Alexa) as Media Player - Testers Needed

Rene, thanks for that info; but i would love to be to do that too, but it does not work. In HA, i have this group:

I created a group in the alexa app, that didn’t work and one in HA, the status of it is “unknown”. Ant ideas

you need to remove EchoPlusGroup from your HA group

if you got a HA group with only living echo plus, Master Bed Echo Plus, Guest Bed Echo Plus, Office Echo Plus, Garage Echo Dot, you can send TTS to group.alexa_media_players instead of just to 1
off course only if you called the group that way and only through the TTS service.

as a sidenote:
to make your live easier (and communication between devices) you could try to simplefy the names as much as possible. spaces are always a trouble when programming

living, bedroom, guestroom, office and garage, show what you want to know about the device, but it makes it easier to drop in (allthough amazon does a good job also recognizing partly names) or to send stuff to the device.

(its a general advice about all devices/entities by the way :wink: )

Thank you very much for the help

I’m getting the following error, any tips?

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, 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 146, in setup_platform
    config.get(CONF_DEBUG))
  File "/config/custom_components/media_player/alexa.py", line 618, in __init__
    self.login_with_cookie()
  File "/config/custom_components/media_player/alexa.py", line 641, in login_with_cookie
    self.login(cookies=cookies)
  File "/config/custom_components/media_player/alexa.py", line 757, in login
    resp = self._session.get(site)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 519, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 462, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 313, in prepare
    self.prepare_url(url, params)
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 400, in prepare_url
    raise InvalidURL('URL has an invalid label.')
requests.exceptions.InvalidURL: URL has an invalid label.]

Using the following config:

media_player:
  - platform: alexa
    email: “[email protected]”
    password: “password”
    url: “https://alexa.amazon.de”

you are using the wrong quotes

use these "

1 Like

I cannot get if/else working in message. Any help is appreciated. I tested in dev info and it works as expected.

{
"entity_id":"media_player.living_room_echo_dot",
"message":"{% if 1 == 1 %}hello{% else %}bye{% endif %}"
}

It announces “if 1 1 hello else bye endif” — literally reading the if statement

reference issue 55 (closed)

That will probably not work in a dev tools service call. Try to use it in a script or automation.

Isn’t that the whole point in using service calls is to test before putting into script or automation. I means that’s what I do.

Doesn’t work in script either. Just read the if statement as if it’s just words.

That’s true. But I think the service dev tool, just passes ‘data’ and not ‘data_template’.
Take a look at the examples in the wiki. I copied them directly from my working configuration. I use them on a daily base. The templating is very sensitive to correct setup, a small typo can mess up everything.
If you post what you’re trying to achive in a script, maybe we could help.

examples are also hidden in this long thread

Sorry i know nothing about python and programming and the git pull/merge stuff…

But i hacked the component from keatontaylor to do what i missed. My version can play Joke/Flashbriefing and some other things via service call.
The sequences i know are:

  • Alexa.Weather.Play
  • Alexa.Traffic.Play
  • Alexa.FlashBriefing.Play
  • Alexa.GoodMorning.Play
  • Alexa.GoodNight.Play
  • Alexa.SingASong.Play
  • Alexa.TellStory.Play
  • Alexa.Joke.Play
  • Alexa.Calendar.PlayTomorrow
  • Alexa.Calendar.PlayToday
  • Alexa.Calendar.PlayNext

Sample with developer tools:
sequence

I thing the entity_id is a required paramter but i dont know ho to extend the schema. Also the description of the “sequence” paramter is missing and i dont know how to add it. Perhaps there are some talented programmers out there to make this a standard component.

Download: mediaplayer with sequence support (alpha stage!!!)
Keep in mind, i cant support on error. So use it at your own risk.

2 Likes

First, thanks for fast reply.
Cookie works after reboot.
If I delete the .pickle file HA creates a new one without captcha question, creepy…

Wich data do you need to find my problem ?

I can’t even get my simple 1 = 1 test notification as a script.

'1546701126812':
  alias: Test Alexa
  sequence:
  - data:
      entity_id: media_player.living_room_echo_dot
      message: '{% if 1 == 1 %}hello{% else %}bye{% endif %}'
    service: media_player.alexa_tts

Replace - data with - data_template
As I told you, a simple typo will mess up everything.

1 Like

Ding, ding, and the winner is @Remco_Timmer. Thanks

2 Likes

I’m hoping in the future we could invoke a Alexa Skill using HA. Specifically the Start my car Chevy app! That would be awesome!

If you submit a pull request we can help you merge it in. Just remove the extraneous comments you have that you used for notes and also increment the version by 0.0.1 and allow edits and we can help. We all start from the beginning when it comes to programming and you’ve already made the first step by getting the code working for your use.

  1. Turn on debugging.
  2. Confirm tts works for your devices on reboot.
  3. When things fail with Alexa in the future, try the tts you used in 2 above again and put the relevant part of the home-assistant log in a secret gist. It should include any errors you may have gotten from alexa and the alexa tts component. Remove any amazon emails/passwords
  4. Private message me with the gist url. I can take a look and guide further.

I have this issue:
Set mediaplayer volume
Maybe someone here can help out.

By the way: Is it possible to update this component with the custom_updater?

1 Like

Everything worked in the past, but right now I do not have the alexa_tts entity.
All my Echos are present an I can control them via HA. If I try to use the Text to Speech feature in the media card Alexa tells me that there has to be the Alexa Text to Speech service.
I already upgraded to the latest alexa.py and deleted the py-cache, but nothing changed!

Can anybody help me with this?

Well i made a pull request but i also took my README.md which should not be merged.

Sorry for this mistake.

Should playing to MRM groups work the same as a specific device?

If I do a service call in the dev console using “media_player.living_room” as the entity, it works fine (that’s a single echo). “media_player.whole_house” does not. I can control the Whole House MDM via Media Player Card if I play it using voice commands. I debugged the JSON being posted, and everything looks identical as far as what is POSTed to alexa.amazon.com. Any ideas or guidance on MRM groups?