Configuration: Notification Component - alandtse/alexa_media_player GitHub Wiki

Minimum Version: 1.2.0

The notify component deprecates media_player.alexa_tts and conforms to Home Assistant notifications.

Configuration

No configuration is required!

However, you may choose to change the name by modifying the name variable.

notify:
  - platform: alexa_media
    name: alexa_media

Functionality

The component supports four 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. Canned_TTS can be sent as of 2.8.0 (e.g., alexa.cannedtts.speak.curatedtts-category-goodmorning/alexa.cannedtts.speak.curatedtts-random)
  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.
  4. Dropin Notification - This will send a Mobile Push to any Alexa Apps linked to the target Alexa device where clicking will take you to the drop in menu.

How to Use

Use the notify.alexa_media service.

The following args are supported in the Service Data:

  • "message:" - The message to send. (Required) For TTS, this can be the cannedTtsStringId discovered through Sequence Discovery.
  • "title:" - The title to display. Only works for Announce and Mobile Push. (Optional)
  • "data:type:" - The type of notification. [tts, announce, push] (Required)
  • "data:method:" - For Announce only, controls whether the announcement should be (1) spoken or (2) spoken and shown. [speak, all] (Optional). NOTE: The show option appears to have been removed by Amazon.
  • "target:" - The target Alexa devices. This can be the Friendly Name, Serial Number, entity_id, or Home Assistant Group. **(Required) ** Warning: Mobile Push using groups will result in a push from every Echo device to every Alexa App.

Use the notify.alexa_media + alexa_id service.

This is used the same as the notify.alexa_media service but automatically fills in the target.

TTS

message: test
data: 
  type: tts
target: 
  - group.alexa
  - "Guest Room"
  - media_player.kitchen
  - serialNumber

Announce

title: "My title for Echo show"
message: test
data: 
  method: all
  type: announce
target: 
  - "Guest Room"
  - media_player.kitchen
  - serialNumber

When using Announce SSML markup is also supported (with the exception of the audio tag), for example:

{
"message":"<amazon:effect name='whispered'>I am whispering this.</amazon:effect>",
"data":{"type":"announce", "method":"speak"},
"target":["Guest Room", "media_player.kitchen", "serialNumber"]
}

Notes:

  1. When using SSML it is best to have method as "speak", rather than "show" or "all", as otherwise the SSML markup will be displayed on devices with a screen;
  2. "Announce" method requires having "Communications" enabled under Alexa app device configuration. "Drop In" is not needed, but "Communications" must be active. If "Communications" is not enabled, Home Assistant logs won't give any error while calling notify.alexa_media service, but Alexa remains quiet.
  3. If "Do Not Disturb" mode is enabled, Home Assistant logs won't give any error while calling notify.alexa_media service, but Alexa remains quiet.

Mobile Push

This sends a mobile push to any Alexa apps associated with the target device.

title: "My title"
message: test
data: 
  type: push
target: 
  - "Guest Room"

Dropin Notification

Minimum Version: 2.10.0

This sends a mobile push notification that will open the Drop In menu when clicked. This is the same as the Drop In Notification option in the routines builder. NOTE: Title is hardcoded as Routines.

message: test
data: 
  type: dropin_notification
target: 
  - "Guest Room"

Automation Example

This is an example of how to use this service in an automation using the "announce" type (script usage would be similar):

- alias: Notification Test Weekly TTS
  initial_state: 'on'
  trigger:
    platform: time
    at: '12:15:00'
  condition:
    condition: time
    weekday:
      - wed
  action:
    - service: notify.alexa_media
      data:
        target: 
          - media_player.computer_room_dot
          - media_player.kitchen_dot
        #title: "My title for Echo show"
        data:
          type: announce
          #method: all
        message: "This is a weekly test of the announcing system."

(Be sure to use 'data_template:' when templating.)

Echo Show Output Example

Echo Show Notification Photo

TTS automation announcement example.

Here is an example of what a TTS announcement would look like when configured in an integration.

image

And the YAML code.

service: notify.alexa_media
data:
  message: The fridge door has been left open
  title: Fridge door is open.
  target: media_player.living_room
  data:
    type: tts

Replacing type: tts with type: announce will play an announcement sound before reading out the messsage.