Echo Devices (Alexa) as Media Player - Testers Needed

How many…? :wink:

…more than 5 sure :0)

That’s a bug. What device is 21866df1_____? Please check here (fix region).

It looks like it’s the serial number of a echo group I’ve created called “most dots” that includes (obviously…) most of the dots I have but not the one in my bedroom or basement.

That device number is also referenced in the other configs for the other dots that are part of that group

Here is a very pared down version of the output of the link above including the only places where that number is found:

{"accountName":"Kitchen Dot","appDeviceList":[],..."parentClusters":["21866df1ee3c4e188a8a4f1afc850f9e"]...
{"accountName":"Computer Room Dot","appDeviceList":[],..."parentClusters":["fcef3d60010e4f779bd86c6118c56213","21866df1ee3c4e188a8a4f1afc850f9e"]...
{"accountName":"Livingroom Dot","appDeviceList":[],..."parentClusters":["fcef3d60010e4f779bd86c6118c56213","21866df1ee3c4e188a8a4f1afc850f9e"]...
{"accountName":"Big Room Dot","appDeviceList":[],..."parentClusters":["fcef3d60010e4f779bd86c6118c56213","21866df1ee3c4e188a8a4f1afc850f9e"]...
{"accountName":"Garage Dot","appDeviceList":[],..."parentClusters":["fcef3d60010e4f779bd86c6118c56213","21866df1ee3c4e188a8a4f1afc850f9e"]...
{"accountName":"Most Dots","appDeviceList":[],..."serialNumber":"21866df1ee3c4e188a8a4f1afc850f9e"...

Came here for same reason - Just updated to 2.4 and logs flooded with:

2020-01-01 15:01:24 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.kitchen 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: '70263ca86f1c447eab1c1475c9588a8f'

Basically one per echo device I have (2 dots and three Echo Gen 2). Over and over…

Please try the PR I just posted to address this. You’ll need to be on 2.4.0 and then replace the media_player.py file. If you’re able to report back on Github that’d be ideal so we don’t clog the forums.

1 Like

Just tried your PR - seems to work! No errors. reporting on GH

2.4.1 just dropped in HACS, appears to correct the main issue, but I’m now getting the following error at restart:

2020-01-01 20:40:25 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform alexa_media
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/alexa_media/sensor.py", line 128, in async_setup_entry
    hass, config_entry.data, async_add_devices, discovery_info=None
  File "/config/custom_components/alexa_media/helpers.py", line 111, in wrapper
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/sensor.py", line 89, in async_setup_platform
    account,
  File "/config/custom_components/alexa_media/sensor.py", line 343, in __init__
    client, n_json, "date_time", account, f"next {self._type}", "mdi:alarm"
  File "/config/custom_components/alexa_media/sensor.py", line 170, in __init__
    self._all = list(map(self._fix_alarm_date_time, self._all))
  File "/config/custom_components/alexa_media/sensor.py", line 186, in _fix_alarm_date_time
    value[1][self._sensor_property] = timezone.localize(naive_time)
  File "/usr/local/lib/python3.7/site-packages/pytz/tzinfo.py", line 317, in localize
    if dt.tzinfo is not None:
AttributeError: 'NoneType' object has no attribute 'tzinfo'

I have a potential fix you can try. If that doesn’t work, I’ll need some logs from you to debug this. Please see this thread.

And to add to that, these are the available media_content_id values:

Bells and Buzzer
bells: “bell_02”
buzzer: “buzzers_pistols_01”
church_bell: “amzn_sfx_church_bell_1x_02”
doorbell1: “amzn_sfx_doorbell_01”
doorbell2: “amzn_sfx_doorbell_chime_01”
doorbell3: “amzn_sfx_doorbell_chime_02”

Holidays
xmas_bells: “christmas_05”
halloween_door: “horror_10”

Misc
air_horn: “air_horn_03”
boing1: “boing_01”
boing2: “boing_03”
camera: “camera_01”
squeaky_door: “squeaky_12”
ticking_clock: “clock_01”
trumpet: “amzn_sfx_trumpet_bugle_04”

Animals
cat_meow: “amzn_sfx_cat_meow_1x_01”
dog_bark: “amzn_sfx_dog_med_bark_1x_02”
lion_roar: “amzn_sfx_lion_roar_02”
rooster: “amzn_sfx_rooster_crow_01”
wolf_howl: “amzn_sfx_wolf_howl_02”

Scifi
aircraft: “futuristic_10”
engines: “amzn_sfx_scifi_engines_on_02”
red_alert: “amzn_sfx_scifi_alarm_04”
shields: “amzn_sfx_scifi_sheilds_up_01”
sirens: “amzn_sfx_scifi_alarm_01”
zap: “zap_01”

Crowds
applause: “amzn_sfx_crowd_applause_01”
cheer: “amzn_sfx_large_crowd_cheer_01”

11 Likes

Took a look at the code changes and it appears to be a missing or bad timezone in the Alexa app. What I cannot figure out is which timezone is being referred to?

I’ve gone into the Alexa app on my mobile phone and then to Settings > Alexa on this Phone, and then set the Timezone there (it wasn’t previously set).

However, that didn’t eliminate the error.

From what I can tell, each device has to be set independently (every device that is paired with Alexa (all your echos, Sonos, mobile devices, etc.)), and it’s unclear which device is causing the error…

After setting the timezone on my Phone, I restarted HA and the error persisted, so not sure where it’s trying to ascertain the time zone.

Did you want me to respond in the thread?

Thanks for all of your work on this. Is there a way to turn on ‘brown noise’ on an alexa echo at a certain time of day? for example, play a certain track/playlist from spotify or a local file, etc.?
Thanks!

Thanks for listing these, it looks like they match the set of sounds available when creating a routine in the Alexa app. Hopefully they expand this to include everything in the skill sound library but that’s probably unlikely considering there are over 3,000 sounds…

Is it possible say to Alexa a voice command from Home Assistant as if I said it in reality?

I want “rename” a voice command and Alexa Routine don’t have this option like Google Home.
I thought do a script with the voice command in Home Assistant and an Alexa Routine that run this script.

Sounds working in node-red with:

[{"id":"7d3bfded.d12c44","type":"api-call-service","z":"8d0b4e7d.575f4","name":"Alert Alexa","server":"3ddad461.2f050c","version":1,"debugenabled":true,"service_domain":"media_player","service":"play_media","entityId":"media_player.keesha","data":"{\"media_content_type\":\"sound\",\"media_content_id\":\"amzn_sfx_doorbell_chime_01\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":710,"y":840,"wires":[[]]},{"id":"3ddad461.2f050c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
1 Like

Folks

few days ago my GUARD entity dissapeard “alarm_control_panel.alexa_guard_3b376”.

Would you be able to help me what went wrong?

thank you very much

V.Captu232323re

Only what play_media supports which is only available on the cloud. The Wiki also has automation examples.

No.

Need logs to answer the question. Most likely issue is your .pickle file has expired and should be deleted. If you’re using configuration.yaml, you’ll need to reboot. Otherwise, you can remove and add the integration.

Has anyone run into " ‘application/json’)> returned 429:Too Many Requests:text/html’ " errors when requesting an Alexa Media Player TTS request? I am randomly seeing this error, even after several minutes of all media players sitting IDLE. This causes a really nasty drop out of audio TTS messages through my Echo Dots. What I do see in my home-assistant.log are periodic requests as such:
[custom_components.alexa_media] p8@ym: Received websocket command: PUSH_VOLUME_CHANGE
[custom_components.alexa_media] p
8@y**m: Received websocket command: PUSH_EQUALIZER_STATE_CHANGE
Sometimes these commands are colliding with my Notify Alexa Media TTS requests and cause the 429 error. I do not have a mechanism to detect this error other than to view the log file. Shouldn’t the notify.alexa_media service have a built in retry mechanism to deal with this situation? Also, why is the alexa_media custom component issuing these volume and equalizer updates unsolicited?.

This happens if you send too many requests to Amazon within some predefined time as decided by Amazon. Is this happening based on a script sending multiple requests? (Please note it doesn’t matter if it’s multiple requests to a single devices or multiple devices as they’re all behind one API.) Or does it happen when you’re sending a specific request? Also what version are you running? We put in queuing to address this in 2.4.x and we batch up multiple requests within 0.5 seconds. Of course, only certain commands can be queued so again it depends on what you’re sending to Amazon.

The websocket commands in the logs are not related at all. The component does not do any active communication on the websocket and only listens to what Amazon devices are broadcasting. What you are seeing is the fact that echo devices are very chatty on the websocket. Any complaint there should be raised with Amazon.

Not sure if this was asked already but will this support amazon deliveries? Alexa already alerts of new deliveries and I was curious if it’s possible to show deliveries in a card. Then that could lead to automations like push notifications etc.

2 Likes