Actionable notifications: can I enter a value in the "reply"?

I have have a question on actionable notifications. I am using them in some automations and its a great feature. However I would like to have a even greater control by adding a user defined value to the reply.

For exemple, I would like to postpone a notification, being able to enter some value in the reply (not just a “button click”) to define the number of minutes that HA has to wait before notifying me again. I know how to set multiple “actions” with predefined delays…but is it possible to leave the user to enter a “free” value? For exemple 5, 14, 99 or whatever?

Thanks for your help.

You have not told us what integration you are using for messaging.

iOS Companion App?
Android Companion App?

Sorry : Android Companion App.
FYI, I only have Android devices: if any other solution to my question is applicable for Android (using Telegram or whatever), I could give it a try. :slight_smile:

Ok, I’ve moved your post to the correct category.

1 Like

Here’s the service call which I use to send a notification 5 minutes before my vacuum is due to run. The notification includes a button to prevent it running completely, and a button which when pressed allows you to enter an optional number of minutes to delay the vacuum by:

- service: notify.<your_mobile_app_notification_service>
    title: Reminder
    message: "The downstairs vacuum will start in 5 minutes"
      tag: "delay_vacuum_downstairs"
      timeout: 300
        - action: "prevent_vacuum_downstairs" # The key you are sending for the event
          title: "Prevent" # The button title
        - action: "REPLY" # The key you are sending for the event
          title: "Delay (enter minutes)" # The button title

As you can see, it uses the “REPLY” option of the action key, and I built this from the guidance available here. Hope it’s helpful.

I can also add the automations I use to respond to the consequent returned events if that will help.


Thanks: it is precisely what I wanted to do.
If you could also provide the corresponding automation to see how to deal with the returned event it would be wonderful!

No problem. Here’s the delay vacuum automation using the “REPLY” event. You’ll see it only continues if the reply has the tag that was attached to the original notification. It then adds the minutes to the has_time only input datetime that I use to set the vacuum start time. I run the automation in parallel mode as the notification is sent to 4 family phones, so the reply could come more than once:

- alias: "Delay Vacuum"
  mode: parallel
    - platform: event
      event_type: mobile_app_notification_action
        action: "REPLY"
    act: "{{ }}"
    delay: "{{ | int(0) }}"
    - condition: template
      value_template: "{{ act == 'delay_vacuum_downstairs' }}"
    - service: input_datetime.set_datetime
        entity_id: "{{ 'input_datetime.vacuum_downstairs_start_time' }}"
        time: >
            ((state_attr('input_datetime.vacuum_downstairs_start_time', 'timestamp') | int) + timedelta(minutes=delay).seconds)
            | timestamp_custom("%H:%M:%S", false)

As far as I can tell, timestamps represent UTC values, so the timestamp_custom filter option for local time is set to false here so as not to inadvertently skew the final result with local time differences from UTC. Home Assistant will then display the local time correctly in the frontend.

And here’s the automation for preventing the vacuum. It basically turns off an input_boolean for long enough to ensure the vacuum doesn’t run. The automation only needs to run once, so I just use the option to suppress any error messages if it’s called by more than one person:

- alias: Prevent Vacuum
  mode: single
  max_exceeded: silent
    - platform: event
      event_type: mobile_app_notification_action
        action: prevent_vacuum_downstairs
    - service: input_boolean.turn_off
        entity_id: "input_boolean.vacuum_downstairs"
    - delay:
        minutes: 6
    - service: input_boolean.turn_on
        entity_id: "input_boolean.vacuum_downstairs"

Incidentally, the tag and action keys of a notification can be templated, so you could use the service call in my original post to cover several scenarios - by using templates I actually use this notification in a single automation that covers 5 different upcoming cleaning events on 3 vacuums, but I thought leaving that all out would make it easier to read. Hope this helps!


Love this! Thanks!
I have two questions:

  1. How do you reset “input_datetime.vacuum_downstairs_start_time” to its original value? I imagine the schedule would slowly shift to later & later hour of day.
  2. Could you show remaining countdown timer on DELAY notification itself without sending messages every second?

Apologies for the late reply.

  1. At the moment, I just reset the time manually in the frontend when it occurs to me. I guess you could run an automation on the cleaning operation being completed (using a state trigger when the vacuum goes from returning to docked) that could reset the time, either by hardcoding it in the automation, or by copying the time across from another datetime helper where you store the original start time but which you might keep hidden from the frontend.

  2. I’ve not explored this at all, but you could send a new notification in response to the delay event which cancels the current delay notification and includes a chronometer set to countdown against the new vacuum start time. This thread has details on how this can be accomplished, but as I say, I’ve never done it myself.

Hope this helps

1 Like