Echo Devices (Alexa) as Media Player - Testers Needed

Thanks a lot!!!

:+1:
How to change Polly voice:

{ "message": "<lang xml:lang='it-IT'> <voice name='Giorgio'> Ho fatto un salto a Roccacannuccia </voice> </lang>",
    "data": {
        "type": "announce",
        "method": "speak"
    },
    "target": ["media_player.echo_salotto"]
}
2 Likes

Haven’t updated in a while and just proceeded to do so and now have ‘do not disturb, ‘repeat’ and ‘shuffle’ switches in my Alexa App for each Alexa Device in my Home.

  1. Are these really useful? How do people normally implement these?
  2. Is there a way to get rid of them.

Updated “(Alexa) as Media Player” to latest version, also updated Hassio to 0.97.1.
Works perfectly!
Running on a Docker.

Using NodeRed and Alex Media Player to play random messages in my flows. Took me a while to figure out how to update the nodes after using the previous version of Alexa media player, but now the items below work a treat, hope it helps someone.

image

Replace the text on lines 10 to 15 with your own messages.
On line 21 change to your own media player device

Change Service to your own media player device (make sure its the same as you put into line 21 in the function node above).

Below is the NodeRed nodes to copy / paste into your flows.

[
    {
        "id": "f68b51c6.9a1a1",
        "type": "api-call-service",
        "z": "40ebc6d9.fa1168",
        "name": "New Multiple setup -- alexa voice",
        "server": "62d7bb2f.196044",
        "version": 1,
        "service_domain": "notify",
        "service": "alexa_media_annaka_s_echo_dot",
        "entityId": "",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "payload",
        "output_location_type": "msg",
        "mustacheAltTags": false,
        "x": 960,
        "y": 1240,
        "wires": [
            []
        ]
    },
    {
        "id": "772300e.754d7",
        "type": "function",
        "z": "40ebc6d9.fa1168",
        "name": "NEW Alexa random messages",
        "func": "msg.payload = {};\nmsg.payload.domain = {};\nmsg.payload.service = {};\nmsg.payload.data = {};\nmsg.payload.data.data = {};\nmsg.payload.data.data.type = {};\nmsg.payload.data.message = {};\n\nvar myArray = [\n  \"this is test one \",\n  \"this is test two\",\n  \"this is test three\",\n  \"this is test four\",\n  \"this is test five, \",\n  \"hey you guessed it, this is test six\"\n];\n\nvar randomItem = myArray[Math.floor(Math.random()*myArray.length)];\n\nmsg.payload.domain = \"notify\"\nmsg.payload.service = \"alexa_media_annaka_s_echo_dot\"\nmsg.payload.data.data.type = \"announce\"\nmsg.payload.data.message = randomItem\n\n\n\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 670,
        "y": 1240,
        "wires": [
            [
                "f68b51c6.9a1a1"
            ]
        ]
    },
    {
        "id": "193820b6.1ddc5f",
        "type": "inject",
        "z": "40ebc6d9.fa1168",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 460,
        "y": 1160,
        "wires": [
            [
                "772300e.754d7"
            ]
        ]
    },
    {
        "id": "62d7bb2f.196044",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "legacy": false,
        "hassio": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true
    }
]
2 Likes

I am recently just playing around with running hassio in my Docker environment (currently running a non-hassio HA) and when I set up the alexa_media component I get a tone of these errors in the log:

2019-08-11 19:10:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 243, in async_update_ha_state
    "No entity id specified for entity {}".format(self.name)
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Livingroom Dot shuffle switch
2019-08-11 19:10:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 243, in async_update_ha_state
    "No entity id specified for entity {}".format(self.name)
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Computer Room Dot shuffle switch
2019-08-11 19:10:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 243, in async_update_ha_state
    "No entity id specified for entity {}".format(self.name)
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Computer Room Dot do not disturb switch
2019-08-11 19:10:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 243, in async_update_ha_state
    "No entity id specified for entity {}".format(self.name)
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Big Room Dot repeat switch
2019-08-11 19:10:19 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 243, in async_update_ha_state
    "No entity id specified for entity {}".format(self.name)
homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Kitchen Dot repeat switch

Since it’s a brand new install i’m running hassio v97.1 and just installed the latest alexa_media via HACS.

The Captcha went fine and I have all of my echo devices displayed. I haven’t fully tested any TTS or anything else yet.

I haven’t updated my “production” non-hassio HA yet so I don’t know if I would get those same errors there or not.

Any idea’s on what’s going on with those errors?

I think it’s a known bug/will be fixed in next version. They just needed to get a version out that worked with .97.

1 Like

Does anyone know how to fix this issue I’m getting. In my custom components it thinks that my 1.4.1 is older than the update version of 1.3.1…

alexa_customcard

We deprecated custom_updater in favor of HACS. We’re deleting the json file in the next release so it won’t give you any version information after that.

1 Like

@alandtse downloaded the latest repository and put in my custom components folder. Still dont seem to have media_player.alexa_tts.

Any ideas ?

Thanks

1 Like

Thanks for this! I’ve been trying to get this going in Node Red.

media_player.alexa_tts is no longer used.

From a previous post:

This was deprecated in 1.3.0. Please use notify .

1 Like

Doh !

That would explain it then … so as an idiots guide @ghstudio how would i change the below to do the TTS

scripts.yaml

  ## Send Speech to Alexa
  audio_notify:
    sequence: 
      - service: media_player.alexa_tts
        data_template: 
          entity_id: media_player.charlotte_s_bedroom,media_player.dressing_room,media_player.hot_tub,media_player.katie_s_bedroom,media_player.kitchen,media_player.master_bedroom,media_player.office
          message: "{{ tts_msg }}"

And below an example automation that calls the old TTS

#Go to Away mode if noone is in
- alias: 'Away Mode'
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.people_home
    from: 'on'
    to: 'off'
    for:
      minutes: 10
  action:
    - service: script.away_mode
    - service: notify.all
      data:
        message: 'Away Mode activated'
    - service: script.audio_notify
      data_template:
        tts_msg: "Away mode activated"

Thanks

Hi.

This one addon that I want to get working that I can’t, so many things i want to be able to do.

I have installed the Alexa Media Player via the Community Integrations and that all appears OK and i can see the devices as expected.For some reason they sit as Standby until they get used and then go to unavailable.

I have tried Text to speak but nothing comes out but I can see files being created in the TTS folder on my PI running Hassio.

Spent soooo long on this and can’t find a way out of this issue.

System Health

|arch|armv7l|
|dev|false|
|docker|true|
|hassio|true|
|os_name|Linux|
|python_version|3.7.4|
|timezone|Europe/London|
|version|0.97.2|
|virtualenv|false|


Log Details (ERROR)
Tue Aug 13 2019 14:02:12 GMT+0100 (British Summer Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/alexa/state_report.py", line 45, in async_entity_state_listener
    hass, smart_home_config, alexa_changed_entity
  File "/usr/src/homeassistant/homeassistant/components/alexa/state_report.py", line 68, in async_send_changereport_message
    properties = list(alexa_entity.serialize_properties())
  File "/usr/src/homeassistant/homeassistant/components/alexa/entities.py", line 181, in serialize_properties
    for prop in interface.serialize_properties():
  File "/usr/src/homeassistant/homeassistant/components/alexa/capabilities.py", line 105, in serialize_properties
    prop_value = self.get_property(prop_name)
  File "/usr/src/homeassistant/homeassistant/components/alexa/capabilities.py", line 446, in get_property
    return {"value": float(temp), "scale": API_TEMP_UNITS[unit]}
ValueError: could not convert string to float: 'unavailable'

> - service: notify.alexa_media
>       data:
>        data:
>          type: announce
>        target: 
>          - media_player.charlotte_s_bedroom
>        message: 'Yo Remco.. The washing machine is finished. Get off the couch.'

Or without a beep at the start of the message:

> - service: notify.alexa_media
>       data:
>        data:
>          type: tts
>        target: 
>          - media_player.charlotte_s_bedroom
>        message: 'Yo Remco.. The washing machine is finished. Get off the couch.'

Thanks @ghstudio / @Holdestmade, will sift through all my scripts and automations and make the changes.

That error you posted is unrelated to this custom component. That is the built in component. As for using this custom component, please review the wiki that is linked in the first post. You need to use the notify services for TTS due to limitations of the Amazon API. You can’t use standard HA TTS.

@ghstudio / @Holdestmade made the changes and functionally works as i would expect, however there appears to be a couple of bugs so not sure if i am doing something in error.

  1. If i put in multiple targets it appears not to play on them all, it randomly misses some out.

  2. If i try to fix the issue above by using media_player.whole_house_audio which is my alexa group then nothing is played anywhere. Though i have tested this group using spotify connect and that works as expected.

Thanks

This is part of one of mine with working multiple targets.

- alias: Notify if any garage doors left open for 10 minutes
  trigger:
    - platform: state
      entity_id: binary_sensor.garage_door
      to: 'on'
      for:
        minutes: 10
  action:
    - service: notify.alexa_media
      data:
        target:
          - media_player.living_room
          - media_player.office
        data:
          type: announce
        message: The garage door has been left open

I’m not sure you can use Alexa groups, my ‘everywhere’ group does show up as a media player but can’t send TTS to it

This is in the wiki:

Functionality

The component supports three types of notifications as supported by the Alexa App:

  1. TTS - This is the older media_player.alexa_tts functionality. Alexa will speak using Alexa’s Simon says skill and will not sync between devices. This does not work with an Alexa Whole House Audio group (WHA).
    This does allow messages to phone apps which the Announce function does not.
  2. Announce - This functionality will result in a beep prior to speaking. It can also allow display on Echo Shows/Spots (currently untested). WHA groups are supported. Unfortunately, it does not appear to sync across devices.
  3. Mobile Push - This will send a Mobile Push to any Alexa Apps linked to the target Alexa device.

@Montie, thank you I appreciate the code. It enabled me to get my TTS working again on Alexa. However, using node-red Alexa “reads” all of the text (“amazon effect name whispered I am…”). Not sure how to make that work, would be cool!