Actionable Notifications via Alexa Media Player

When setting up account linking for the custom skill, what URL should we use if we’re in Canada?

That error sounds like you don’t have the input_text component enabled. Did you add the input_text to your configuration.yaml as per the instructions?

Best guess I would go with us.

This is fantastic. I’m now trying to add some complexity and I’m running into a problem. Here’s the scenario: If my HVAC system begins to actively heat or cool and a door or window is open, I want to trigger an actionable notification that asks me if I want to turn the HVAC system off. I would like the actionable notification to be sent to all of my Echos because I may be in a different room. To do this with the Alexa Media Player, I use an Alexa Whole House Audio Group and ‘announce’ as the data:type.

The problem is that when I use my WHA group:

alexa_device: 'media_player.wha_echos'

it won’t trigger any of my Echos.

I suspect this is a limitation on Amazon’s end. Is that right?

@NYC, yep it is most certainly a limitation. You actually don’t want the skill launching on all devices at the same time, the issue is that the skill technically operates independently for each device. So the issue would be if you in one room said yes and someone else in another room said no. Both responses would be triggered as events to home assistant and basically the last person to speak would “win”

The current workaround is to setup automations such that it goes one by one to your echo devices and asks.

2 Likes

Wow, just Wow. This is perfect for what I need. Reminding us the garage is open, remind us the electric blankets not on etc etc… But I have got stuck…

@keatontaylor I followed all your instructions to the letter but when I get to the end and ask Alexa to open custom actions, she cant find the skill.
I have added the skill and it linked my account correctly etc… I am using Nabu Casa URL. The only doubt I have is, what URL do I have to select in Client ID for New Zealand?
Any pointers?

Edit: If I test in the developers console using ‘Alexa, Open custom actions’ the console talks back with ‘This is a test of the alexa actions custom skill. Did it work?’ but I still cannot get my Alexa’s to do this…

EDIT 2: OK, fixed my problem, thanks to a pointer off the facebook group. You need to make sure that you set the language in the skill when you create it, to the same as your Alexa devices are set to.
Cheers

Great work! I was wondering if the notification could also be a “real announcement”
with a prior beep before alexa speaks. It always frightens me when she suddenly
starts to talk :scream:.

As I understand the way “Alexa Actions” work it’s not possible
(please correct me If I am wrong) so I thought of a work around with the
SSML audio tag.

Here my Steps:

The Announcement beep mp3 files are available here:
https://developer.amazon.com/alexa/console/avs/previews/resources
look for “Alexa sound library for AVS (v1.2)”.

The mp3 file has to be “Alexa-friendly”, which i thought it would be as i downloaded
the “Alexa” sound library from Amazon. But turns out it was not so you have
to convert it following these steps: https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html#h3_converting_mp3

I host the mp3 file according to this (S3 Storage is working for me):
https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html#hosting-the-audio-files-for-your-skill

Final Step: I put the SSML audio tag in front of my text:

    action:
      - service: script.activate_alexa_actionable_notification
        data_template:
          text: "<audio src='https://YOUR URL TO MP3 FILE'/> The front door has been unlocked for 5 mins, would you like me to lock it?"
          event_id: 'actionable_notification_lock_left_unlocked'
          alexa_device: 'media_player.living_room_echo'

Now alexa beep before speak. But sometimes she doesn’t and I thought of some problem when she is loading the file and try to give some extra time with a break:

 data_template:
   text: "<break time='1s'/> <audio src='https://YOUR URL TO MP3 FILE'/> The front door has been unlocked for 5 mins, would you like me to lock it?"

And now she always beep beep before speak.

3 Likes

My issue fixed itself when I upgraded alexa_media to the latest version :slight_smile:

gents have your alexas started talking faster recently?

you can also use the amazon sound effects library ( https://developer.amazon.com/en-GB/docs/alexa/custom-skills/ask-soundlibrary.html ) and include one of the sounds in your text

please note - you will have to use double quotes for your text and replace the double quotes in the audio tag with single quotes

example script:

script: 
  alexa_custom_action_ask_a_question:
    alias: Alexa -- Custom Action - Ask Question
    sequence:
      - service: script.activate_alexa_actionable_notification
        data_template:
          text: "<audio src='soundbank://soundlibrary/alarms/beeps_and_bloops/buzz_01'/>Is this a silly question?"
          event_id: 'event_alexa_ask_a_question'
          alexa_device: '{{states.sensor.last_alexa.state}}'

1 Like

Hi Everyone,
I have had a strange response to my first automation.

- alias: Georges blanket still off at 7.30pm.
  trigger:
    platform: time
    # Military time format. This trigger will fire at 7.30pm
    at: "19:30:00"

  action:
    - service: script.activate_alexa_actionable_notification
      data_template:
        text: 'I just noticed Georges blanket is off, would you like me to turn it on?'
        event_id: 'actionable_notification_georges_blanket'
        alexa_device: 'media_player.family_echo_dot'
   
- alias: Yes response to actionable_notification_georges_blanket question
  trigger:
    platform: event
    event_type: alexa_actionable_notification
    event_data:
      event_id: actionable_notification_georges_blanket
      event_response: ResponseYes

  action:
    - service: switch.turn_on
      entity_id: switch.georges_blanket

Alexa triggers and asks if we would like to turn on the electric blanket, we say yes. Then she says something like ‘you have triggered hello world’

Hmm any ideas anyone? I thought that I had set the action correctly to turn the switch on?

I’ve got a strange one that I’d like to see if anyone else has encountered or what I’ve done wrong.

I followed all the steps and it built & deployed successfully.

I went to enable the new skill and it wouldn’t work.

So I deleted everything and started over and got to the same point but I’m not yet in a position to test it.

But the question is I see in the skill detail section of the Alexa app it says the invocation name is still “change me”. I double checked that I did change it and even re-built/re-deployed the skill and it still says the same thing.

ex2

ex

Like I said I haven’t tested it since I’m not home so I don’t know which words will work.

I’m just also wondering if that’s why it failed the first time I tried too.

Any idea why it wouldn’t change in the deployed skill?

Did she say “You just triggered…”? This would be the IntentReflectorHandler acording to my custom skills lambda_function.py.
If so i think there could be something wrong with the YesIntent and therefore your automation “Yes response to actionable_notification_georges_blanket question” is never triggered

I would follow https://github.com/keatontaylor/alexa-actions/wiki/CustomSkill again and check every step.

Could also be this language problem mentioned in the wiki:

Note: Some issues may happen if the language in the developer console is different from the language on echo devices. A new language could be added in the developer console, then the intents could be added to the skill. Each language setup represents a clean slate for the “build” stage; the code stays the same across all languages. The HelloWorldIntent needs to be added for each language, as this maps to an intent in the code.

I just tried it and the invocation name also changes in the skill details for me.
So there is definitely something wrong with your skill.

Hey! There’s no reason to get personal! :wink: :laughing:

But yeah, I figured that but I just can’t see where I screwed it up.

I’m still hoping it works OK anyway.

some positive side effect when writing in a different language, you make somebody laugh without knowing (or angry… it depends, iam glad that i wrote two sentences). :stuck_out_tongue_winking_eye:

I had some Ideas to try:

  • in the developer console under “Distribution” change some Description and check if this is updated (you have to hit the “Save and continue” Button below and Re-Build)
  • you could also check the JSON Editor (last item under Invocation, Intents, Slot Types) if the invocationName is here changed.
  • and you could check the language from the skill matches your alexa’s

hope that helps isolate the problem

I am assuming to update to the new release we just need to update the code on the alexa skill? Sorry I didn’t see this covered on the wiki?

at first I couldn’t link the skill either. my problem was this:

6. Under Client ID provide:

* `https://pitangui.amazon.com/`  if you are in US
* `https://layla.amazon.com/`  if you are in EU
* `https://layla.amazon.co.uk/`  if you are in the UK (You may still need to use the EU URL if things do not work)
* `https://alexa.amazon.co.jp/`  if you are in JP and AU

even though Im not in the US, for me it worked when i selected US.

I have no problem using audio tags to play mp3 files with Alexa Actionable notifications.

When testing I found that the text submitted to script.activate_alexa_actionable_notification should not be surrounded by quotes. In other words,

text: <audio src=‘https://etc.mp3’/>

works, but fails if surrounded by quotes.

My endpoints are on S3. Further errors will occur if the mp3 was not converted as described in https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html#audio.

You can create a second implementation of the skill and remove the .ask(’’) from the return of class LaunchRequestHandler. The second skill just plays the text it gets from HA without waiting for a reply. Clone script.activate_alexa_actionable_notification, change the script name, and put in the new skill ID. Now you can play any SSML (of course, I haven’t tested every possible tag).

Let me know of problems or better solutions.

1 Like

this could be a better tts solution cause announce always have this beep and tts itself has no natural speak output (like pause between words).