Echo Devices (Alexa) as Media Player - Testers Needed

All the time. 1 echo, 3 dots, 4 firesticks, 3 firetablets.

the update interval is way to short for that amount of devices.
but i dont need several of them (group, mobile,echosim,tablet are all obsolete)

so how to change the interval?
and how to get rid of the devices i dont need.

Same here. But I guess it can be safely ignored cause the notifications still work.

it cant be ignored.
its keeping HA very busy and that makes that HA is slowing down.
and it also makes that any other problem with HA at any time is impossible to find in the log.
so it makes the log useless.

2 Likes

16_19h04m38s_001_
hi, dont get any error in installation, but get unavailable in echo dot, my hass is 0.80.1

Great add-on, thanks for letting me try it. Do you know if there’s an upper limit on the amount of text (TTS) you can send to Alexa as I’m having problems getting it to say longer messages. Thanks

Martokk provided this post, so, maybe this?

if using ‘alexa.py’ version 0.9.5.0, line 212
if using ‘alexa.py’ version 0.9.5.1, line 214

martokk

Here’s how I have been limiting this component to only update for ‘online’ devices.

Find line 212

for device in devices: 

Add the following code below it so it looks like the following:

        for device in devices:

            if device['online'] is False:
                continue

You could also try the following to only return ‘ECHO’ devices:

        for device in devices:

            if device['deviceFamily'] != 'ECHO':
                continue

16_21h50m00s_003_
thanks but dont work, the same, unavailable, and with the other code , media player dont show in hass

unavailable probably means not detected in the same network as home assistant is running.
my firesticks for instance go to unavailable when the tv is running and not the firestick.
the app on the tablet is unavailable because it isnt running
the echo simulator on the pc is unavailable because it isnt running.

change to amazon.co.uk and works

I can’t get this to load with HA at all now… hopefully someone can point out my error?
I used to have this running with the add on ages ago but can’t get the “new way” to work.

custom_component is on v9.5 and my config file details are below:

media_player:
  - platform: alexa
    email: "[email protected]"
    password: “password”
    url: “amazon.co.uk”

error code:

2018-10-18 16:16:17 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 346, 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 394, in prepare_url
host = self._get_idna_encoded_host(host)
File “/usr/local/lib/python3.6/site-packages/requests/models.py”, line 348, 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 525, in get
return self.request(‘GET’, url, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 498, in request
prep = self.prepare_request(req)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 441, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File “/usr/local/lib/python3.6/site-packages/requests/models.py”, line 309, in prepare
self.prepare_url(url, params)
File “/usr/local/lib/python3.6/site-packages/requests/models.py”, line 396, in prepare_url
raise InvalidURL(‘URL has an invalid label.’)
requests.exceptions.InvalidURL: URL has an invalid label.
2018-10-18 16:16:24 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting

Try re-typing the quotes. If you copy and pasted from the original post, it has smart quotes in it.

1 Like

Justin you little sweetheart! :smiley:
That’s done it!

Thanks buddy

1 Like

I have this in my log file. Does anyone know what it relates to? My TTS automations seems to work intermittently for some reason

018-10-19 04:42:03 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.this_device fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await 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 324, in wrapper
result = method(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 324, 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’
2018-10-19 04:42:04 ERROR (SyncWorker_8) [custom_components.media_player.alexa] An error occured accessing the API: An exception of type KeyError occurred. Arguments:
(‘devices’,)
2018-10-19 04:42:08 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.kitchen fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await 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 324, in wrapper
result = method(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 324, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/media_player/alexa.py”, line 211, in update_devices
for device in devices:
TypeError: ‘NoneType’ object is not iterable
2018-10-19 04:42:08 ERROR (SyncWorker_7) [custom_components.media_player.alexa] An error occured accessing the API: An exception of type KeyError occurred. Arguments:
(‘devices’,)
2018-10-19 04:42:11 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.mrs_alexa_apps fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await 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 324, in wrapper
result = method(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 324, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/media_player/alexa.py”, line 211, in update_devices
for device in devices:
TypeError: ‘NoneType’ object is not iterable

I am having difficulties to connect my Hassio with my Alexa echo devices, although I think I am following the correct configuration:
media_player:
platform: alexa
email: [email protected]
password: !secret amazon
url: amazon.co.uk
When I look for entities_ids, I can found one for each of my Alexa devices, but states are always unavailable.
I am running HassOS 1.11 with last version of HA.
Any help will be much appreciated.

Hello,

I tried plugin and I got status only with address amazon.co.uk now I see all information about alexa device but i cant control.
I tried button play stop power tts zero reaction home assistant log is clean without errors.

hhhmm?

try playing music from alexa. Does this show in HA Media Player ? which country do you normally login into alexa ?

Yes I see music status in media player, amazon.co.uk.

thats one of the bad things i noticed from mediaplayers in HA in general.
you need to start the mediaplayer before you get anything to control.
so in this case when alexa is playing music you can control it, but when she isnt, you can do nothing.

allthough nothing isnt true, you can use services (for instance in automations) to start alexa playing some music. and then you can control it again.

ok i will try play something from script.