Actionable Notifications via Alexa Media Player

Changed? Like OMG totally different! I made it all they way to ( :exploding_head:Painful :exploding_head: ) the very last step… Tested everything in the AWS Console using the Discovery. All works to that point and responded back with what I believe is everything she has :grin:. But as I said, and you noted Documentation was extremely outdated. So… last step, account linking in the Alexa App (Enable To Use)… :hot_face:, I get the login screen for HA, enter username and password, and authy security token… and I get
“Unable to link Home Assistant with Alexa. We are experiencing a problem connecting with the skill to link your account. You can try linking your account again by visiting the Home Assistant Skill Page.”


Researching everything I can find leads me to believe it is directly related to the Amazon LWA OAuth server because I had the errors in my log forever, but I have no idea how to fix that…

@dbrunt
I am convinced the only way to resolve is start over… My question to you, if you recall… When you fist installed Amazon Media, did you start at HACS? All of the documentation I found is at various levels and nothing seems current. Could that be why I am having the errors?

Well, the first thing I installed was the Home Assistant Alexa custom skill integration. This is what populates your HA devices and scripts/scenes into Alexa. Next was Alexa Media Player via HACS which creates your Alexa Echo devices as media players in HA. They are two totally separate processes and are unrelated to each other. Then you need the custom skill Alexa Actionable Notifications which requires a working Alexa Media Player integration (HACS). Without re-reading the posts, I thought you were having trouble with the Home Assistant Alexa custom skill integration not giving you your HA entities in Alexa?

Hello everyone

Has anyone tried it in Spanish?

I did the whole process in both languages (Spanish and English) to try, I also did it with English, adding Spanish… but it doesn’t work, alexa tells me “there was an error managing the response on this device”

someone has the solution?

Thank you so much

@dbrunt
Long time no hear (Update). I finally got the Home Skill linked from the Alexa App… Well, I have been troubleshooting since - it broke my Actionable Notifications. Now I am getting authentication errors like you would not believe :cry: I am trying everything I can think of… So far, I have completely deleted HA and built from the ground up (4th time now) Somewhere in the Actionable Notifications is an authentication section. I just don’t recall how to get back there. Wish you well, wish me luck, I will need it.Let you know how things go… Hopefully soon, as you can imagine, I am consumed with trying to get it back on line.

Everyone following this educational thread. I finally have everything solved. Amazon is a strange creature… Even stranger than trying to figure the syntax of HA :smirk:. Until I very slowly followed every step, I did not realize how many keys, F2A, Two-Step, and passwords were actually active. I for one know it is all necessary, because everywhere you lurk someone is trying to disrupt or hack your existence. In authenticating one of the skills work disconnect the other and drive you nuts! The fix: In the app, disable both, Open the Developers console page Amazon Sign-In Review the steps in edit mode updating keys, long time passwords, etc. Then re-link them in the app after saving changes. It was a long and challenging journey. BUT…
Thanks to @dbrunt I can now use both amazon skills to the very fullest ability! I home to see more exciting abilities posted in the forum.
Mine is working!!! What do others do with this exciting feature?

1 Like

Yay! Glad you finally figured it out!

hello,

is it not possible to listen to the “ResponseNone” Event?

i tried it with this code

platform: event
event_type: alexa_actionable_notification
event_data:
  event_id: actionable_notification_firetv_kueche_switch_off
  event_response_type: ResponseNone

but the automation get never triggered when alexa get no answer from me.

here is the automation for the question

service: script.activate_alexa_actionable_notification
data_template:
  text: Hallo, Soll ich die Shield ausschalten?
  event_id: actionable_notification_firetv_kueche_switch_off
  alexa_device: media_player.echo_show_kueche

and in the script is everything correct, the ResponseYes works well.

I have the same problem, ResponseNone never seems to work. ResponseYes and ResponseNo work fine, but looking at the trace it seems like the automation just stops if no response is given and it doesn’t proceed with the ResponseNone action.

I’m using Sonos speakers with Alexa as the voice assistant. Could this be a limitation of using Sonos, or should it be able to work correctly?

Thanks.

I get “There was a problem with the requested skill’s response” almost constantly after not having any issues for a few years. I’ve found that sometimes rebooting works, but only sometimes.

Does anyone have any suggestions on how to resolve the “There was a problem with the requested skills response” issue?

It is difficult to troubleshoot with out the entire automation file.

One of the last updates changed the way the integration was configured. it is no longer in the configuration.yaml and you must you set up F2A within the configuration and your Amazon Account.

I did some digging in my AWS lambda function logs and every failure has the same error:

HTTPSConnectionPool(host='xxxxxxxxxx.ui.nabu.casa', port=443): Max retries exceeded with url: /api/alexa (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

Researching that error indicates it may be a proxy error. I’m not seeing any errors in my local HA logs - makes me thing this may be an issue with the Nabu Casa cloud integration?

@gjtaylor72 Boy do I ever feel your pain. I don’t use nabucasa; however I had the same issue. It was the F2A. The difficult part in my opinion is there is not one single source to get your fix. Not being sure what you have already done or what stage you are at… I will share the links and actions that got me operational…

At this stage. I noted all the passwords etc. and removed the integration, including the following from configuration.yaml

#alexa_media:
#  accounts:
#  - email: !secret amazon_user
#    password: !secret amazon_password
#    url: amazon.com
#    debug: true

At that time, after a restart, I went back to the integration page clicking + ADD INTEGRATION and searched for Alexa Media Player. At that point I got the configuration form… However, mine, and I think you may have the same issue, would not authenticate… So I opened a trouble ticket on GitHub.

I think after you review the thread you may find your answer or at least enough to have a better understanding… Good luck, let me know if you get there :slight_smile:

Sorry looks like I posted in the wrong thread, this has nothing to do with the Alexa Media Player integration, that is working flawlessly and always has.

My issue is with an Amazon Alexa Custom Skill failing when attempting to execute an intent script via nabucasa.

Hi! Been following this thread and was able to set up the Alexa custom skill required for Actionable Notifications but I guess the issue I’m having is in the home assistant portion with the automations. You mentioned above that the user’s response is contained in the event.data.event_response. I currently have 3 automations setup. For argument’s sake I’ll call the automations “trigger”, “action1”, “action2”:

  1. Trigger - this is the automation that triggers the script and in my case I use a motion sensor to trigger Alexa to ask me the first question.

  2. Action1 - this automation is triggered by 1st automation and has Alexa asks me a second question if I responded yes in previous automation.

  3. Action2 - this third automation is where the action should actually take place. My possible answers to “Action1” are neither numeric nor a yes or no so I’ve set this up as event_response_type: ResponseString and I wanted to know how I can use the value of event.data.event_response (my response from “Action1”) as field in the action section of this automation to actually trigger the response I want.

Not sure of this makes sense, hopefully someone can understand :smiley:

As far as I know that is not a valid event_response_type:.
The documentations specifies the types…

6. ResponseSelection is the closest you’re going to get. I’ve looked at it but I’ve not tried configuring it. From what I recall it’s not for the faint of heart!

I’m waiting for ResponseDate/ResponseTime to get added but not holding my breath!

Thank you so much for your response! I will be taking a closer look going at it ResponseSelection route and will report back if I am successful. This thing has so much potential I think with some slight tweaking it can be even more powerful.

@dbrunt

First I’ll apologize for two things…

The first is for tagging you directly but you seem to be the most likely person to help me based on your recent posting history here.

Second is that I’ll apologize for the questions I’ll ask and for how possibly complex this might be. :laughing:

so on to my issue…

I’ve been using this integration for a while and haven’t really had any problems.

I saw your discussion above about the “ResponseNumeric” and it provided a possible means to do something I’ve been recently wanting to figure out how to do. Namely I want to be able to tell Alexa to set my phone alarm to a variable based on my voice input.

I previously had this set up to just set the phone to a pre-defined value set up thru an input_datetime (I’ll call it ) and that worked as expected. I even had the actionable notifications set so that it only set the alarm after a confirmation question.

All of that worked.

Then I added the “ResponseNumeric” into the mix and just can’t seem to get it working. I’ve been trying for a couple of days and I can’t see where I’m going wrong.

I’ll start out with some pseudo-code based on my (much longer) real code and I’ll indicate what works and where it’s failing.

  - alias: Alarm Ask to Set Manually
    action:
      - if: sensor.my_mobile_app_next_alarm != "unavailable"
        then: "There is already an alarm set on your phone" => STOP # <-- this step works
        else: actionable_notification_alarm_set => "Would you like me to set your alarm for...<currently set value>?" # <-- this step works
          possible responses:
            ResponseYes
            ResponseNone
            ResponseNo
        
  - alias: Alarm Set From Response
    event_id: actionable_notification_alarm_set
    action:
      choose:
        - "ResponseYes" => "OK, your alarm has been set to ...<currently set value>" => STOP # <-- this step works
        - "ResponseNone" => "OK, your alarm has been set to ...<currently set value>" => STOP # <-- this step works 
        - "ResponseNo" => actionable_notification_alarm_set_time_variable => "Would you like me to set your alarm for a different time?" # <-- this step works
            possible responses:
              ResponseNo
              ResponseNone
              ResponseYes
  
  - alias: Alarm Set Variable Time From Response
    event_id: actionable_notification_alarm_set_time_variable
    action:
      choose:
	    - "ResponseNo" => "OK, no alarm has been set" => STOP # <-- this step works
            - "ResponseNone" => "OK, no alarm has been set" => STOP # <-- this step works
            - "ResponseYes" => actionable_notification_alarm_set_time_for => "What time would you like it set for?" # <-- this step works
               possible responses:
                 ResponseNumeric
                 ResponseNone

## this is where it breaks down
                
  - alias: Alarm Change Time Set From Response
    event_id: actionable_notification_alarm_set_time_for
    action:
      choose:
        - "ResponseNumeric" => set_datetime to...<numeric reponse> => "OK, your alarm has been set to...<numeric response>" => STOP
        - "ResponseNone" => "OK, no alarm has been set" => STOP

When Alexa asks “What time would you like it set for?” the echo device stops listening (indicated by the light ring turning off).

No matter what the response is that I provide nothing happens (sort of…)

BUT…If I wait a bit (even up two or three minutes) and I start the sequence again (“Alexa, set the alarm on my phone”) the device starts to make its first question (“Would you like me to set your alarm for…?”) but it gets interrupted part way thru by the device saying “OK, no alarm has been set” followed by my phone alarm getting set to the then the device telling me that my alarm has been set (" OK, your alarm has been set to …").

Obviously there should be no other steps of setting the alarm until it registers the numeric response.

and it shouldn’t tell me no alarm is set at the end unless it receives a ResponseNone. But there are no responses registered at all after that.

And it definitely shouldn’t do both. (say no alarm is set and then set an alarm at the same time)

Then everything resets and I can again go thru the above sequences. At least till I get to the part that it asks what time I want the alarm set for. Then the same thing happens.

I’m really at a loss.

It almost seems as if there is only a certain number of chained actionable notifications the system can process before it gets lost.

watching the actionable notification events I see that everything gets registered correctly until the question about “what time?” then everything stops.

I’ll post the code but I knew this was already a really info heavy post and I didn’t want to add any more to it.

Anyone have any insight into this?

Code to follow…

automation:
  - alias: MA Alarm Ask to Set Manually
    id: ma_alarm_ask_to_set_manually
    trigger:
      - platform: state
        entity_id: input_boolean.ma_alarm_set
        to: 'on'
    condition:
      - condition: state
        entity_id: person.me
        state: 'home'
    action:
      - delay: "00:00:02"
      - service: input_boolean.turn_off
        entity_id: input_boolean.ma_alarm_set
      - if:
          not:
            - condition: state
              entity_id: sensor.my_mobile_app_next_alarm
              state: "unavailable"
        then:
          - service: media_player.volume_set
            data:
              entity_id: "{{ states('sensor.last_alexa') }}" 
              volume_level: 0.5
          - service: notify.alexa_media
            data:
              target:
                - "{{ states('sensor.last_alexa') }}" 
              data:
                type: tts 
              message: "There is already an alarm set on your phone"
        else:
          - service: media_player.volume_set
            data:
              entity_id: "{{ states('sensor.last_alexa') }}"
              volume_level: 0.5
          - service: script.activate_alexa_actionable_notification
            data:
              alexa_device: "{{ states('sensor.last_alexa') }}" 
              event_id: actionable_notification_alarm_set
              text: >
                {% set hour_twentyfour = states('input_datetime.ma_alarm_set_time').split(':')[0]| int(0) %}
                {% set hour_twelve = hour_twentyfour if hour_twentyfour < 13 else hour_twentyfour - 12 %}
                {% set minutes = states('input_datetime.ma_alarm_set_time').split(':')[1] %}
                {% set minutes_formatted = minutes if minutes != '00' else '' %}
                {% set am_pm = 'am' if hour_twentyfour < 12 else 'pm' %}
                  Would you like me to set your alarm for {{hour_twelve}} {{minutes_formatted}} {{am_pm}}?
        
  - alias: MA Alarm Set From Response
    id: ma_alarm_set_from_response
    trigger:
      - platform: event
        event_type: alexa_actionable_notification
        event_data:
          event_id: actionable_notification_alarm_set
    condition:
      - condition: state
        entity_id: person.me
        state: 'home'
      - condition: state
        entity_id: sensor.my_mobile_app_next_alarm
        state: "unavailable"
    action:
      choose:
        - conditions:
            - '{{ trigger.event.data.event_response_type == "ResponseYes" or trigger.event.data.event_response_type == "ResponseNone" }}'
          sequence:
            - service: script.mobile_app_notification_command_set_alarm
            - wait_for_trigger:
                - platform: state
                  entity_id: sensor.my_mobile_app_next_alarm
                  from: "unavailable"
            - service: notify.alexa_media
              data:
                target:
                  - "{{ states('sensor.last_alexa') }}" 
                data:
                  type: tts 
                message: >
                  {% set hour_twentyfour = states('input_datetime.ma_alarm_set_time').split(':')[0]| int(0) %}
                  {% set hour_twelve = hour_twentyfour if hour_twentyfour < 13 else hour_twentyfour - 12 %}
                  {% set minutes = states('input_datetime.ma_alarm_set_time').split(':')[1] %}
                  {% set minutes_formatted = minutes if minutes != '00' else '' %}
                  {% set am_pm = 'am' if hour_twentyfour < 12 else 'pm' %}
                    OK, your alarm has been set to {{hour_twelve}} {{minutes_formatted}} {{am_pm}}
        - conditions:
            - '{{ trigger.event.data.event_response_type == "ResponseNo" }}'
          sequence:
            - service: script.activate_alexa_actionable_notification
              data:
                alexa_device: "{{ states('sensor.last_alexa') }}"
                event_id: actionable_notification_alarm_set_time_variable
                text: Would you like me to set your alarm for a different time?
  
  - alias: MA Alarm Set Variable Time From Response
    id: ma_alarm_set_variable_time_from_response
    trigger:
      - platform: event
        event_type: alexa_actionable_notification
        event_data:
          event_id: actionable_notification_alarm_set_time_variable
    condition:
      - condition: state
        entity_id: person.me
        state: 'home'
      - condition: state
        entity_id: sensor.my_mobile_app_next_alarm
        state: "unavailable"
    action:
      choose:
        - conditions:
            - '{{ trigger.event.data.event_response_type == "ResponseNo" or trigger.event.data.event_response_type == "ResponseNone" }}'
          sequence:
            - service: notify.alexa_media
              data:
                target:
                  - "{{ states('sensor.last_alexa') }}" 
                data:
                  type: tts 
                message: "OK, no alarm has been set"
        - conditions:
            - '{{ trigger.event.data.event_response_type == "ResponseYes" }}'
          sequence:
            - service: script.activate_alexa_actionable_notification
              data:
                alexa_device: "{{ states('sensor.last_alexa') }}"
                event_id: actionable_notification_alarm_set_time_for
                text: What time would you like it set for?
        
                
  - alias: MA Alarm Change Time Set From Response
    id: ma_alarm_change_time_set_from_response
    trigger:
      - platform: event
        event_type: alexa_actionable_notification
        event_data:
          event_id: actionable_notification_alarm_set_time_for
    condition:
      - condition: state
        entity_id: person.me
        state: 'home'
      - condition: state
        entity_id: sensor.my_mobile_app_next_alarm
        state: "unavailable"
    action:
      choose:
        - conditions:
            - '{{ trigger.event.data.event_response_type == "ResponseNumeric" }}'
          sequence:
            - service: input_datetime.set_datetime
              data:
                time: >-
                  {{ (((( trigger.event.data.event_response | int / 100 ) - (trigger.event.data.event_response | int / 100) | int) * 1.66667 + ( trigger.event.data.event_response | int / 100) | int) * 3600) | timestamp_custom("%H:%M:%S", local=False) }}
              target:
                entity_id: input_datetime.ma_alarm_set_time
            - delay: '00:00:02'
            - service: script.mobile_app_notification_command_set_alarm
            - wait_for_trigger:
                - platform: state
                  entity_id: sensor.my_mobile_app_next_alarm
                  from: "unavailable"
            - service: notify.alexa_media
              data:
                target:
                  - "{{ states('sensor.last_alexa') }}"
                data:
                  type: tts 
                message: >
                  {% set hour_twentyfour = states('input_datetime.ma_alarm_set_time').split(':')[0]| int(0) %}
                  {% set hour_twelve = hour_twentyfour if hour_twentyfour < 13 else hour_twentyfour - 12 %}
                  {% set minutes = states('input_datetime.ma_alarm_set_time').split(':')[1] %}
                  {% set minutes_formatted = minutes if minutes != '00' else '' %}
                  {% set am_pm = 'am' if hour_twentyfour < 12 else 'pm' %}
                    OK, your alarm has been set to {{hour_twelve}} {{minutes_formatted}} {{am_pm}}
        - conditions:
            - '{{ trigger.event.data.event_response_type == "ResponseNone" }}'
          sequence:
            - service: notify.alexa_media
              data:
                target:
                  - "{{ states('sensor.last_alexa') }}"
                data:
                  type: tts 
                message: "OK, no alarm has been set"