So I wanted something that goes off every day at 5:15pm to remind me to take my meds, but I wanted to be able to “Snooze” the alert for 15 minutes. I also wanted to avoid Yaml as much as possible so here’s what I came up with (as you read you’ll notice I didn’t avoid that much Yaml but I prefer to use Node-RED as much as I can, and because I’m using Node-RED there’s no interface inside my UI for HA, it just runs everyday):
Use a looptimer node to repeat a message every 15 minutes with a timeout of 90 minutes, if I execute the actionable notify feature inside the reminder message then a STOP message is sent to the looptimer thereby killing any future reminders (essentially I am executing a “DONE/ I took my meds, please stop pestering me” message). I used the Bigtimer node to fire an “on” message at 5.15pm everyday, a switch to make sure I don’t get an “off” message passed through when the Bigtimer turns off, then a looptimer node followed by a Function Node with all the important parts needed for sending the actionable notification to my iPhone. I’ll post some of the Yaml needed below the screenshot.
Inside the Configuration.yaml
ios:
push:
categories:
- name: MedRemind
identifier: 'medremind'
actions:
- identifier: 'MEDICINE_REMINDER_OFF'
title: ' Stop Reminder '
activationMode: 'background'
authenticationRequired: no
destructive: no
behavior: 'default'
Inside my manually created RF switches I have a switch that doesn’t turn anything on so I can use it to toggle off and on which will force a STOP message inside Node-RED, which is how I get the reminder to stop going after I’ve taken my meds.
switch:
platform: rpi_rf
gpio: 17
switches:
medicine_reminder:
protocol: 1
pulselength: 184
code_on: 0000000
code_off: 1144076
inside my automation_old.yaml I have an automation that toggles the switch.medicine_reminder
- alias: Actionable STOP Medicine Reminder
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: MEDICINE_REMINDER_OFF
action:
service: switch.toggle
entity_id: switch.medicine_reminder
Inside the Function Node:
msg.payload =
{
"data": {
"message": "Medicine Before Dinner",
"data": {
"push": {
"badge": 0,
"category": "medremind",
"sound": "sms_alert_3.wav"
}
}
}
}
return msg;
lastly inside the Change node, it changes the message from the medicine_reminder switch (from either ‘off’ or ‘on’ because I’m toggling it in my automation):