Actionable Notifications via Alexa Media Player

Further progress…

I put 10 second delays between the actionable notification automations and I finally got everything working correctly.

I had to create two response tests (responseNumeric or responseString) to be able to catch the somewhat random event types generated but it is working now.

I think that proves the “rate limit” theory.

the 10 second delay is workable but not ideal so now I need to start reducing the delay to see how low I can get it and make it still work.

I got the delay down to 5 seconds. Still not great but tolerable.

Thanks @dbrunt for all the help on this!

I ran into an issue during the test in Developer Tools. The Call Service would not trigger by itself. Only after I told the Alexa Device “Alexa, Start Custom Actions” then she would ask me the question.

I’m running into this while building my automations as well.

Is the issue on the Alexa Skill side or on the HA side? Any Help would be appreciated.

Where are you having to add delays???

The only problem I have found is with Alexa Media Player and the notify.alexa_media_last_device it auto-creates. After calling a notify, there is whole re-update of alexa devices and the service notify.alexa_media_last_device goes AWOL for a few seconds. I recently rewrote several automations to do something different than call that service and no hiccups so far.

Have you done something like this to test from HA?
Dev Tools, Events, Listen to events: alexa_actionable_notification
Then in another window, Dev Tools, Services:

service: script.activate_alexa_actionable_notification
data:
  alexa_device: "{{ states('sensor.last_alexa') }}"
  event_id: actionable_notification_response_numeric_test
  text: What time would you like it set for?

If that fails to show in Event Listener then the problem is likely with the configuration/setup of your Alexa skill…

This involves the Alexa side which then contacts HA which provided her the last question that the last service call set in input_text which means the Alexa-to-HA communication is working. If you’re not seeing the response in event listener then the skill is not set up completely correctly, much like finity’s problem. What exactly you’ve done wrong I dunno!

I was able to build out an automation and the response action works. Nothing fired in the listener until i said “Alexa, Start Custom Actions”.

Everything else is working as expected. Alexa is not identifying that execution of an automation or service means to start speaking. It’s as if the trigger for her to speak the text, is me saying “Alexa start custom actions”.

I’ve gone back through all the documentation and files to make sure I didn’t miss an important step.

I even tried waiting up to 5 min to see if she would trigger it without prompt…no luck.

in the subsequent automation actions.

example:

trigger the intial “set the alarm” automation which asks to set the alarm to the currently set input_datetime value.

response “no” which triggers the “do you want me to set it to a different time?” automation.

in that automation the first action is wait 5 seconds then ask the question above.

response “yes” triggers the “for what time?” automation.

in that automation the first action is to wait for 5 seconds then ask the question.

response is either string or numeric (depending on which one Alexa interprets it as) which triggers the “set the alarm” automation.

that automation waits 5 seconds then sets the response value to the input_datetime then sets the alarm to the input_datetime. the last action is telling me the alarm has been set.

I don’t think that sensor is auto-created. I don’t have that specific entity but the “sensor.last_alexa” sensor I’m using I had to create manually.

However, I did check that and it gets set almost instantly to the echo device I spoke to and after that it stays on the correct echo device. So I don’t think that is where the delay is.

I don’t understand how you’re seeing this in the event listener as I don’t when I make a similar invocation of the script…
image

All I see is one event in my listener which is one ofResponseYes|ResponseNo|ResponseNone|ResponseNummeric

Ok, you do need to add delays to allow her time to say what she needs to say otherwise multiple TTS too quickly will cut off the previous one. My waits in between TTS vary from 2 - 10 seconds.

I have seen the TTS interruption thing before but in this case the speech gets completed before I respond and then the next question gets asked before I respond again. So there is no chance for the TTS to get cut off so that’s not what was happening either.

It wasn’t cutting off the previous TTS. It just wasn’t even listening for a response from the last automation. The echo device just went blank (no more listening light ring) and everything stopped.

It made it all the way to the last one out of 4 automations without issues then nothing.

I still think it has to do with some sort of rate limiting thing but I can’t prove that theory.

What’s the easiest way to eliminate Alexa’s “OKAY” after responding to a notification? I want to handle her verbal response myself.

Thanks in advance!

Alexa’s “Okay” is hardcoded in prompts.py as OKAY=“OKAY”…

# Alexa Prompts Language Constants
ERROR_401 = "ERROR_401"
ERROR_404 = "ERROR_404"
ERROR_400 = "ERROR_400"
ERROR_ACOUSTIC = "ERROR_ACOUSTIC"
ERROR_CONFIG = "ERROR_CONFIG"
ERROR_SPECIFIC_DATE = "ERROR_SPECIFIC_DATE"
HELP_MESSAGE = "HELP_MESSAGE"
OKAY = "OKAY"
SELECTED = "SELECTED"
SKILL_NAME = "SKILL_NAME"
STOP_MESSAGE = "STOP_MESSAGE"
WELCOME_MESSAGE = "WELCOME_MESSAGE"

I believe the response is spoken via .response in the numerous instances of this code in lambda_function.py:

        return (
            handler_input.response_builder
                .speak(speak_output)
                .response

Has anyone experienced the AMAZON.YesIntent and AMAZON.NoIntent failing on basic ‘yes’ and ‘no’ responses? They seem to work perfectly for ‘yes please’ and ‘absolutely’ etc. All other intents work as expected.

I follow all the steps of the tutorial, but already in the skill test I get “an error occurred with the requested skill response”. I checked in the code that the request to {HOME_ASSISTANT_URL}/api/events/alexa_actionable_notification. however with tests with postman I noticed that there is no such event in my HA

I just created a topic asking about this.

Is it as simple as removing the speak(speak_output) .response lines for each intent listed?

I have a Polly voice that I use and am hoping to eliminate the “ok” response for continuity

I’m not sure. It could be…
Give it a whirl and let me know!

Turns out, it’s even easier!

here’s the snippet to remove to stop the “OK” reponse

        speak_output: str = self.language_strings[prompts.OKAY]
        self.clear_state()
        return speak_output

Thanks!

Just so others are clear, here is what I did as per @spezzuti:

1 Like