Hello,
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?
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.
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>
data:
title: Reminder
message: "The downstairs vacuum will start in 5 minutes"
data:
tag: "delay_vacuum_downstairs"
timeout: 300
actions:
- 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:
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:
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!
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.
Could you show remaining countdown timer on DELAY notification itself without sending messages every second?
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.
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.
Does anybody know if it is possible to prefill a value like 120 or at least say that only numbers are allowed? Imagine someone enters 5 minutes instead of just the number 5. Didn’t find any option for this. Not for Android and not for iOS.
you cant prefill the field on android but you could maybe use an action for a preferred default or just process the data in the event and if you dont like it send another notification asking for a better value?
I just wanted to make it as easy as possible and not to include a check if value is valid and loop it back to the user. But if it’s the only way, there we go.