I’m working on a reminder automation for Garbage and Recycling days.
I have local calendar setup with the days added.
In my automation when those events happen, I want to send a couple of notifications. One to our amazon spot and a persistent notification. these notifications repeat every two hours.
With the persistent notification I want to be able to turn off the repeating notifications. I believe I can add a button / text that says, “Disable Notifications”, when pressed I want to run an action that turns off the automation. I then have a different automation that looks to see if that automation is off a day later and turns it back on.
I cannot figure out how to add the additional button / text to the persistent notification.
Does anyone have an example I can look at or can help add it to my yaml?
here’s what I have so far:
alias: Trash Reminder
description: ""
triggers:
- trigger: calendar
entity_id: calendar.garbage
event: start
offset: "0:0:0"
id: garbage
- trigger: calendar
entity_id: calendar.recycling
event: start
offset: "0:0:0"
id: recycling
conditions:
- condition: time
after: "12:00:00"
- condition: time
after: "16:00:00"
- condition: time
after: "14:00:00"
actions:
- choose:
- conditions:
- condition: trigger
id:
- garbage
sequence:
- action: notify.alexa_media_anissa_s_echo_spot
metadata: {}
data:
message: Just a reminder the garbage needs to go out to the curb today.
data:
type: tts
- action: persistent_notification.create
metadata: {}
data:
message: Just a reminder the garbage needs to go out to the curb today.
title: Garbage Day Reminder
notification_id: GARB_RECYCLE
- conditions:
- condition: trigger
id:
- recycling
sequence:
- action: notify.alexa_media_anissa_s_echo_spot
metadata: {}
data:
message: Just a reminder the recycling needs to go out to the curb today.
data:
type: tts
- action: persistent_notification.create
metadata: {}
data:
message: Just a reminder the garbage needs to go out to the curb today.
title: Garbage Day Reminder
notification_id: GARB_RECYCLE
mode: single
You sir are correct. I was making more difficult than it needed to be.
Since this is running in single mode, is there a way to add a button to the persistent notification that if pushed goes into a 24 hr timer? Thus skipping the rest of the notifications?
alias: Garbage Reminder
description: ""
triggers:
- trigger: time
at: "14:00:00"
weekday:
- sun
- trigger: time
at: "04:00:00"
weekday:
- sun
- trigger: time
at: "18:00:00"
weekday:
- sun
conditions: []
actions:
- action: notify.alexa_media_anissa_s_echo_spot
metadata: {}
data:
message: >-
Excuse me,,, just a friendly reminder,, Need to take Garbage out to the
curb.
data:
type: tts
- action: persistent_notification.create
metadata: {}
data:
message: Need to take garbage out to the curb.
title: Garbage Reminder
notification_id: GARBAGEID
mode: single
I don’t see that persistent notifications can be actionable like a phone notification is. You will need to put a button on a dashboard to disable the automation.
Do you really always want Sunday? I thought you wanted it based on a calendar. You can add conditions to check for calendar.garbage and calendar.recycling.
Sorry for the delay. Life got in the way.
So I took another stab at this automation. I setup a calendar “Garbage” with my events. I researched youtube and other resources to come up with this final stab at the automation. I can’t get it to choose either of the options and I’m not sure why. I have a boolean that I’m using to turn the automation off. I verified it is on so I don’t think that is it. Any thoughts on why it isn’t working? Here’s the code:
alias: Garbage Reminder
description: ""
triggers:
- trigger: calendar
entity_id: calendar.garbage
event: start
conditions:
- condition: state
entity_id: input_boolean.trash
state:
- "on"
actions:
- choose:
- conditions:
- condition: template
value_template: "{{ 'Garbage' in trigger.calendar_event.summary }}"
sequence:
- repeat:
while:
- condition: state
entity_id: input_boolean.trash
state:
- "on"
sequence:
- action: notify.alexa_media_anissa_s_echo_spot
metadata: {}
data:
message: >-
Excuse me,,, just a friendly reminder,, Need to take
Garbage out to the curb.
data:
type: tts
enabled: false
- action: notify.mobile_app_david_sm_s938u
metadata: {}
data:
message: Have you put the Garbage Out Yet
title: Garbage Day
data:
actions:
- action: YES_GARBAGE_OUT
title: "Yes"
destructive: true
- delay:
hours: 2
minutes: 0
seconds: 0
milliseconds: 0
- conditions:
- condition: template
value_template: >-
value_template: "{{ "Recycling" in trigger.calendar_event.summary
}}"
sequence:
- repeat:
while:
- condition: state
entity_id: input_boolean.trash
state:
- "on"
sequence:
- action: notify.alexa_media_anissa_s_echo_spot
metadata: {}
data:
message: >-
Excuse me,,, just a friendly reminder,, Need to take
Recycling out to the curb.
data:
type: tts
- action: notify.mobile_app_david_sm_s938u
metadata: {}
data:
message: Have you put the Recycling Out Yet?
title: Recycling Day
data:
actions:
- action: YES_GARBAGE_OUT
title: "Yes"
destructive: true
- delay:
hours: 2
minutes: 0
seconds: 0
milliseconds: 0
mode: single
There are several issues that need to be addressed…
Extended delays should be avoided. A better option would be to use a timer helper and retrigger based on that. But, in this case the best option would be to just use a couple more Calendar triggers with offsets.
There are duplicated yaml parts and competing quotes in your template condition:
Because of these errors, the value for this condition will always render false.
IIRC, it shouldn’t do anything harmful, but destructive is not a real option for Android, so there’s no reason to put it in your action data.
Beyond those structural issues, the most common reason why Calendar triggered automations don’t work during testing is the failure to follow the 15 minute rule:
I got it working.
My biggest issue was the 15-minute rule. Wasn’t firing.
The recycling section I wasn’t working on but corrected it.
I’ll look at the Calendar triggers with offsets.
Thanks everyone for your help!!!