Echo Devices (Alexa) as Media Player - Testers Needed

I’m going to assume you replied to me since you didn’t specify but since this is your first post in this thread and I’m the only one to reply to you I think my assumption is good. If not…then nevermind.

You do understand that this WHOLE FORUM and the HA documentation website is chock full of “do it like this” posts, right?

By the very nature of coding it just stands to reason that people are going to post WHAT WORKS in their configuration to help you figure out why yours DOESN’T WORK…

And pointing out that you need to properly format your code when posting on the forum isn’t something we do to make you “do it like this” for no good reason.

YAML is very picky when it comes to syntax and indentation. Many times we can’t help you if you don’t post your code in a readable way that reflects the actual code format in your config.

People not following the instructions in the blue box at the top of every single forum page literally happens multiple times every single day. So much so that I created that gif to help people understand how to do it without having to constantly write it all out all the time.

Oh yeah, did I mention there are instructions for proper code formatting in the blue box on the top of every forum thread? :wink:

The reason I asked why people are putting in a “hosts:” line in the configuration is because it’s the second time I’ve seen it in a short time (the other person said they couldn’t get theirs to work either if I remember correctly…) and mine works without it AND I only need one alexa media player config entry for all my echo’s AND mine works.

I literally was just wondering where people were getting the idea to do it like the way you are doing it came from. Especially if it isn’t working. I haven’t updated my version in a while so maybe it is a new thing and I just missed it somewhere. Hence my questions above… And you’ll notice I asked the same question above around post #1573, too, so it has nothing to personally do with you, at all.

I’m sorry if you took what I said as you being “told off” or that I was being “condescending”.

I hope you have a better rest of your day and don’t spend it looking for a way to take offense when none was offered (OK now I am being a wee bit condescending…:smirk:, if it helps just ignore that last bit…:wink:).

4 Likes

Just here looking forward to SSML getting in there too :wink:

All I can say is apologies where apologies are due

But once again many thanks for your reply and your help

Paul

1 Like

I didn’t, I still haven’t managed to do it.

Same(similar) Issue here after restart HA.

2018-12-30 09:28:30 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/urllib3/connection.py”, line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File “/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py”, line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File “/usr/local/lib/python3.6/socket.py”, line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 343, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 839, in _validate_conn
conn.connect()
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 301, in connect
conn = self._new_conn()
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 168, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 449, in send
timeout=timeout
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py”, line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘alexa.https’, port=443): Max retries exceeded with url: //alexa.amazon.de/api/devices-v2/device (Caused by NewConnectionError(’: Failed to establish a new connection: [Errno -2] Name does not resolve’,))
During handling of the above exception, another exception occurred:
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
File “/config/custom_components/media_player/alexa.py”, line 617, in init
self.login_with_cookie()
File “/config/custom_components/media_player/alexa.py”, line 640, in login_with_cookie
self.login(cookies=cookies)
File “/config/custom_components/media_player/alexa.py”, line 710, in login
if (cookies is not None and self.test_loggedin(cookies)):
File “/config/custom_components/media_player/alexa.py”, line 682, in test_loggedin
‘/api/devices-v2/device’)
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 533, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 646, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘alexa.https’, port=443): Max retries exceeded with url: //alexa.amazon.de/api/devices-v2/device (Caused by NewConnectionError(’: Failed to establish a new connection: [Errno -2] Name does not resolve’,))

Any Solution here? Thx.

Evening all hope everyone is well,

does anyone know if the tts works with the sonos one as when i set it all up i lose audio across both speakers not just one.

apologies if this has been asked already

Nath

I added this component when there was only 4 comments holy shit there is over 1500 now. @keatontaylor would you be keen on adding your component to the custom component tracker would make it easier to keep up with changes.

2 Likes

ok, its working again. i used url https://alexa.amazon.de instead of using only amazon.de

I took a look at Alexa shell tool wich is capable to start the flashbriefing and more via script. This feature is missing in this custom component.

Wouldn’t it be possible to “merge” these features to this alexa component?

I know not much about programming but the “weather,traffic,flashbriefing,goodmorning,singasong,tellstory,joke” from lötzimmer looks much like the tts part in this component.

Perhaps some python programmer can extend this component so that e.g a new service
Service

media_player.play_sequence

with the parameter

sequence_type: “weather,traffic,flashbriefing,goodmorning,singasong,tellstory,joke”

does the same job. I think a lot of the users would appriciate this.

Sorry but i can’t help coding this, but this is the only feature i am really missing since i went vom openhab.org to Home Assistant.

2 Likes

Just tried it and got it working fine.

BTW it works great with the lovelace custom-card Mini Media Player

Thanks @keatontaylor and @kalkih

I’m getting the following out of Alexa when I try to do TTS through the media player front-end:

“Sorry text to speech to only be called with a media player alexa tts service”

Did you ever figure that out? I’m assuming it might have something to do with Google TTS being setup in my config.yaml?

followed all the steps and it works - sorta :sweat_smile:

i get all my alexa’s to show up and sometimes they show me whats playing and other times only showing the status that they’re in sleep mode. i cant control anything via the buttons though - its as if the addon is only able to fetch data?

is this suppose to work for people outside countries that actually fully support alexa? US/GB/DE for example all have their own domans, i live in Sweden and ive played around with .com/.co.uk/.de (.com seems to work best)

any ideas are appreciated, i failed about a hundred times before getting this far

There is a completely separate service that is enabled called media_player.alexa_tts and you use it like so:

{
  "entity_id": "media_player.kitchen_echo_dot",
  "message": "Hello. This is a test message."
}

It does not work off the TTS under the media_player front end

I just thought I would point out that APPLE_MUSIC works as media_content_type i.e:

{
  "entity_id": "media_player.living_room_echo",
  "media_content_id":"Here comes the sun",
  "media_content_type":"APPLE_MUSIC"
}

Neat.

Hello Guys,

mine is working only a few hours/days and not updating after this time.
I have to reboot to fix this but there is no captcha then.
How to get a new captcha ?
I think my cookie is to old and works only a short time…

Ideas ?

To get a new captcha delete the alexa_media.pickle file from your configuration directory. However, your concern is not how cookies work. If the cookie lets you log in on reboot, your cookie is still valid. Are you positive it’s working on reboot? You should test both TTS and play/pause functionality.

Assuming it is indeed working initially, the fact that you’re losing functionality regularly after a period of time is a different problem unrelated to cookie validity and we’d need log data to understand what is happening.

The media buttons should work if Alexa is playing something or has recently played something. The TTS should always work, assuming your region supports it.

@keatontaylor Does this TTS work for the announcement of sensor states?
Example: The below code says “staes dot sensor dot dark sky temprature” rather saying the Temprature Value in numeric.

{
“entity_id”: “media_player.keatontaylor_echo_dot”,
“message”: “Hello!, this is your weather report. The outside temperature is {{states (‘sensor.dark_sky_temperature’) }} degrees”
}

The same Json works like charm for google TTS
Please help

There are many examples of how to mix text with sensor states throughout this topic. Search for template in this topic. Here is one example:

1 Like

I tried to use TTS to broadcast a message on multiple echo device.
Unfortunately it looks it doesn’t work.
I can see in HA only a media_player sensor for multi-room music but I cannot see a sensor for a group entry.
Using the multi-room music doesn’t seems to work.
Of course using a single media_player sensor device works fine.
Did you managed to use TTS to multiple device?

Thanks

you cant use tts for multi room, because you cant use that in the alexa app.
you can only create a group in HA with the devices you want and send the TTS to that HA group.

the devices will all speak the text, but there will be a difference in start time depending on networkspeed