Help with actionable notification and timer

I could really use some help with setting up a smart timer for the coffeemaker and “auto shut off or not” depending on my answer to the actionable notification.

What I’m trying to achieve is this: when I press a physical zigbee button the switch that the coffeemaker is connected to starts. That should trigger a timer in HA for 60 minutes. After 55 minutes I would like to get a actionable notification in the iOS Companion app with two choices: restart timer or dismiss.

The timer would be shown in the companion app as a conditional card with countdows. That part is not a problem for me setting up. Neither is the actual timer that starts when the button is pushed.

The part I’m struggling with is the notification after 55 minutes, or rather: when there is 5 minutes left. But that is not of great importance either. As long as the timer restarts it will always notify when there’s 5 minutes left.

How do I go about setting all this up? When googling it seems I need to set up several automations for the actions in the actionable notifications. Have any of you done this before and would be willing to share the code?

Thanks in advance!
/ dunderklumpen

Restart timer could be done by using mode:restart for the automation. This would restart automation and timer

By doing above it will allow you to set actionable notification to just Re trigger the main automation

I’ll share code for both main and the actionable notification when I get to pc

1 Like

Thank you very much! I’m looking forward to your post!

EDIT…below looks about right

should start on switch turn ON then wait 45min and send automation that allow you to restart.
Notification is for IOS. For android you need to add HTML5 action

for the actionable notification you should get a button that when press retriggers the original automation…ultimately keeping the timer going since the automation is set to “restart” if triggered while running.

the “tag” will cause each new notification to overwrite the previous. this may or may not be desirable so you can use different tags to change this behavior

AUTOMATION

alias: NOTIFY_CoffeeStarted
description: ''
trigger:
  - platform: state
    entity_id: switch.coffee
    to: 'on'
condition:
action:
  - service: notify.mobile_app_iphone
    data:
      message: "Coffee Timer Started at {{ now().strftime('%H:%M  %d %b) }}"
      data:
        tag: NOTIFY_Coffee
  - delay:
      hours: 0
      minutes: 45
      seconds: 0
      milliseconds: 0
  - service: notify.mobile_app_iphone
    data:
      message: Coffee timer has 5Min left. Want to restart?
      data:
        tag: NOTIFY_Coffee
        actions:
          - action: COFFEE_TIMER_RESTART_IOS
            title: Yes
            destructive: true
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - service: notify.mobile_app_iphone
    data:
      message: "Coffee Timer Stopped  at {{ now().strftime('%H:%M  %d %b) }}"
      data:
        tag: NOTIFY_Coffee
mode: restart


ACTIONABLE NOTIFICATION AUTOMATION


alias: ACTION-NOTIFY-Coffee
description: ''
trigger:
  - event_data:
      action: coffee_timer_restart_android
    event_type: html5_notification.clicked
    platform: event
  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: COFFEE_TIMER_RESTART_IOS
condition: []
action:
  - service: automation.trigger
    data: {}
    target:
      entity_id: automation.notify_coffeestarted
  - service: notify.mobile_app_
    data:
      message: "The Coffee Timer was Restarted at {{ now().strftime('%H:%M  %d %b) }}"
      data:
        tag: NOTIFY_Coffee
mode: single

Thanks a lot! Very kind of you. I will test it when I get back home tonight.

Thanks again! Just now I had a chance to review your post a little more closely. There are perhaps a few notifications too many :slight_smile: The one I need is really just the one: 55 minutes after I started the coffeemaker (physical button) I would like an actionable notification to restart the timer.

Which part(s) should I remove? Can you please assist me a little more? Thanks in advance!

Yeah

I did not know if this was potential safety Fisk so I threw in a lot.

If you put this into HA you can edit in UI. Ultimately the notifications only chimes but will not fill up notifications as they overwrite each other.

The “action” section is where notification are

The “service is the individual notification

You may delete all notification from automation except 5 min warning as it has actionable notification.

You may delete notification from actionable notification automation. It only require automation trigger

Didn’t think of that. Thanks! I’ll give it a go as soon as the switch and remote button arrives in the mail. I’ll get back with the results!

Thanks!

Sounds good

I figure this will get you close enough to modify it for your needs

1 Like

Thanks a lot, @tmjpugh for your solution and time! Everything works as intended. I had to make a different automation for when I shut the coffeemaker off with the Zigbee button, but I got it working. That one was a lot easier, lol.

All the best!

1 Like