Echo Devices (Alexa) as Media Player - Testers Needed

My question is relating to the following code.
media_content_type: “TUNEIN” #AMAZON_MUSIC, SPOTIFY, PANDORA, TUNEIN, I_HEART_RADIO

Do you have to specify just one of the media types, or can you use multiple types?

Apologies
Answer is yes. You’d need to set it up the same way as the stations.
Use a boolean or input text, make it a variable, etc
Exactly the same as the stations.

1 Like

I’m trying to play to multiple Echo’s at once but haven’t been able to make them play in sync. They all start at different times when I just call the alexa_tts with multiple entity ID’s passed into it. Several of the Echo Dots are within “earshot” of one another, so, unless they’re synced, it’s very difficult to understand what Alexa is saying.

I’ve set up a downstairs Echo group in the Alexa app and am able to play music via Alexa, all in sync. Using @keatontaylor’s script, Home Assistant see’s the Alexa group (creating media_player.downstairs_echos), but trying to call the alexa_tts service to that group, I get no sound output. Any ideas on how to get Echo’s to play TTS in sync?

Alexa groups don’t respond to TTS unfortunately. This is a limitation with the APIs amazon implemented for routines in the web interface. The only way to do TTS to groups is to group them in home assistant and send the TTS to that home assistant group, but this will mean that there is a chance (larger depending on the number of instances you have) that it won’t be in sync.

if it is hard to understand because she is just a little out of sync, then create a timespace between responses.
when i send TTS to several devices, i use a 5 sec timespace.

Hi all

maybe I’m not the only one, but it seems that now also also TTS in Italian is working

Just tried this

16

and it’s working!

I haven’t done anything on the Alexa side.

BTW, what is the difference in calling the TTS from within HA via media_player and via CLI?

Thanks

@keatontaylor I understand. Hoping they eventually change that limitation!

@ReneTode When you say timespace, are you putting a 5-second gap in between the TTS message sent to each speaker, so essentially the speakers respond in round-robin?

indeed.
dont do send to much though. you end up annoying yourself :wink:

Do other media sources need to be added to the component manually? I’m looking to play from my PLEX server but I tried “plex” as the content type and it didn’t work. By voice it follows the usual pattern of “ask plex to play…” so I’m assuming that’s the name needed.

Getting the following when trying to startup.

Left the url as default “amazon.com

2018-12-06 15:06:39 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/requests/models.py", line 350, in _get_idna_encoded_host
    host = idna.encode(host, uts46=True).decode('utf-8')
  File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 361, in encode
    s = alabel(label)
  File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 284, in alabel
    check_label(label)
  File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 261, in check_label
    raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label)))
idna.core.InvalidCodepoint: Codepoint U+201C at position 1 of '“amazon' not allowed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 398, in prepare_url
    host = self._get_idna_encoded_host(host)
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 352, in _get_idna_encoded_host
    raise UnicodeError
UnicodeError

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 142, in setup_platform
    config.get(CONF_DEBUG))
  File "/config/custom_components/media_player/alexa.py", line 608, in __init__
    self.login_with_cookie()
  File "/config/custom_components/media_player/alexa.py", line 631, in login_with_cookie
    self.login(cookies=cookies)
  File "/config/custom_components/media_player/alexa.py", line 747, 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.
2018-12-06 15:06:39 INFO (MainThread) [homeassistant.setup] Setup of domain media_player took 1.3 seconds.

Played about a bit using amazon.co.uk

   2018-12-06 15:50:15 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/requests/models.py", line 350, in _get_idna_encoded_host
        host = idna.encode(host, uts46=True).decode('utf-8')
      File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 361, in encode
        s = alabel(label)
      File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 284, in alabel
        check_label(label)
      File "/usr/local/lib/python3.6/site-packages/idna/core.py", line 261, in check_label
        raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label)))
    idna.core.InvalidCodepoint: Codepoint U+201C at position 1 of '“amazon' not allowed

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 398, in prepare_url
        host = self._get_idna_encoded_host(host)
      File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 352, in _get_idna_encoded_host
        raise UnicodeError
    UnicodeError

    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 142, in setup_platform
        config.get(CONF_DEBUG))
      File "/config/custom_components/media_player/alexa.py", line 608, in __init__
        self.login_with_cookie()
      File "/config/custom_components/media_player/alexa.py", line 631, in login_with_cookie
        self.login(cookies=cookies)
      File "/config/custom_components/media_player/alexa.py", line 747, 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.

wrong quotes are used.

loving you matey !!!

thank you very much

1 Like

The latest update of the IOS Alexa app (UK, Dec 7) includes the option to “Stop Audio” in routines. Finally!
Does anyone know if it’s possible to do this through HA?

Can we update the list of Alexa devices with out logging out and logging back again?

The list should be automatically updated without needing to login (I assume you mean delete the pickle file) and log back in. If it isn’t that is a bug.

just want to say big thanks, I`m running HASSIO on UBUNTU 14 in Docker . Awesome!

Yes, I added a new 4k Firestick, but it did not show up after restarts. I will try deleting the pickle file and restarting.

Ignore the previous comment…I was probably looking under the wrong name.

The component has been quite stable. Hopefully, you can get it merged in HA soon :slight_smile:

Can you ping in automation multiple Alexas? I want all my alexas to pass the msg

action:
- service: media_player.alexa_tts
data:
entity_id: media_player.kitchen