Actionable Notifications via Alexa Media Player

Thanks. Yeah I do saw the BIG CLAIMER by @keatontaylor, just wasn’t sure what was the problem, perhaps can add in some description on the failure encountered so we are aware what is likely encounter?

Train your voice from an Echo Device - Yeah, I tested this by asking Echo, “Who am I” from various distance and background noise, got high success for this , I suppose this is not and issue.

Use longer Utterances for the Intents - Thanks for the tips, let me try this, what you said make sense and “Yes”, “No” may not sufficient to match the voice.

What i found strange is that i can say “Alexa, who am i” from various distances and get 100% recognition.
And even with longer Utterances it’s 50% with the custom skill. But the magic happens all on Amazons side, so there is probably no change for us to improve this really.

What else comes to my mind is that Amazon maybe mostly rely on the "Alexa, " phrase to match a voice as this is the only constant and can easy be compared. But with “notifications” Alexa is never said and Amazon has to compare words with some kind of calculated pattern.

Yeah you are right, indeed with “Alexa, who am I” the recognition is fantastic and based on your tips, I tested with longer utterances, it still have very horrible recognition.

So I deleted the voice profile and train from the Amazon devices as suggested @florian.ec. I did a quick test of 3/5 with simple “yes”, “do that please” with various distance and background noise so far I can see the improvement now.

@florian.ec I think your tips should be pinned as a troubleshooting steps and it could be a solution.

Thank you so much for making this integration! I was wondering if anyone got this working with the alert component?

Currently, the only actionable notification I want Alexa to run is when my garage door stays open for a set time. I’ve got that set up through the alert function to send to my phones with actionable notifications there but I want to send the same notification to Alexa with the same actions alongside it.

Thanks for your help!

Hey there, i’m looking for advice on adding my own responses if anyone else has done this yet? The example on the wiki is using the response word as the input select, but i want my response to start one of 4 timers that are their own entity based on the response given.
I’ve added the slots to the skill and alexa recognises when i respond with one of the answer, but i’m struggling how to indicate the response in the automation?

Edit - Got it working, if anyone is interested my code is the below for one of the timers:

- alias: Washing Mode Spin
  trigger:
    platform: event
    event_type: alexa_actionable_notification
    event_data:
      event_id: actionable_notification_washing_mode
      event_response: 'Spin'
  action:
    - service: timer.start
      entity_id: timer.spin
type or paste code here

my trigger works but i cant get her to shut the light off am i missing something

Got it to work

@keatontaylor

I can’t get the additional responses working. I have set up the Custom slot and that’s working fine. However when I use the example automation on the wiki for my TV just as you have done it fails with the following error in the log file.

I can change the source on the media player manually in HA. I think its something to do with the template trigger.event.data.even_response but I can’t figure out what I’m doing wrong?

Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data[‘data_template’]

automation:
  - alias: When the TV turns on, ask what you want to watch 
    trigger:
      platform: state
      entity_id: switch.lounge_tv
      to: 'on'
    action:
      - service: script.activate_alexa_actionable_notification
        data_template:
          text: 'I noticed the TV was turned on, what would you like to play?'
          event_id: 'actionable_notification_lounge_tv'
          alexa_device: 'media_player.lounge'

  - alias: TV turned on and user wants Plex
    trigger:
      platform: event
      event_type: alexa_actionable_notification
      event_data:
        event_id: actionable_notification_lounge_tv
    action:
      - service: media_player.select_source
        entity_id: media_player.samsung_tv_remote
        data_template:
          source: "{{ trigger.event.data.event_response }}"

Figured it out - its because I was using the Automation editor which doesn’t support data_template in Editor mode. I had to switch to YAML mode to enter the last part

action:
      - service: media_player.select_source
        entity_id: media_player.samsung_tv_remote
        data_template:
          source: "{{ trigger.event.data.event_response }}"

This has been working a treat for quite a few months now, but this morning whenever the automations execute Alexa announces “There was a problem with the requested skills response”. Is anybody else experiencing this?

Update: Just for fun I decided to reboot HA to see if I had to do another captcha authentication, no reauthentication was required, but now Alexa is working properly again. So reboot HA solved the issue.

I have followed the install instructions but when I enable the app in the Alexa app, it never pulls up Home
Assistant to login. Home Assistant will sometime report a failed login from an Amazon ip. I am using duckdns. This is what I put in lambda_function.py.

HOME_ASSISTANT_URL                = 'https://####.duckdns.org:8123'       
VERIFY_SSL                        = False                              
TOKEN                             = '########-####-####-####-############'         

What do you think I am doing wrong

@Trevor - I have been getting this since upgrading to a later version of the alexa media player skill. Unfortunately for me, reboot hasn’t solved my issue.

I had this working really well, but then I updated… :frowning:

mm not good. wish I could help more. Maybe create an issue on github. https://github.com/keatontaylor/alexa-actions/issues

Anyone has setup an automation that resets itself every X minutes, meaning that it will have this behavior:

Turn lights ON,
30 minutes later.

Alexa: Are you there? (will turn lights off if no response)
Me: Yes
Alexa: OK

30 minutes later.
Alexa: Are you there? (will turn lights off if no response)
Me: Yes
Alexa: OK

30 minutes later.
Alexa: Are you there? (will turn lights off if no response)
No reponse
Alexa: Turns lights off

Silly question but is it possible to a random query? I want to have it randomly select a different phrase but use the same routine and automations.

Yes I have a similar setup, why do you ask?

Would you please share your automation/code? Thank you

No problem - there are 3 automations involved - 1 turns the light on (based on motion detection but could be anything), 2 is the timer that waits for no motion and asks if its ok to turn the light off and 3 processes the response. My automations don’t trigger ever 30 minutes but if no motion is detected for 20 minutes and I’m at home, awake and the light is in fact already on, then Alexa asks if I want to turn it off. It only turns off on a positive or no response.

- id: '1588239233827'
  alias: Turn Lounge Light ON
  description: '1) When Front Door Opens

    2) If Movement Is Detected'
  trigger:
  - entity_id: sensor.zone_020
    platform: state
    to: Violated
  - entity_id: sensor.zone_001
    platform: state
    to: Violated
  - device_id: e8db50d587944e87b4befa493bb1b0bd
    domain: binary_sensor
    entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_da5a4d04_ias_zone
    platform: device
    type: motion
  condition:
  - condition: state
    entity_id: light.lounge_light_switch_225
    state: 'off'
  action:
  - data: {}
    entity_id: light.lounge_light_switch_225
    service: light.turn_on

- id: '1590252907779'
  alias: Ask if it OK to turn Lounge Light Off
  description: If No Motion In Lounge for 20 minutes ask if its ok to turn the light
    off
  trigger:
  - entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_da5a4d04_occupancy
    for: 0:20
    platform: state
    to: 'off'
  condition:
  - condition: not
    conditions:
    - condition: state
      entity_id: input_boolean.bedtime
      state: 'on'
    - condition: state
      entity_id: alarm_control_panel.area_001
      state: armed_away
    - condition: state
      entity_id: light.lounge_light_switch_225
      state: 'off'
  action:
  - data:
      alexa_device: media_player.trevor_s_echo
      event_id: actionable_notification_no_motion_in_lounge
      text: Would you like me to turn the Lounge Light Off?
    service: script.activate_alexa_actionable_notification
  - data: {}
    entity_id: counter.possibly_multiple_occupants
    service: counter.decrement

- id: '1590253320087'
  alias: 'Turn Lounge Light OFF '
  description: 1)If YES Or "No Response"
  trigger:
  - event_data:
      event_id: actionable_notification_no_motion_in_lounge
      event_response_type: ResponseYes
    event_type: alexa_actionable_notification
    platform: event
  - event_data:
      event_id: actionable_notification_no_motion_in_lounge
      event_response_type: ResponseNone
    event_type: alexa_actionable_notification
    platform: event
  condition: []
  action:
  - data: {}
    entity_id: light.lounge_light_switch_225
    service: light.turn_off
2 Likes

Can someone confirm that this setup needs HA to have access to the outside world?
I think it does as suggested by these instructions?

**Configuring account linking**
.
.
.
.
4. Under Authorization URI provide your home assistant URL followed by /auth/authorize (Example: https://myhomeassistant.com/auth/authorize
5. Under Access Token URI provide your home assistant URL followed by /auth/token (Example: https://myhomeassistant.com/auth/token)

I think that you could use a template and the random funcion:

' {{ ["Option 1", "Option 2","Option 3"] | random }} ' 

Disabling and re-enabling the skill allowed me to reconnect it to my account. It resolved the issue but now I have another issue with the alexa media player captcha request appearing after each command to Alexa…