Actionable Notifications via Alexa Media Player

Here is my garage doors open for more than 5 minutes in Node Red. I have both Alexa and IOS with ignore/snoonze/close as options. The key the the event_id in the JSON. I’m more visual, so use Node Red.

[{"id":"138b94e2.68149b","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"e1e54ca0.45be","type":"server-events","z":"138b94e2.68149b","name":"IOS Events","server":"2a12269e.94634a","event_type":"ios.notification_action_fired","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":170,"y":500,"wires":[["7e82f67a.b71128"]]},{"id":"7e82f67a.b71128","type":"switch","z":"138b94e2.68149b","name":"Action Coordinator","property":"payload.event.categoryName","propertyType":"msg","rules":[{"t":"eq","v":"MEGGARAGE","vt":"str"},{"t":"eq","v":"PAULGARAGE","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":350,"y":500,"wires":[["6debfc90.79f8f4"],["58136003.9a3bf"]]},{"id":"549aed98.a596d4","type":"api-call-service","z":"138b94e2.68149b","name":"CLOSE DOOR","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"cover","service":"close_cover","entityId":"cover.megs_garage_door","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":780,"y":520,"wires":[[]]},{"id":"6debfc90.79f8f4","type":"switch","z":"138b94e2.68149b","name":"MEG","property":"payload.event.actionName","propertyType":"msg","rules":[{"t":"eq","v":"IGNORE","vt":"str"},{"t":"eq","v":"SNOOZE","vt":"str"},{"t":"eq","v":"CLOSE","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":530,"y":500,"wires":[[],["1d1cb649.be5b2a"],["549aed98.a596d4"]]},{"id":"1d1cb649.be5b2a","type":"delay","z":"138b94e2.68149b","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":760,"y":480,"wires":[["ad98bbd9.200068"]]},{"id":"f5de430a.5c852","type":"api-call-service","z":"138b94e2.68149b","name":"Notify Paul","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_paul_xs","entityId":"","data":"{\"title\":\"Garage Alert\",\"message\":\"Megs Garage Door Open for 5 Minutes \",\"data\":{\"push\":{\"badge\":5,\"category\":\"MEGGARAGE\"}}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1120,"y":220,"wires":[[]]},{"id":"a1acc493.3ade48","type":"server-state-changed","z":"138b94e2.68149b","name":"Megs Garage Opened","server":"2a12269e.94634a","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"cover.megs_garage_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"open","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":230,"y":180,"wires":[["9da1a79a.84ae98"],[]]},{"id":"f11c634a.ec812","type":"api-call-service","z":"138b94e2.68149b","name":"Alexa Actionable Notification - Garage Door OPEN","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"","data":"{\"text\":\"Meg's Garage Door is still open. Would you like me to close it?\",\"event_id\":\"actionable_notification_megs_garage\",\"alexa_device\":\"media_player.kitchen\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1040,"y":160,"wires":[[]]},{"id":"9da1a79a.84ae98","type":"delay","z":"138b94e2.68149b","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":180,"wires":[["1ed00ae5.bd2085"]]},{"id":"1ed00ae5.bd2085","type":"api-current-state","z":"138b94e2.68149b","name":"Still Open?","server":"2a12269e.94634a","version":1,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"cover.megs_garage_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":660,"y":180,"wires":[["f11c634a.ec812","f5de430a.5c852"],[]]},{"id":"4f528d98.f77024","type":"comment","z":"138b94e2.68149b","name":"Garage Doors","info":"","x":180,"y":120,"wires":[]},{"id":"16e50c8f.b86133","type":"api-call-service","z":"138b94e2.68149b","name":"Notify Paul","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_paul_xs","entityId":"","data":"{\"title\":\"Garage Alert\",\"message\":\"Pauls Garage Door Open for 5 Minutes \",\"data\":{\"push\":{\"badge\":5,\"category\":\"PAULGARAGE\"}}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1260,"y":380,"wires":[[]]},{"id":"557a3c1a.45a964","type":"server-state-changed","z":"138b94e2.68149b","name":"Paul's Garage Door Opened","server":"2a12269e.94634a","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"cover.pauls_garage_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"open","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":240,"y":340,"wires":[["5e64ddcf.2eaf64"],[]]},{"id":"ec58375f.a1f3e8","type":"api-call-service","z":"138b94e2.68149b","name":"Alexa Actionable Notification - Garage Door OPEN","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"","data":"{\"text\":\"Paul's Garage Door is still open. Would you like me to close it?\",\"event_id\":\"actionable_notification_pauls_garage\",\"alexa_device\":\"media_player.kitchen\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1160,"y":320,"wires":[[]]},{"id":"5e64ddcf.2eaf64","type":"delay","z":"138b94e2.68149b","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":340,"wires":[["a2952221.b08e5"]]},{"id":"a2952221.b08e5","type":"api-current-state","z":"138b94e2.68149b","name":"Still Open?","server":"2a12269e.94634a","version":1,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"cover.pauls_garage_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":740,"y":340,"wires":[["ec58375f.a1f3e8","16e50c8f.b86133"],[]]},{"id":"3bd7d18f.10c88e","type":"api-call-service","z":"138b94e2.68149b","name":"Garage Door - Close","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"cover","service":"close_cover","entityId":"cover.megs_garage_door","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1010,"y":700,"wires":[[]]},{"id":"d3718494.930598","type":"switch","z":"138b94e2.68149b","name":"MEG Response","property":"payload.event.event_response","propertyType":"msg","rules":[{"t":"eq","v":"ResponseYes","vt":"str"},{"t":"eq","v":"ResponseNo","vt":"str"},{"t":"eq","v":"ResponseNone","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":690,"y":700,"wires":[["3bd7d18f.10c88e"],[],["b50c8762.8b1a68"]]},{"id":"71402534.5ac86c","type":"switch","z":"138b94e2.68149b","name":"Notification Check","property":"payload.event.event_id","propertyType":"msg","rules":[{"t":"eq","v":"actionable_notification_megs_garage","vt":"str"},{"t":"eq","v":"actionable_notification_pauls_garage","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":700,"wires":[["d3718494.930598"],["d1b2ca4.d0eec38"]]},{"id":"2db4231f.ddf34c","type":"server-events","z":"138b94e2.68149b","name":"Alexa Notification Response","server":"2a12269e.94634a","event_type":"alexa_actionable_notification","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":230,"y":700,"wires":[["71402534.5ac86c"]]},{"id":"d1b2ca4.d0eec38","type":"switch","z":"138b94e2.68149b","name":"Paul Response","property":"payload.event.event_response","propertyType":"msg","rules":[{"t":"eq","v":"ResponseYes","vt":"str"},{"t":"eq","v":"ResponseNo","vt":"str"},{"t":"eq","v":"ResponseNone","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":690,"y":760,"wires":[["bc3a1739.6dd788"],[],["f4f2d0ee.14b9f"]]},{"id":"bc3a1739.6dd788","type":"api-call-service","z":"138b94e2.68149b","name":"Garage Door - Close","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"cover","service":"close_cover","entityId":"cover.pauls_garage_door","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1010,"y":760,"wires":[[]]},{"id":"359fcfa5.020f4","type":"api-current-state","z":"138b94e2.68149b","name":"Still Open?","server":"2a12269e.94634a","version":1,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"cover.pauls_garage_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1180,"y":820,"wires":[["1ae53584.8875da"],[]]},{"id":"1ae53584.8875da","type":"api-call-service","z":"138b94e2.68149b","name":"Alexa Actionable Notification - Garage Door OPEN","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"","data":"{\"text\":\"Paul's Garage Door is still open. Would you like me to close it?\",\"event_id\":\"actionable_notification_pauls_garage\",\"alexa_device\":\"media_player.kitchen\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1480,"y":820,"wires":[[]]},{"id":"32d6563c.26a0ea","type":"api-current-state","z":"138b94e2.68149b","name":"Still Open?","server":"2a12269e.94634a","version":1,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"cover.megs_garage_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1080,"y":660,"wires":[["36fac03e.5c746"],[]]},{"id":"36fac03e.5c746","type":"api-call-service","z":"138b94e2.68149b","name":"Alexa Actionable Notification - Garage Door OPEN","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"script","service":"activate_alexa_actionable_notification","entityId":"","data":"{\"text\":\"Meg's Garage Door is still open. Would you like me to close it?\",\"event_id\":\"actionable_notification_megs_garage\",\"alexa_device\":\"media_player.kitchen\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1440,"y":660,"wires":[[]]},{"id":"b50c8762.8b1a68","type":"delay","z":"138b94e2.68149b","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":910,"y":660,"wires":[["32d6563c.26a0ea"]]},{"id":"f4f2d0ee.14b9f","type":"delay","z":"138b94e2.68149b","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":970,"y":820,"wires":[["359fcfa5.020f4"]]},{"id":"ad98bbd9.200068","type":"api-current-state","z":"138b94e2.68149b","name":"Still Open?","server":"2a12269e.94634a","version":1,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"cover.megs_garage_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":950,"y":480,"wires":[["f5de430a.5c852"],[]]},{"id":"58136003.9a3bf","type":"switch","z":"138b94e2.68149b","name":"Paul","property":"payload.event.actionName","propertyType":"msg","rules":[{"t":"eq","v":"IGNORE","vt":"str"},{"t":"eq","v":"SNOOZE","vt":"str"},{"t":"eq","v":"CLOSE","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":520,"y":580,"wires":[[],["9af13821.da01b8"],["d258644f.d53218"]]},{"id":"d258644f.d53218","type":"api-call-service","z":"138b94e2.68149b","name":"CLOSE DOOR","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"cover","service":"close_cover","entityId":"cover.pauls_garage_door","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":770,"y":620,"wires":[[]]},{"id":"9af13821.da01b8","type":"delay","z":"138b94e2.68149b","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":750,"y":580,"wires":[["431d6418.251aac"]]},{"id":"431d6418.251aac","type":"api-current-state","z":"138b94e2.68149b","name":"Still Open?","server":"2a12269e.94634a","version":1,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"cover.pauls_garage_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":940,"y":580,"wires":[["16e50c8f.b86133"],[]]},{"id":"2a12269e.94634a","type":"server","z":"","name":"Hingham Home","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

I have followed the steps, using Nabu Casa. I get the following error. Any idea why?

Thx

> There was a problem with the requested skill’s response

[ERROR] TypeError: not all arguments converted during string formatting
Traceback (most recent call last):
  File "/var/task/ask_sdk_core/skill_builder.py", line 111, in wrapper
    request_envelope=request_envelope, context=context)
  File "/var/task/ask_sdk_core/skill.py", line 207, in invoke
    handler_input=handler_input)
  File "/var/task/ask_sdk_runtime/dispatch.py", line 131, in dispatch
    return exception_handler.handle(handler_input, e)
  File "/var/task/lambda_function.py", line 358, in handle
    home_assistant_object = HomeAssistant()
  File "/var/task/lambda_function.py", line 57, in __init__
    self.get_ha_state()
  File "/var/task/lambda_function.py", line 99, in get_ha_state
    errors = self._check_response_errors(response)
  File "/var/task/lambda_function.py", line 72, in _check_response_errors
    logger.error("404 Error", response.data)
  File "/var/lang/lib/python3.7/logging/__init__.py", line 1407, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/var/lang/lib/python3.7/logging/__init__.py", line 1514, in _log
    self.handle(record)
  File "/var/lang/lib/python3.7/logging/__init__.py", line 1524, in handle
    self.callHandlers(record)
  File "/var/lang/lib/python3.7/logging/__init__.py", line 1586, in callHandlers
    hdlr.handle(record)
  File "/var/lang/lib/python3.7/logging/__init__.py", line 894, in handle
    self.emit(record)
  File "/var/runtime/bootstrap.py", line 243, in emit
    msg = self.format(record)
  File "/var/lang/lib/python3.7/logging/__init__.py", line 869, in format
    return fmt.format(record)
  File "/var/lang/lib/python3.7/logging/__init__.py", line 608, in format
    record.message = record.getMessage()
  File "/var/lang/lib/python3.7/logging/__init__.py", line 369, in getMessage
    msg = msg % self.args

Just found the Error if someone has the same issue :slight_smile:

You need to define the input_text before activating the skill.

All seems to work (I get the question and I reply and get OK response) but I don’t get event back from the skill. Any idea why events are not triggering?

Is this skill supported any longer?
The OP, Keaton Taylor, hasn’t posted anything since May 17, and his github page has 22 open issues since last May.

Lets hope that he will continue to support it

Has anyone had any success getting Alexa actionable notifications to work with groups of echo devices?

I now have 13 Echo Flex devices dotted around the house and would like to have the actionable notification play on them all for certain events but so far can only get it to work on individual devices.

Has anyone got this working with a Facebook Portal / Portal Mini?

I’ve just gotten a basic notification working across Somers echos and a Show 5 in both US and Australian English.

@keatontaylor has mentioned in a GitHub issue that some devices just work differently. I assume there is an internal language conflict.

I’ve tried setting the portal device Language between US and AU. Alexa is set to US English, with very limited language options available which don’t include AU

I did find the lambda logs as mentioned in the issue but at the same time it not sure I did :stuck_out_tongue:

Cheers

Linton

Does anyone know if there was ever a more efficient way to run actionable notifications on multiple devices?

Sounds like the issue I had. This worked for me and hope it helps.

Do not delete what is is already there ( which I did : Failed !! )
Drag and drop locale_en_us.json and save.

My lambda_function.py for Nabu Casa

Good luck, hope you get it working. :+1:

This works perfectly thank you, I used to have music start playing if I get home and no one else is home but it got a little annoying if you didn’t always want it or are on the phone etc…

But now Alexa: “Welcome home. Would you like me to put on some music?”
Sooo much better.

Trying to setup the account linking and running into an issue with the Web Authorization URI and Access Token URI. I am using my nabu casa address and it is giving me two errors:

  • property path “$.accountLinkingRequest.accessTokenURL” does not match the regular expression: “^https://.*$”.,String instance with value "

  • property path “$.accountLinkingRequest.authorizationUrl” does not match the regular expression: “^https.*$”.

Is it not possible to use the nabu casa address?

image

This is all i get when trying to test actionable notifications in the developer console what am i doing wrong everything is linked correctly

Would it be possible to replicate it to work with Google home?

I had the same problem when I deleted some of the tokens. I solved this by re-linking to the skill in the Alexa skill development environment.

Would it be possible to know the Alexa voice profile that answered the question, in order to differentiate the automations?
For example, Alexa asks “Do you want to turn on the heat?”
If dad says Yes, then turn on the heat.
If the child answers Yes, do nothing as he does not have permission to decide.

1 Like

Technically this is possible but the accuracy in my own testing has always been hit or miss so I ended up disabling it. There is some documentation in the wiki related to this.

The issue wasn’t that it would recognize the wrong person but often it wouldn’t recognize anyone.

Alexa gave me the same response but the skill and the scripts all still function. I essentially just ignored that and haven’t had any issues. Have you tried setting one up to see if it works?

I just found out (after 2 day of testing and recreating the skill…) that when Kids mode is enabled on your echo device… the skill doesn’t work.
Maybe add this to the FAQ

I bungled my actionable notifications just over a week ago. I spent a lot of time off and on diagnosing the issue which was: a couple of echo’s worked but the remaining 5 did not. Yesterday I finally figured out the problem: I had renamed devices in Alexa but neglected to update the static entity list in group.echos. Today I lashed together a value_template (based on code gleaned from other sources) that searches the domain media_players for the attribute last_called and if true returns the entity_id so I now no longer have to worry about maintaining group.echos!

sensor:
  - platform: template
    sensors:
      last_alexa:
        value_template: >
            {%- for group in states.media_player | groupby('state') -%}
              {%- for entity in group.list -%}
                {%- if is_state_attr(entity.entity_id, 'last_called', true) %}
                  {{ entity.entity_id }}
                {%- endif -%}
              {%- endfor -%}
            {%- endfor -%}