this post was submitted on 16 Feb 2024
29 points (100.0% liked)

homeassistant

11998 readers
122 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS
 

I've been reading through the documentation and looked at several tutorials, but I can't get actionable notifications working.

Here's an example YAML that was originally done in the GUI. It's intented to send an actionable notification with two options, and when you click one, it should send another notification to confirm it worked.

It sends the notification fine, and when I tap the button the wait for trigger section in Home Assistant lights up to indicate that it's been triggered. But nothing further happens.

Any help appreciated!

alias: Actionable notification test
description: ""
trigger: []
condition: []
action:
  - service: notify.notify
    metadata: {}
    data:
      message: Message me?
      data:
        actions:
          - action: ACTION_NOTIFY
            title: Message me
          - action: ACTION_IGNORE
            title: Ignore
  - wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: ACTION_NOTIFY
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: ACTION_IGNORE
    continue_on_timeout: false
    timeout:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 0
  - alias: Perform the action
    choose:
      - conditions:
          - condition: template
            value_template: "{{ wait.trigger.event.data.action == \"ACTION_NOTIFY\" }}"
        sequence:
          - service: notify.notify
            metadata: {}
            data:
              message: Requested message
mode: single
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 8 months ago (5 children)

Set the wait to have a timeout and it will work.

Your wait needs to wait for a time, and decide if you want to proceed if you don’t get a response. Right now the wait for a trigger is expecting the event to be ready when it starts (before you’ve even seen the notification), and when it’s not the automation is stopping because continue on timeout is false. A wait for a trigger without a timeout doesn’t wait forever.

[–] [email protected] 3 points 8 months ago (1 children)

Interesting, I haven't heard that til now. Do you know how long it does wait for?

[–] [email protected] 4 points 8 months ago

If you set the wait to 0, it will not wait at all and will proceed immediately (or stop the automation if continue is not set). It might be counter intuitive, in some systems a 0 wait means wait forever.

load more comments (3 replies)