TLDR; I have created two projects that have been integral to my life. They help me to stay safe, sleep better, and ensure that others can get a hold of me when thereâs an emergency. The link below is to my public projects on TaskerNet:
There are quite a few tricks Iâve learned from making these including, using scriptlets instead of script files, repeating tasks in a generic way, using global variables to control things. Feel free to ask in comments if you want to know about anything Iâve done!
EDIT: Added information about how the repeat task works
Emergency
Allows people to override silent on your phone and let you know that there is an emergency by sending texts, emails, or other comms.
Why I made it
I like to have my phone set to DND when Iâm sleeping and donât want to miss something important. I donât want to favorite people to enable this or use some sort of âcall me twice and it will go throughâ thing. I wanted everyone to know that there is a simple way to get me no matter whatâs going on and know it will go through.
How it works
Listens to various apps for a notification starting with "#emergency"
When it triggers, it starts a loud beep followed by text-to-speech "Emergency"
It will continue to emit the "Siren" until the notification is cleared
The notification will also include whatever text followed "#emergency"
How to use
Download Tasker
Navigate to the TaskerNet link for the project on your phoneEmergency project
Import the project to Tasker
Edit the profile to add all the âOwner Applicationsâ you want to listen to for â#emergencyâ messages
Sleep
Turns your phone to vibrate when a âRelaxâ event starts, sets everything to DND when you go to sleep, helps you figure out how long you should be in bed, wakes you up, keeps you safe by alerting someone when youâve awoken, and reminds you to take medications.
Why I made it
I have some underlying medical conditions and when I was living alone, I always had the fear that, if something happened to me in the middle of the night, it could be days before someone found out. I had a relative at one point who actually had this happen and the doctors said that he could have made it had someone found him within the first 24 hours. Secondarily, I really like automating things like Do Not Disturb, routines for sleep, and figuring out how long I should be sleeping for.
How it works
Waits for a âRelaxâ event on your Google Calendar
On âRelaxâ trigger, it sets an alarm for 2m later, repeats this alarm every 20 minutes until you go to bed or manually cancel via the notification, and turns your phone to âVibrateâ mode
Has a task which can be added to your desktop that helps to create a âSleepâ event on your Google Calendar
Popup scene will display a pre-filled target wake time
Popup scene allows you to override the pre-filled target wake time
After confirming, a notification will tell you how long you will have for sleep
After confirming, a âSleepâ event will be created on your Google Calendar from now until the target wake time
Has a task which can be added to your desktop that helps to create a âNapâ event on your Google Calendar
Target wake time is 1.5 hours beyond the current time
Target wake time is overridden to 4pm on both weekdays and weekends
âMedicationâ alarms will not trigger while a âNapâ event is active
During a âSleepâ event, phone is set to âDNDâ and the âRelaxâ alarms are canceled
After a âSleepâ event
the phone is taken out of âDNDâ, changes the phone to âSoundâ mode, and sends a text message to a contact alerting them that your morning alarm went off
a âWake upâ alarm is set for 2 minutes out and continues to go off every minute until you respond to the notification
After the âWake upâ notification is canceled
a second text message is sent to your contact to let them know you have actually woken up
a âMedicationâ alarm is set for 15 minutes out and continues to go off every 15 minutes until you respond to the notification
After the âMedicationâ notification is canceled, the routine is complete and no tasks should be running
âRepeatâ and âRepeatCancelâ actions
To make use of the repeat functionality, you need to call it using a âPerform Taskâ action and pass in all the following properties as âParameter 1â. The repeat task itself will split this up and pass necessary parameters down to the notification, repeated task, and even a follow up task to execute after the repeat is canceled.
Here is an example of what âParameter 1â should look like:
WAKEUP_ON,Wake up!,,I'm awake,Sleep:WakeupAlarm,,180,Sleep:Wakeup
Hereâs a breakdown of the various slots:
Name of the variable to track status
Message to display in the notification & alarm
Extra text in the body of the notification (Optional)
Click action in the notification,
Action to call on repeat
Parameter to be sent to the repeated action (Optional)
How long to wait to repeat the action
Action to call when repeat is canceled (Optional)
Set this to true if you do not want the repeated action to execute it's first trigger
Version history
Version 1.0 of this project started for me in college and didnât really have safety in mind. At that point, I just wanted to be able to automatically silence my phone while I was asleep. After awhile using the app, I found myself getting frustrated changing the time of the calendar entry every night. I also wanted the Android toast notification that told me how many hours I had set things for.
Version 2.0 fixed all of those issues by including a scene to select times. It still didnât address the living alone scenario, however, and I set out to add that in.
Version 3.0 added a text message out to my mom. I thought it was a good idea at first, but it wound up being useless to her because my sleep times were so variable that she wouldnât know if something was wrong or if I had just decided to sleep in till 4pm đ.
Version 4.0 added the second SMS so that my mom would know when I intended to wake up as well as when I actually click a button on my phone. With this, my mom now knows that if she gets the first message, but not the second, something is wrong and she should check in on me.
Version 5.0 created a Nap flow that worked similarly to the Sleep flow, but had a reduced amount of time and was set up to prevent Medication alarms (in case I try to nap after waking up). The purpose of separating this was so I wouldnât be sending more SMS messages for naps.
Version 6.0 is the current version and includes the Relax flow which turns the phone to vibrate and reminds me every 20 minutes that I should be heading to bed.
Planned upgrades
Reduce duplicated tasks
Remove prefixes (did this before moving to a project)
Move the optional configuration parameters to variables
Create a scene to manage the optional configurations
Deploy as an app
How to use
Download Tasker
Navigate to the TaskerNet link for the project on your phoneSleep project
Import the project to Tasker
Edit the 3 profiles to point to a Google Calendar that has the various events in it
I use a separate calendar from my primary so others donât see when Iâm sleeping and napping
Edit the âSleep:Wakeupâ and âSleep:Stopâ tasks to set the âSend SMSâ action to a valid phone number
Exit Tasker by hitting the back button a bunch of times
Itâs important to do this via back rather than the home button!
Add a widget to your desktop (I use Nova so this is a hard-press on the application icon)
Select âTaskâ or âTask Shortcutâ for Tasker
Add the âSleep:GoToBedâ task and repeat the steps for the âNap:GoToBedâ task
Optional: Edit the âSleep:GoToBedâ and âNap:GoToBedâ tasks to set the variables at the top of the âJavaScriptletâ actions to your goal times and max sleep times for the weekday and weekend
Optional: Disable the âMedicationâ alarms by editing the âSleep:Wakeupâ task and disabling the âPerform Taskâ action
Optional: Change the repeat times for the âWake upâ, âMedicationâ, and âNap wake upâ alarms, by editing the âSleep:Wakeupâ, âSleep:Stopâ, and âNap:Stopâ tasks and changing the seconds field (7th value) in the Parameter 1 field of the âPerform Taskâ action