Actionable Notifications via Alexa Media Player

This is exactly what I’ve been dreaming about, but I’ve got one big problem: this is a google house. Is there ANY way to have google home do something similar? Can GH be forced to broadcast and listen/react to a response?

1 Like

I’m still working out a bed time routine but this is awesome.

- alias: Bed Time
  description: ''
  trigger:
  - at: '20:00:00'
    platform: time
  condition: []
  action:
  - data:
      alexa_device: media_player.kevin_s_echo_dot
      event_id: actionable_notification_bed_time
      text: <amazon:emotion name='disappointed' intensity='high'>It is 8:00 PM, would
        you like me to start getting ready for bed?</amazon:emotion>
    service: script.activate_alexa_actionable_notification
- alias: Bed Time - Yes
  description: ''
  trigger:
  - event_data:
      event_id: actionable_notification_bed_time
      event_response: ResponseYes
    event_type: alexa_actionable_notification
    platform: event
  condition: []
  action:
  - data: {}
    entity_id: light.living_room_light_s_zha_group_0x0004
    service: light.turn_off

@keatontaylor, if you would like to add these as examples on github I am cool with that.

@keatontaylor I’m currently on version 0.103.6 but does this require the latest version of home assistant?

I’ve skipped the acc linking as my duckdns url uses the the port number at the end. And I’ve also generated the long lived token from hass which I’ve pasted. Anything else I can do? Halp

I’m getting this in log:

Error while executing automation automation.test. Service not found for call_service at pos 1: Unable to find service input_text/set_value

@keatontaylor

This works for me sort of

My automation to trigger alexa to say my lights are on would I like to turn them off doesnt work. The automation runs and runs the script but alexa stays silent.

If I say “Alexa, Open custom Actions” it then says what my automation should of said. So I can trigger it manually by saying this to Alexa but she wont say it via the automation.

There are no errors in my logs and someone else on github has the same request open with no answer to it so im not the only one.

Can anyone assist?

Sorted it - Alexa media player needed upgrading.

As I already had it I missed that step and went straight onto configuring this platform instead.

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

1 Like

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.

5 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 Create new page · keatontaylor/alexa-actions Wiki · GitHub 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.