Echo Devices (Alexa) as Media Player - Testers Needed

Thera are currently problems on the Amazon Systems

1 Like

Thank you for answer but it doesn’t works.
The only way that I found is create a routine with two actions “Alexa say” with a second delay between them.

Hi folks: sorry but I’m totally lost and need a push into the right direction
I try to create a list of all timers, reminders and clocks which have been set in order to can ask alexa
for any active timers
So I created a group and added all alexa sensors.
Then I created a loop in order to build the list for later output via alexa.
My problem is to calculate the minutes remaining.
I tried this:

{%- for entity_id in states.group.all_alexa_sensors.attributes.entity_id if states(entity_id) != 'unavailable' -%}
       {% if loop.first %} The following times are set {% elif loop.last %} and {% else %} , {% endif -%}
          {{ state_attr(entity_id,'friendly_name') + ' in ' }} {{ (as_timestamp(states(entity_id)) - as_timestamp(now) |float) / 3600  |int + 'Minutes' }}
       {%- endfor %}

The value calculated is completely nonsense.
Can anybody help with the right formula?
The other way round, calculate the past time, now - timestamp(variable), works accurate - may be I had some Gin Tonic too much over X-Mas

There appear to be a few issues there:

  1. now is actually a function, so as_timestamp(now) should actually be as_timestamp(now()). Without the parentheses this results in the timestamp being None, which is probably the main cause of your problem.
  2. Subtracting the timestamps will give the time remaining in seconds, so you should only need to divide by 60 to get the time remaining in minutes.
  3. The concatenation of the string ‘Minutes’ (in |int + 'Minutes' }} gave me an error when testing your template (“TypeError: unsupported operand type(s) for +: ‘float’ and ‘str’”). You may be better doing this as |int }} Minutes
2 Likes

Thanks a lot @Steven_Rollason. So clear but I haven’t seen it. It’s sometimes amazing :slight_smile:

v2.4.0 seems to be out which adds alexa sound to play_media.

Does anyone know how to use this feature? no docs currently available.

EDIT: found this on GitHub which gives an example.

@apt I’ll try to update the wiki ASAP, but… meanwhile… This is an example for script that play a bell sound (tested):

door_bell_alexa:
  sequence:
    - service: media_player.play_media
      data:
        entity_id: media_player.guest_room
        media_content_type: sound
        media_content_id: amzn_sfx_doorbell_chime_01
3 Likes

Here we can seach&find the names of the different sounds -> https://developer.amazon.com/en-US/docs/alexa/custom-skills/ask-soundlibrary.html

1 Like

I have tested some of them, but looks that not all of them are available. I have updated the wiki (under revision yet) with the sounds availables from Alexa app. If someone can get the ‘Alexa skills kit sound’ to works, could advise here?..But I think it is related with TTS and announce…but no idea

1 Like

I have this working for a while but got a additional DOT recently and it’s not showing up or being discovered. Do i need to do something to have it discovery my new device or should it find it?

@SnowmanUT When I have got new devices (DOT), they are discovered as soon they are added to my Amazon account… Most of them before arrive, since Amazon link the account with them once shipped the devices (or before maybe) (If I don’t indicate otherwise when I place the order)

Mine is discovered in Amazon app and I renamed my sons’s old DOT to move it and put the new one in his room but I don’t see the new DOT in the home assistant as an available media player like my other devices I have. I have mini media player configured for all the other DOT’s I have but can’t for this one as it’s not discovered??

Have you checked if the “enable newly added entities” is enabled? (configuration - integrations - Alexa media player - System options (top right corner))

SIALx

It was enabled but going there helped me find it in the list. The entity name was not what I have it labeled in Alexa but was able to find it and fix that. Thanks for the help.

What would be really awesome is if the Samuel L. Jackson celebrity voice I purchased for Alexa was available as an Amazon Polly voice I could select using SSML when doing text-to-speech notifications. I’ve not found any pointers to see if that’s something possible within the Amazon ecosystem or not.

1 Like

Happy New Year 2020!

Checking HACS noticed a pending update of Alexa Media Player.

1 - current one is ==> v2.3.6
2 - Available newest ==> v2.4.0

When I update and restart HA it still shows that I am running on v2.3.6.

Should I uninstall it and then reinstall it?

From drop down menu select 2.4.0 and hit Update.

Thank you Vlad. Done and updated.

I just updated to v2.4.0 and now I’m getting the following errors filling up my logs for every Echo device I have:

2020-01-01 10:26:03 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.big_room_dot fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 667, in async_update
    no_throttle=True)
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 371, in refresh
    self._parent_clusters))
  File "/config/custom_components/alexa_media/media_player.py", line 370, in <lambda>
    ['media_player'][x].state == STATE_PLAYING),
KeyError: '21866df1ee3c4e188a8a4f1afc850f9e'
2020-01-01 10:26:03 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.livingroom_dot fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 667, in async_update
    no_throttle=True)
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 371, in refresh
    self._parent_clusters))
  File "/config/custom_components/alexa_media/media_player.py", line 370, in <lambda>
    ['media_player'][x].state == STATE_PLAYING),
KeyError: '21866df1ee3c4e188a8a4f1afc850f9e'
2020-01-01 10:26:03 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.computer_room_dot fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 667, in async_update
    no_throttle=True)
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 371, in refresh
    self._parent_clusters))
  File "/config/custom_components/alexa_media/media_player.py", line 370, in <lambda>
    ['media_player'][x].state == STATE_PLAYING),
KeyError: '21866df1ee3c4e188a8a4f1afc850f9e'

I verified the issue comes from the v2.4.0 update by rolling back to v2.3.6 and thaose errors are gone.

also, in case it helps I was also getting a bunch of these similar errors before I rolled back for testing (but they haven’t shown up yet since I re-updated to the latest to verify the errors returned):

2019-12-31 17:40:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/alexa_media/media_player.py", line 282, in _handle_event
    await _refresh_if_no_audiopush(already_refreshed)
  File "/config/custom_components/alexa_media/media_player.py", line 197, in _refresh_if_no_audiopush
    await self.async_update()
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 667, in async_update
    no_throttle=True)
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 371, in refresh
    self._parent_clusters))
  File "/config/custom_components/alexa_media/media_player.py", line 370, in <lambda>
    ['media_player'][x].state == STATE_PLAYING),
KeyError: '21866df1ee3c4e188a8a4f1afc850f9e'
2019-12-31 17:45:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/alexa_media/media_player.py", line 282, in _handle_event
    await _refresh_if_no_audiopush(already_refreshed)
  File "/config/custom_components/alexa_media/media_player.py", line 197, in _refresh_if_no_audiopush
    await self.async_update()
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 667, in async_update
    no_throttle=True)
  File "/config/custom_components/alexa_media/helpers.py", line 143, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 371, in refresh
    self._parent_clusters))
  File "/config/custom_components/alexa_media/media_player.py", line 370, in <lambda>
    ['media_player'][x].state == STATE_PLAYING),
KeyError: '21866df1ee3c4e188a8a4f1afc850f9e'

any suggestions? Known issue?

After many…many reboots it seems to have disappeared. :0)