Echo Devices (Alexa) as Media Player - Testers Needed

Same here, it appears to be working but my echo is always in standby mode and nothing will wake it up.

Is anyone able to get this to work in New Zealand or Australia ??

THanks

Am I the only one who has broken Alexa integration after upgrade to HA 0.78.0?

I have following in HA logs:

2018-09-18 19:09:09 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 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 607, in __init__
    self.login_with_cookie()
  File "/config/custom_components/media_player/alexa.py", line 630, in login_with_cookie
    self.login(cookies=cookies)
  File "/config/custom_components/media_player/alexa.py", line 701, in login
    if (cookies is not None and self.test_loggedin(cookies)):
  File "/config/custom_components/media_player/alexa.py", line 673, in test_loggedin
    '/api/devices-v2/device')
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 525, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 644, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 644, in <listcomp>
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 192, in resolve_redirects
    proxies = self.rebuild_proxies(prepared_request, proxies)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 276, in rebuild_proxies
    environ_proxies = get_environ_proxies(url, no_proxy=no_proxy)
  File "/usr/local/lib/python3.6/site-packages/requests/utils.py", line 763, in get_environ_proxies
    return getproxies()
  File "/usr/local/lib/python3.6/urllib/request.py", line 2480, in getproxies_environment
    for name, value in os.environ.items():
  File "/usr/local/lib/python3.6/_collections_abc.py", line 744, in __iter__
    yield (key, self._mapping[key])
  File "/usr/local/lib/python3.6/os.py", line 669, in __getitem__
    raise KeyError(key) from None
KeyError: 'OPENBLAS_MAIN_FREE'

UPDATE: Exception is gone and media_player.alexa entity is available again in HA. Simple hassio restart helped - apparently HA does not always start up properly immediately after upgrade.

LOL, you haven’t been with us long, have you. LOL

1 Like

Not working with 78.0 Docker;

Unable to install package lxml==4.2.4: Failed building wheel for lxml wirelesstagpy 0.3.0 has requirement colorlog==3.0.1, but you'll have colorlog 3.1.4 which is incompatible. waterfurnace 0.7.0 has requirement websocket-client&gt;=0.47, but you'll have websocket-client 0.37.0 which is incompatible. upsmychoice 1.0.6 has requirement beautifulsoup4==4.5.1, but you'll have beautifulsoup4 4.6.1 which is incompatible. upsmychoice 1.0.6 has requirement python-dateutil==2.6.0, but you'll have python-dateutil 2.7.3 which is incompatible. upsmychoice 1.0.6 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible. toonlib 1.0.2 has requirement cachetools==2.0.0, but you'll have cachetools 2.0.1 which is incompatible. toonlib 1.0.2 has requirement requests==2.13.0, but you'll have requests 2.19.1 which is incompatible. temperusb 1.5.3 has requirement pyusb&gt;=1.0.0rc1, but you'll have pyusb 1.0.0b1 which is incompatible. spotcrime 1.0.3 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible. skybellpy 0.1.2 has requirement colorlog==3.0.1, but you'll have colorlog 3.1.4 which is incompatible. python-velbus 2.0.19 has requirement pyserial==3.3, but you'll have pyserial 3.1.1 which is incompatible. python-jose-cryptodome 1.3.2 has requirement pycryptodome&lt;3.4.0,&gt;=3.3.1, but you'll have pycryptodome 3.6.6 which is incompatible. pysma 0.2.0 has requirement aiohttp&lt;3,&gt;2, but you'll have aiohttp 3.4.4 which is incompatible. pysma 0.2.0 has requirement async-timeout&lt;3,&gt;2, but you'll have async-timeout 3.0.0 which is incompatible. pymysensors 0.17.0 has requirement pyserial&gt;=3.4, but you'll have pyserial 3.1.1 which is incompatible. pymonoprice 0.3 has requirement pyserial&gt;=3.4, but you'll have pyserial 3.1.1 which is incompatible. pymata 2.14 has requirement pyserial==2.7, but you'll have pyserial 3.1.1 which is incompatible. pyicloud 0.9.1 has requirement keyring&lt;9.0,&gt;=8.0, but you'll have keyring 15.0.0 which is incompatible. pyicloud 0.9.1 has requirement keyrings.alt&lt;2.0,&gt;=1.0, but you'll have keyrings-alt 3.1 which is incompatible. pyblackbird 0.5 has requirement pyserial&gt;=3.4, but you'll have pyserial 3.1.1 which is incompatible. nad-receiver 0.0.9 has requirement pyserial==3.2.1, but you'll have pyserial 3.1.1 which is incompatible. myusps 1.3.2 has requirement beautifulsoup4==4.6.0, but you'll have beautifulsoup4 4.6.1 which is incompatible. myusps 1.3.2 has requirement python-dateutil==2.6.0, but you'll have python-dateutil 2.7.3 which is incompatible. myusps 1.3.2 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible. myusps 1.3.2 has requirement selenium==2.53.6, but you'll have selenium 3.14.0 which is incompatible. mycroftapi 2.0 has requirement websocket-client==0.44.0, but you'll have websocket-client 0.37.0 which is incompatible. motorparts 1.0.2 has requirement beautifulsoup4==4.5.1, but you'll have beautifulsoup4 4.6.1 which is incompatible. motorparts 1.0.2 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible. magicseaweed 1.0.0 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible. locationsharinglib 2.0.11 has requirement beautifulsoup4==4.6.0, but you'll have beautifulsoup4 4.6.1 which is incompatible. libsoundtouch 0.7.2 has requirement websocket-client&gt;=0.40.0, but you'll have websocket-client 0.37.0 which is incompatible. insteonplm 0.14.2 has requirement pyserial==3.2.0, but you'll have pyserial 3.1.1 which is incompatible. hipnotify 1.0.8 has requirement requests==2.9.1, but you'll have requests 2.19.1 which is incompatible. geizhals 0.0.7 has requirement beautifulsoup4&gt;=4.6.3, but you'll have beautifulsoup4 4.6.1 which is incompatible. gearbest-parser 1.0.7 has requirement beautifulsoup4==4.6.0, but you'll have beautifulsoup4 4.6.1 which is incompatible. fedexdeliverymanager 1.0.6 has requirement beautifulsoup4==4.5.1, but you'll have beautifulsoup4 4.6.1 which is incompatible. fedexdeliverymanager 1.0.6 has requirement python-dateutil==2.6.0, but you'll have python-dateutil 2.7.3 which is incompatible. discord-py 0.16.12 has requirement aiohttp&lt;1.1.0,&gt;=1.0.0, but you'll have aiohttp 3.4.4 which is incompatible. discord-py 0.16.12 has requirement websockets&lt;4.0,&gt;=3.1, but you'll have websockets 6.0 which is incompatible. crimereports 1.0.0 has requirement requests==2.12.4, but you'll have requests 2.19.1 which is incompatible. broadlink 0.9 has requirement pycryptodome==3.4.11, but you'll have pycryptodome 3.6.6 which is incompatible. alarmdecoder 1.13.2 has requirement pyserial==2.7, but you'll have pyserial 3.1.1 which is incompatible. abodepy 0.13.1 has requirement colorlog==3.0.1, but you'll have colorlog 3.1.4 which is incompatible. Command "/usr/local/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-fecwd81l/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-_xzyfwve/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-fecwd81l/lxml/ You are using pip version 10.0.1, however version 18.0 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

Updated pip and ran sudo pip install lxml==4.2.4 (which failed). Still no joy. Any ideas @keatontaylor?

I can confirm this is working under 0.78 and 0.78.1.

You shouldn’t have to update HA within your docker container. Just pull the latest docker image to update.

Correct, I shouldn’t have too. I did pull the latest image.

Ended up having to delete the alexa.py file, reboot, then place the file back in, reboot and all then worked. Very strange.

Now my logs are just getting filled with this error, one entry per each of the 5 Echos.

Update for media_player.lounge fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 224, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 353, in async_device_update
    yield from self.hass.async_add_job(self.update)
  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 452, in update
    self.update_devices(no_throttle=True)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 325, in wrapper
    result = method(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 325, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/media_player/alexa.py", line 213, in update_devices
    for b_state in bluetooth['bluetoothStates']:
KeyError: 'bluetoothStates'

Solution!
Hey i had the same problem it can be fixed if you echo device settings, change to US location and American english and dont put any time zone.

Hmm I can’t not set a time zone and now it says unavailable :frowning:

Did you mange to get this working? i have thesame problem! I would like to have an text input somwhere on my HA dash so i can send that text via tts via Alexa. Any ideas on that?

You could do exactly as you’ve stated:

  • Create an input_text to use on your front end. This is where you will enter your text.
  • Create an automation that uses your input_text state as a trigger, with the automation action calling media_player.alexa_tts

I’ve done something similar with telegram. I type ‘/s’ or ‘/say’ followed by the text that I would like to speak. (ie. ‘/s testing alexa tts’)

Anyone managed to get TTS working in the UK? Or I guess any other non-US region?
As others have said, I don’t get any errors in the log, it just doesn’t work…

1 Like

My config for that is here:
https://github.com/rrubin0/homeassistant-config/blob/master/packages/alexa_tts.yaml

Look at LoveLace UI config for the front end; looks like this:
image

3 Likes

I use this puppy daily and found it extremely reliable. Now, if requests are being taken… I’d love to be able to use this as a “whole house broadcast” for; dinner’s ready, tornado warning, etc… little stuff. Kinda like the Alexa Multi-room Music Group.

Add all Alexa devices into a group and set the TTS entity_id to the group entity_id and it should work :slight_smile:

2 Likes

This is SO KOOL! It worked! I can now, from the comfort of my desk, tell the clan dinner is ready! Thank you sir.
(Now, on to working with the folks for whole house broadcasting Emergency Weather Warnings… ya know, something useful.

1 Like

Have you tried restarting HA?

I’ve noticed sometimes it stops working for me, but a quick restart of HA and it’s back up and working. Not sure why it stops - I’ll do some investigation at some point when it fails and I get some time, but it’s certainly not to do with the cookie as on the restart, it comes straight backup without a prompt using the previous cookie.

Hey is it possible to choose language for the TTS?
This would be really nice feature!!
With “”,“locale”:“en-US”, \ ?

def send_tts(self, message):
    """Send message for TTS at speaker."""
    data = {
        "behaviorId": "PREVIEW",
        "sequenceJson": "{\"@type\": \
        \"com.amazon.alexa.behaviors.model.Sequence\", \
        \"startNode\":{\"@type\": \
        \"com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode\", \
        \"type\":\"Alexa.Speak\",\"operationPayload\": \
        {\"deviceType\":\"" + self._device._device_type + "\", \
        \"deviceSerialNumber\":\"" + self._device.unique_id +
        "\",\"locale\":\"en-US\", \
        \"customerId\":\"" + self._device._device_owner_customer_id +
        "\", \"textToSpeak\": \"" + message + "\"}}}",
        "status": "ENABLED"
    }
    self._post_request('/api/behaviors/preview',
                       data=data)

Seconded. Still having the same problem.

I had the same problem before. had to change settings for my Echodot device from
UK to US language and remove time zone then it work. I was using before https://alexa.amazon.co.uk i had to change to You've received an Alexa Link

media_player:

  • platform: alexa
    email: !secret alexa_email
    password: !secret alexa_password
    url: amazon.com