Notify Alexa devices using Alexa Media Player

Hello Home Assistant forums!

This blueprint is one that I made to slightly simplify the process of sending notifications to Alexa devices while using Alexa Media Player, in a way inspired by Grumblezz’s Notify Mobile Companion Devices script. While the notify service provided by AMP isn’t super complex, I wasn’t aware of some of its functionality (namely the Announce notification type) and wanted a GUI-driven way to quickly set those parameters.

Getting started

First, you need to install Alexa Media Player and make sure it’s working.

Once you’ve done that, click the below button to add the blueprint to your install, then create a script from it. Make sure to give it a memorable name!

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Alternatively, if you want to see the source before importing it, here is a link to the blueprint on GitHub.

Using the script

The YAML reference is as follows:

  • message - The message that you want to be read out using TTS. If type is announce, you can use Amazon’s flavor of SSML markup in your message.
  • type - One of three values, described below.
    • tts - 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.
    • announce - This functionality will result in a beep prior to speaking. It can also allow display on Echo Shows/Spots. Whole House Audio groups are supported. It does not appear to sync across devices.
    • push - This will send a mobile push notification to any Alexa apps linked to the target Alexa device.
  • title (optional) - The title to display. Only works with announce and push notifications.
  • devices (optional) - The device(s) to direct the notifications to. These take device IDs, and translates them to entity IDs. If this is not supplied, all Alexa devices will be notified.

Despite what the UI says, there is no response variable support.


Hopefully some of you find this useful! It’s my first blueprint, but I think it has value.

UPDATES

2024.03.7

Fixed a small issue where it would try to include a title when none is supplied, leading to spurious log file messages. Thanks @masterpete!

2024.03.29

Added a description for when you’re first creating a script using this blueprint. Thanks @Tockra and nothra on Github!

10 Likes

Hi, thanks for your solution.
Since last update log is showing:

2024-02-22 12:07:30.200 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'title' is undefined when rendering '{{title}}'

I searched for {{title}} in my yamls and only found this here. Do you know about it?

Ah! Sorry, didn’t see this post before.

Just did some testing and it seems like that message gets logged when you don’t have a title set. That’s definitely a bug, not sure why that’s happening…

Just fixed the issue and pushed an update to it! As I don’t think blueprints have any sort of automatic update capability, you’ll need to go to Settings → Automations & Scenes → Blueprints and re-import the blueprint like so:

image

I don’t think restarting HA from here is a necessary step, but it couldn’t hurt.

1 Like

just updated - we will see if it works.

THANKS

After I successfully did my alexa media player integration I installed your blueprint and wanted to test it.
The blueprint for Alexa notify has no input:

There are no configurable inputs during that initial setup; all of the configuration comes when you’re actually using the created script in automations. Once created, the options described in the OP should all show up as expected.

Apologies for not making that clearer; I’d meant to add some text to that screen to explain it but forgot. Whoops…

As an update, I just updated the script with a little introduction! It should be a bit clearer that you need to make the script first before you have access to the configuration options. Thanks again for the suggestion!

1 Like

Just found your blueprint and testing it right now, am i right when i say the it send a mobile push but (even if the alexa app is open) it does not read the message?

Is this blueprint still the way to go If I want notifications through my alexa speakers?
At least this is one prominent search result of my google search.

I’d say yes, though I am a bit biased on this front :slight_smile: Ultimately this is just a wrapper around Alexa Media Player so strictly speaking this isn’t needed, but it’s nice to have.

The major uncertainty with this as of late, I’d say, is the weird spot that Alexa Media Player itself is in. AMP apparently isn’t actively maintained anymore outside of community contributed patches, which was demonstrated by the v4.12.13 memory leak and how long it took for an update to drop that fixed it once the cause was isolated. There was a discussion about bringing AMP out of HACS into HA Core on the HA Discord, but I don’t know if or when that’s going to happen.

You don’t need a blueprint tbh. Just use this template:

data:
  data:
    type: tts
  message: >-
    Hello, this is a test!
  target:
    - media_player.echo_show
action: notify.alexa_media

Unfortunately the notify alexa script no longer seems to work.

If i manually create an automation and search for “notify” and add each of them manually it works 100% (see screenshot).

However when using your script to select them I never receive any of the notifications. The syntax or the action doesn’t seems to execute properly.

ie: this is the config of the automation when I create each notification manually:

alias: Notification
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.dome_leak_sensor_water_leak_detected
conditions: []
actions:
  - action: notify.mobile_app_patricks_iphone
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_bathroom
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_kitchen_hub
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_living_room_bar
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_entrance
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_garage_echo_office
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_garage_echo_arcade
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_guest_room_downstairs
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_guest_room_upstairs
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_master_bathroom
    metadata: {}
    data:
      title: Warning!
      message: "A water leak has been detected in the bathroom downstairs. "
  - action: notify.alexa_media_home_echo_laundry_room
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
  - action: notify.alexa_media_home_echo_master_bedroom
    metadata: {}
    data:
      message: "A water leak has been detected in the bathroom downstairs. "
      title: Warning!
      type: push
mode: single

Apologies for the delay (I evidently need to update my HA forum notification settings). I’m testing it out on my end right now and it seems to still be working just fine, so I’m confused what the issue might be…

Can you try running the script via the Actions tab in the Developer Tools, and see if anything happens there? If it doesn’t work there, shoot me the YAML and I’ll see if I can replicate the issue.