Echo Devices (Alexa) as Media Player - Testers Needed

Not sure if this is what you are after. You have two notify examples here. Hope it helps you.

  1. Current temperature
  2. Current time
[{"id":"44231102.ac4","type":"link in","z":"cf1212c1.a61a","name":"Link In","links":["7ee9180b.d155c"],"x":730,"y":180,"wires":[["7c52074c.2962c","a126b27c.580de8"]],"l":true},{"id":"7ee9180b.d155c","type":"link out","z":"cf1212c1.a61a","name":"Link Out","links":["44231102.ac4"],"x":540,"y":180,"wires":[],"l":true},{"id":"7c52074c.2962c","type":"api-call-service","z":"cf1212c1.a61a","name":"📢 Alexa","server":"be196a96.e67d88","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_living_room_echo_dot","entityId":"","data":"{\"message\":\"{{payload}}\",\"data\":{\"type\":\"tts\",\"method\":\"speak\"},\"target\":[\"media_player.living_room_echo_dot\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":860,"y":40,"wires":[[]]},{"id":"a126b27c.580de8","type":"debug","z":"cf1212c1.a61a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":280,"wires":[]},{"id":"3ff97e7d.ea9412","type":"inject","z":"cf1212c1.a61a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":140,"wires":[["e37abef3.981098"]]},{"id":"e37abef3.981098","type":"function","z":"cf1212c1.a61a","name":"Bedroom Temperature","func":"msg.payload =\n\n\"The bedroom temperature is \"+\n\"{{states.sensor.bedroom_temperature.state}}\"+ \", \" +\n\n\"Degrees\"\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":140,"wires":[["7ee9180b.d155c"]]},{"id":"9fb54d88.49106","type":"inject","z":"cf1212c1.a61a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":200,"wires":[["be878e9c.fe8a6"]]},{"id":"be878e9c.fe8a6","type":"function","z":"cf1212c1.a61a","name":"Time","func":"msg.payload =\n\n\"The time is \"+\n\"{{states.sensor.time.state}}\"\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":200,"wires":[["7ee9180b.d155c"]]},{"id":"be196a96.e67d88","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Hi all,

does someone have the Alexa Custom Skills working with the Alexa Player?
Im trying now for weeks, but without success… Account linking is ok, but not work.
Link with token is ok but not working

mine is working. it is a little bit tricky to have it working.

do you have following config in config.yaml?

api:

alexa:
  smart_home:

Yes a already have this to control devices with Alexa:


flash_briefings:
  password: !secret amazon_flash_briefing_password
  ha_briefing:
    - title: "Temperature"
      text: >
        Inside the house, it is {{ (states('sensor.entryway_thermostat_temperature') | int) }} degrees.
        Outside it is "{{ (states('sensor.buienradar_temperature')) | int }}" degrees.
        The forcast for today is "{{ (states('sensor.buienradar_full_condition')) }}", tomorrow it will be "{{ (states('sensor.buienradar_full_condition_1d')) }}".
        There is {% set ns = namespace(res=0) %}{% for count in state_attr('group.meek_switches', 'entity_id') if is_state(count, 'on') %}{% set ns.res = ns.res + 1 %}{%endfor%}{{ ns.res }} wall switch on.
        {% for entity_id in state_attr('group.meek_switches','entity_id') if not is_state(entity_id, 'off') %} The {{ entity_id }} is on.{% endfor %},
        Home Assistant CPU temperature is {{ (states('sensor.ha_cpu_temperature') | int) }} degrees.
        DMRS CPU temperature is {{ (states('sensor.dsmr_cpu_temperature')  |int) }} degrees.
        Nextcloud temperature is {{ (states('sensor.nextcloud_cpu_temperature') | int) }} degrees.

smart_home:
  endpoint: https://api.eu.amazonalexa.com/v3/events
  client_id: !secret alexa_client_id_smart_home_messaging
  client_secret: !secret alexa_client_secret_smart_home_messaging
  filter:
    include_entities:
      - media_player.android
      - media_player.woonkamer
      - input_number.fullykiosk_brightness_slider
      - fan.afzuiging_badkamer
      - switch.briefing

# Lights
      - light.livingroom_all
      - light.dressoir_all
      - light.hallway_all
      - light.balcony_all
      - light.kitchen_all
      - light.sink_all
      - light.bedroom_all
      - light.bathroom_all
      - light.toilet_all
      - light.nanoleaf
      - light.browser_ae1b43e7_eb57c683
      - light.newkaku_01401eb6_a

# Motion Sensors - Not seen as motion sensors
      - binary_sensor.zwave2mqtt_nodeid_87_contact
      - binary_sensor.zwave2mqtt_nodeid_88_contact
      - binary_sensor.zwave2mqtt_nodeid_90_contact
      - binary_sensor.zwave2mqtt_nodeid_91_contact
      - binary_sensor.zwave2mqtt_nodeid_106_contact
      - binary_sensor.zwave2mqtt_nodeid_107_contact
      - binary_sensor.zwave2mqtt_nodeid_108_contact

# Scenes
      - switch.scene_sleeping
      - switch.scene_romantic
      - switch.scene_kodi
      - switch.scene_goodnight
      - switch.scene_morning
      - switch.scene_appletv
      - switch.scene_daytime
      - switch.scene_tv
      - switch.scene_evening
      - switch.scene_disco
      - switch.scene_cooking
      - switch.kay_learning
      - switch.dnc
      - switch.scene_dinner

# Logitech Activities
      - switch.airplay
      - switch.iptv
      - switch.kodi
      - switch.tv
      - switch.appletv

# NEST
      - climate.entryway

# Temperature sensors
      - sensor.zwave2mqtt_nodeid_101_temperature_air
      - sensor.zwave2mqtt_nodeid_100_temperature_air
      - sensor.zwave2mqtt_nodeid_106_temperature_air
      - sensor.zwave2mqtt_nodeid_88_temperature_air
      - sensor.zwave2mqtt_nodeid_107_temperature_air
      - sensor.zwave2mqtt_nodeid_90_temperature_air
      - sensor.zwave2mqtt_nodeid_108_temperature_air
      - sensor.zwave2mqtt_nodeid_91_temperature_air
      - sensor.zwave2mqtt_nodeid_87_temperature_air

  entity_config:
    fan.afzuiging_badkamer:
      display_categories: FAN
    media_player.android:
      name: "Kodi Mediaplayer"
      display_categories: STREAMING_DEVICE
    media_player.woonkamer:
      name: "AppleTV Mediaplayer"
      display_categories: STREAMING_DEVICE

    switch.dnc:
      name: "Disable Nest Control"
      display_categories: SWITCH

    sensor.zwave2mqtt_nodeid_101_temperature_air:
      name: "Temp. Frontdoor"
      description: "Temp. at the frontdoor"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_100_temperature_air:
      name: "Temp. iMac"
      description: "Temp. iMac"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_106_temperature_air:
      name: "Temp. Bedroom"
      description: "Temp. in the dedroom"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_88_temperature_air:
      name: "Temp. Bathroom"
      description: "Temp. in the bathroom"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_107_temperature_air:
      name: "Temp. Kitchen"
      description: "Temp. in the kitchen"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_90_temperature_air:
      name: "Temp. Hallway"
      description: "Temp. in the hallway"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_108_temperature_air:
      name: "Temp. Diningroom"
      description: "Temp. in the diningroom"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_91_temperature_air:
      name: "Temp Livingroom"
      description: "Temp. in the livingroom"
      display_categories: TEMPERATURE_SENSOR
    sensor.zwave2mqtt_nodeid_87_temperature_air:
      name: "Temp. Toilet"
      description: "Temp. in the toilet"
      display_categories: TEMPERATURE_SENSOR

    binary_sensor.zwave2mqtt_nodeid_87_contact:
      name: "Motion Toilet"
      description: "Motion sensor in the toilet"
      display_categories: MOTION_SENSOR
    binary_sensor.zwave2mqtt_nodeid_88_contact:
      name: "Motion Bathroom"
      description: "Motion sensor in the bathroom"
      display_categories: MOTION_SENSOR
    binary_sensor.zwave2mqtt_nodeid_90_contact:
      name: "Motion Hallway"
      description: "Motion sensor in the hallway"
      display_categories: MOTION_SENSOR
    binary_sensor.zwave2mqtt_nodeid_91_contact:
      name: "Motion Livingroom"
      description: "Motion sensor in the livingroom"
      display_categories: MOTION_SENSOR
    binary_sensor.zwave2mqtt_nodeid_106_contact:
      name: "Motion Bedroom"
      description: "Motion sensor in the bedroom"
      display_categories: MOTION_SENSOR
    binary_sensor.zwave2mqtt_nodeid_107_contact:
      name: "Motion Kitchen"
      description: "Motion sensor in the kitchen"
      display_categories: MOTION_SENSOR
    binary_sensor.zwave2mqtt_nodeid_108_contact:
      name: "Motion Diningroom"
      description: "Motion sensor in the diningroom"
      display_categories: MOTION_SENSOR

    binary_sensor.manual_kay_home:
      name: "Presence Kay"
      description: "Indication that Kay is home"
      display_categories: MOTION_SENSOR
    binary_sensor.manual_peter_home:
      name: "Presence Peter"
      description: "Indication that Peter is home"
      display_categories: MOTION_SENSOR

I am having an issue where my Echo devices aren’t showing the correct names. “Office Echo Dot” is now a long UUID. Is there an easy fix for this? I checked my Alexa app and the speakers are named correctly.

Need some help. When I use the call service of media_player.play_media on a single Echo entity, it works perfectly. When I use it on an Alexa Music Group, it doesnt work. Here is my config, any help would be greatly appreciated.

service: media_player.play_media
data:
  media_content_id: Songs to Sing in the Shower
  media_content_type: SPOTIFY
target:
  entity_id: media_player.home_theater

home_theater is an Alexa defined group. I have the same lack of response for all Alexa multiroom music groups.

Not to be too harsh, but there is already a separate thread for these issues (which you already posted to). Please don’t hijack this thread for an unrelated topic.

I don’t see this behavior in the US. It’s probably a setting you have. What happens if you create a routine in the Alexa app to change the volume? Does it have the chime?

We’re taking the name from the json (fix for your region) using the accountName key. You can try reloading the component if it doesn’t match.

Wiki.

Hi, interesting question. To add an info: I have this sound as well but only on the echo shows.
But for me it is good. So I know that it is 4 pm and the complete script worked :wink:

Indeed it was the “notification” setting inside the alexa app. I disabled any notifications from the alexa settings, now it is quite again on volume change, and only gives a notification sound on my TTS announce messages.

Please can you specify the exact setting you changed in the Alexa app to disable the sound on volume change? I have the same issue and it only just started occuring recently. I assumed it was a firmware update from Amazon that had caused it, as I haven’t changed any settings recently.

Hi,

I think this is a setting in the echo show
Settings > Sounds > Request sounds.
turn off start request sound and end request sound

It’s not the Start and End Request sounds that cause this. I have had Start Request sound enabled for ages and it’s only just started beeping when adjusting the volume. To be sure, I turned this off and it still produces a beep when adjusting the sound.

Does anyone have code example to put a button to play spotify playlist? Is it possible to have it play shuffle? I do have spotify premium.

I have the same issue. It’s occurring since a few days. Doesn’t the problem occur with others?

I have the 2FA authentication enabled but twice in the last 2 weeks I have had to enter captcha to reauthorize.

This worked previously for months without issue. Has something changed? Any ideas?

Since i updated to 2021.4 my TTS and announcements don’t work anymore.
For example

  - data:
      data:
        type: tts
      message: Test
      target:
      - media_player.echo_ABC    
    service: notify.alexa_media

or

  - service: notify.alexa_media
    data:
      target:
      - media_player.echo_ABC
      data:
        type: announce
      message: Test

are getting the error


2021-04-08 19:43:09 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140134788301488] 'NoneType' object has no attribute 'async_create_task'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 264, in service_handler
    await script_entity.async_turn_on(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 375, in async_turn_on
    await coro
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 392, in _async_run
    return await self.script.async_run(variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1195, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 341, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 359, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 559, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/notify/__init__.py", line 160, in _async_notify_message_service
    await self.async_send_message(**kwargs)
  File "/config/custom_components/alexa_media/notify.py", line 292, in async_send_message
    await asyncio.gather(*tasks)
  File "/config/custom_components/alexa_media/helpers.py", line 157, in _catch_login_errors
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 1216, in async_send_tts
    self.hass.async_create_task(
AttributeError: 'NoneType' object has no attribute 'async_create_task'

After i reinstalled the integration, it works now

1 Like

Unfortunately I was wrong. The setting did not have any effect. I disabled any sounds from the alexa app, but anyways the sound keeps triggering on volume changes.

It was probably a firmware update by amazon that does not offer a customer setting to turn it off?

@membersound The volume change “beep” is indeed a recent change by Amazon to all Echo devices (at least to all the 3rd gen devices). It’s one thing to do it when pressing the physical buttons on the device or generically asking Alexa to change to a specific volume; however, to now do it during user created routines where one might have multiple volume changes??? Horrendously annoying! There’s an open issue on the Amazon forum that someone already created. I’ve added my displeasure comment to it, and I suggest others do the same. Hopefully if enough people yap about how stupid an idea this was to implement, the proverbial squeaky wheel will get some grease!

3 Likes

Is there a way to contact all Alexa devices seen by HA?

service: notify.alexa_media
data:
  target:
    - ##is there a way to select all here?##
  message: Test message to Alexa devices. 
  data: 
    type: tts

Create a group “alexa_whole_house” and send message to group.