confirmable_notification.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. blueprint:
  2. name: Confirmable Notification
  3. description: >-
  4. A script that sends an actionable notification with a confirmation before
  5. running the specified action.
  6. domain: script
  7. source_url: https://github.com/home-assistant/core/blob/master/homeassistant/components/script/blueprints/confirmable_notification.yaml
  8. input:
  9. notify_device:
  10. name: Device to notify
  11. description: Device needs to run the official Home Assistant app to receive notifications.
  12. selector:
  13. device:
  14. integration: mobile_app
  15. title:
  16. name: "Title"
  17. description: "The title of the button shown in the notification."
  18. default: ""
  19. selector:
  20. text:
  21. message:
  22. name: "Message"
  23. description: "The message body"
  24. selector:
  25. text:
  26. confirm_text:
  27. name: "Confirmation Text"
  28. description: "Text to show on the confirmation button"
  29. default: "Confirm"
  30. selector:
  31. text:
  32. confirm_action:
  33. name: "Confirmation Action"
  34. description: "Action to run when notification is confirmed"
  35. default: []
  36. selector:
  37. action:
  38. dismiss_text:
  39. name: "Dismiss Text"
  40. description: "Text to show on the dismiss button"
  41. default: "Dismiss"
  42. selector:
  43. text:
  44. dismiss_action:
  45. name: "Dismiss Action"
  46. description: "Action to run when notification is dismissed"
  47. default: []
  48. selector:
  49. action:
  50. mode: restart
  51. sequence:
  52. - alias: "Send notification"
  53. domain: mobile_app
  54. type: notify
  55. device_id: !input notify_device
  56. title: !input title
  57. message: !input message
  58. data:
  59. actions:
  60. - action: "CONFIRM"
  61. title: !input confirm_text
  62. - action: "DISMISS"
  63. title: !input dismiss_text
  64. - alias: "Awaiting response"
  65. wait_for_trigger:
  66. - platform: event
  67. event_type: mobile_app_notification_action
  68. - choose:
  69. - conditions: "{{ wait.trigger.event.data.action == 'CONFIRM' }}"
  70. sequence: !input confirm_action
  71. - conditions: "{{ wait.trigger.event.data.action == 'DISMISS' }}"
  72. sequence: !input dismiss_action