keatontaylor / alexa-actions

A README and associated code to get actionable notifications setup for Alexa devices.
GNU General Public License v3.0
399 stars 187 forks source link

Get rid of okay confirmation #147

Closed elmar-hinz closed 1 year ago

elmar-hinz commented 1 year ago

Feature request

The dialogue should be:

The dialogue is:

Wanted:

An option to suppress the automatic "okay" confirmation, if you want to handle the confirmation yourself. Something like this:

  - service: script.activate_alexa_actionable_notification
    data:
      text: Yes or no?
      suppress_confirmation: True
      event_id: hello_world
      alexa_device: media_player.<Your Media Player>
elmar-hinz commented 1 year ago

Technical considerations

The OK seems to be worded in language_strings.json. Maybe it could be a workaround to temporarily set the value to an empty string.

Better, if ask_sdk_core has an API to control this. I guess the behaviour is originating there. OK is not actively called within lambda_function.py at least.

DEADSEC-SECURITY commented 1 year ago

This is fixed under the branch. Pending testing @elmar-hinz. If you could also give it a try and let me know if you find bugs

DEADSEC-SECURITY commented 1 year ago

Im fixing bugs though so might not work yet

elmar-hinz commented 1 year ago

One concern per commit. Please just don't mix bug fixing and features into one commit. It's difficult to track.

DEADSEC-SECURITY commented 1 year ago

Done fixed. Did some refactoring too cuz it was hard debugging the original code. In my example I call the service like this. image

My script looks like this:

alias: Alexa Home Voice Ask
description: Activates an actionable notification on a specific echo device
fields:
  text:
    description: The text you would like alexa to speak.
    example: What would you like the thermostat set to?
  event_id:
    description: Correlation ID for event responses
    example: ask_for_temperature
  suppress_confirmation:
    description: If it should supress the Okay default response confirmation
    example: true
  alexa_device:
    description: Alexa device you want to trigger
    example: media_player.bedroom_echo
sequence:
  - service: input_text.set_value
    data:
      entity_id: input_text.alexa_actionable_notification
      value: >-
        {"text": "{{ text }}", "suppress_confirmation": "{{
        suppress_confirmation }}", "event": "{{ event_id }}"}
  - service: media_player.play_media
    data:
      entity_id: "{{ alexa_device }}"
      media_content_type: skill
      media_content_id: amzn1.ask.skill.87fb0d7f-dd0b-4bd1-92ef-3f59187374ae
mode: single
DEADSEC-SECURITY commented 1 year ago

Now just need to update docs to reflect this change and should be good to go.

If you could test @elmar-hinz I would appreciate.

DEADSEC-SECURITY commented 1 year ago

We could also have the option to send a custom response message as well as be able to suppress it

DEADSEC-SECURITY commented 1 year ago

@elmar-hinz

elmar-hinz commented 1 year ago

A am gonne check it out this evening.

elmar-hinz commented 1 year ago

I started further testing now. The first problem to solve was how to import a branch as a skill. Would the import use the master branch or the default branch of my fork?

After making the development branch the default branch, the import did call the development branch as source for the import. That simplifies testing.

Screenshot 2023-01-07 at 19 01 42

elmar-hinz commented 1 year ago

@DEADSEC-SECURITY I didn't get the branch running. It doesn't create a response any more. There is no JSON output on the right.

Screenshot 2023-01-07 at 19 36 37

I did call the default launch request:

Screenshot 2023-01-07 at 19 40 06

I will replace lambda_function.py with the version of master, to see if it is running again.

elmar-hinz commented 1 year ago

With the code of the master branch it is working again. This confirms a bug. Did you put too many changes into one pull request? ;-)

Screenshot 2023-01-07 at 19 44 17

DEADSEC-SECURITY commented 1 year ago

I did do some refactoring but in my alexa it was working properly.

DEADSEC-SECURITY commented 1 year ago

@elmar-hinz

DEADSEC-SECURITY commented 1 year ago

Can you share cloudwatch logs @elmar-hinz