Skip to content

Notification Component

cubilon edited this page Jun 4, 2019 · 19 revisions

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 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).
  2. Announce - This functionality will result in a beep prior to speaking. It can also allow display on Echo Shows/Spots (currently untested). Speech will sync across multiple devices and WHA groups should work.
  3. Mobile Push - This will send a Mobile Push to any Alexa Apps linked to the target Alexa device.

How to Use

Use the notify.alexa_media service.

The following args are supported in the Service Data:

  • "message:" - The message to send. (Required)
  • "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 spoken, displayed, or both. [speak, show, all] (Optional)
  • "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.

The following args are supported in the Service Data:

  • "message:" - The message to send. (Required)
  • "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 spoken, displayed, or both. [speak, show, all] (Optional)

the notify.alexa_media + alexa_id service. automatically fills in the target.

TTS

{
"message":"test",
"data":{"type":"tts"},
"target":["group.alexa", "Guest Room", "media_player.kitchen", "serialNumber"]
}

Announce

{
"message":"test",
"title":"My title for Echo show",
"data":{"type":"announce", "method":"all"},
"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 works by having enabled "Communications" 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.

Mobile Push

{
"message":"test",
"title":"My title",
"data":{"type":"push"},
"target":["Guest Room", "media_player.kitchen", "serialNumber"]
}

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