Adapted Airplane Mode at Night
The wiki posting for the
tasker profile to turn on airplane mode at night was nice, but it wasn't all that I wanted it to be.
What if I'm not about to go to sleep? I wanted a way to turn it off.Also, what if I'm not at home, I wanted a way for it to sense if I was at home, at a certain time, and then turn the airplane mode on if those contexts were met. Also, the wiki sets it up such that the airplane mode is on 1/2 the time, which saves some battery time, but not as much as I would have liked. I wanted small intervals in which the airplane mode was turned off, so I could receive SMS and e-mail, and then airplane mode on for the majority of the time. Here's what I came up with. There may be a few redundancies, but this was my second attempt at setting up a profile, so I wanted it to be reasonably bulletproof.
Profile 1.
a.
Tasker > Profiles > New > Context: Time
Set up a time between which you want the airplane mode to be active. I sleep from ~10 pm - 6 am, so I set it as "From 22:00 till 5:58"
It will then enter into the task edit page. + means hit the add button in the bottom left of the screen
+ Net > Airplane Mode > select "on" > done
+ Misc > GPS > select "off" > done
(this will make more sense later)
+ Tasker > Perform task > Search > "8Profilevibrate" > Done
(This engages a task that sets all of my audio off and only the "vibrate on notify" and "vibrate on ringer" on. I have another tasker profile set up where I can select a widget on the home screen which prompts me to select an audio profile, this is one of them. If you don't have something similar set up, you can simply repeat this step, but instead have it go "+ Audio > Alarm > volume to 0 > done." and repeat for whatever notification settings you want to have off or on.
+ Audio > Alarm Volume > volume to 10 > done
(this reverses the setting in my 8Profilevibrate which sets the alarm volume to 0, in case I need to set an alarm on my phone to wake me up in the morning.
+ Alert > flash > enter some text, I put "Sleep mode has been engaged, good night" > done
(I put things like this in, so that I have a confirmation when I select the profile, that tasker has, indeed, done what I have asked it. I'm also a bit of a nerd, so having my phone say things to me seems pretty cool.)
Hit "done" at the bottom of the task edit screen, this will save this profile and take you back to the profiles screen. You will see a new profile has been added to your list.
b.
We now want airplane mode to turn off again when we wake up, so we add an "exit task"
Tap the tasks you selected for the profile > tap edit > add exit task
+ Net > Airplane mode > off > done
+ Alert > flash > some text i.e. "Goog morning, sleep mode has been disengaged" > done
+ Tasker > perform task > 4Profilehome (This another of my custom profiles that sets all the volume to a reasonable level, etc. You can repeat the steps outlined above for yourself) > done
Profile 2.
Now we add the interval at which the airplane mode will be set on and off. I wanted airplane mode to be on the entire time, except for 3 min intervals every 30 minutes.
a.
Tasker > profiles > new > context > time > select a time 30 min after the airplane mode profile turns on, for me, this is "From 22:30," then 30 min before you wake up, for me, "to 5:30" > check "repeat" > enter 30 min > done.
This takes you to the task edit page
+ Net > airplane mode > select "toggle" This will revert the state of the airplane mode, no matter what it is, ever 30 min. If off, it will turn on, and vv. > done
Select "done" at the bottom of the screen.
b.
Back in the profiles page. We now have a profile that turns on airplane mode between 22:00 and 5:58, and a profile that toggles the airplane mode between these times, every 30 min. But I just want airplane mode on at for 3 min intervals, every 30 min, so we repeat "2.a" just selecting a time 3 min after, i.e. From 22:33 to 5:33." Cool? Cool.
Select "done"
3.
a.
Go back to the first profile we made in 1.a. We now want to add a location "your house" context, so that if you are there at a certain time, the profile will become active. So first, make sure you are where ever it is you want the profile to be active.
Tap the context box > add context > location, this will pull up a map, activate whatever method you want to use to get a location, I used GPS, and select "get fix" and name your location > done
b.
We want the interval profiles we made in 2.a and 2.b to be connected to the first one we made in 1.a. So back in the profile page, there are check marks next to profiles 2.a and 2.b, un-check both.
tap the task box in profile 1.a > edit > + tasker > profile status > "profile 2.a" select "on" > done
profile 1.a task box > edit > + tasker > profile status > "profiel 2.b" select "on" > done.
Select "done" at the bottom of the page
Now when profile 1.a, your interval profiles 2.a and 2.b will also be active.
c.
Back in the profile page. We want profiles 2.a and 2.b to be inactive when the night is over.
profile 1.a exit task box > edit > repeat the steps in 3.b, instead of selecting "on" select "off."
Profile 4.
Phew, take a break or something.
Now, tasker will activate profile 1.a, in turn activating profiles 2.a and 2.b, and when 1.a is over, will then turn off profiles 2.a and 2.b, when it reaches a certain time, and is in a certain location. But how does the phone know that it is in the location in needs to be?
If you're like me, the GPS is off most of the time to save battery, and so I can't be tracked by "the man," which is silly, because they can just use the cell tower, I digress. I don't want to have to manually turn on the GPS at a certain time, so that profile 1.a can become active, that defeats the purpose of automation, thus, a new profile.
a.
In the profiles page.
New > Context > time > "from 21:59 till 22:01" > done
(Right before and after our profile 1.a begins right?)
In the task edit page
+ Misc > GPS > select "on" > done
+ Misc > get location > done
Select "done" to return to profiles.
To make 4.a and 1.a work well together, click the wrench and screwdriver icon of each in the profiles page, and set the priorities to 2 and 8 respectively. This ensures that when 1.a turns off the GPS, it stays that way.
5.
Now we have 4 profiles, all wonderfully interconnected.
Timeline:
Profile 4.a turns on GPS at 21:59 and gets location
Profile 1.a uses time and location to determine if it will proceed, if true
Profile 1.a activates profiles 2.a and 2.b, turns the GPS back off (saving battery was the point right?), turns on airplane mode, and wishes you good night.
Profiles 2.a and 2.b toggle the airplane mode on for 3 min every 30 min during the night
Profile 1.a then turns the airplane mode off at 5:58 and deactivates 2.a and 2.b
Cycle complete.
You could end here if you want. It is fully automated and should work, but because I'm compulsive, I went on to add a bit more.
So what if I know that I won't be going to sleep any time soon? You don't want your phone to suddenly loose communication due to the beautiful tasker profile you just wrote (9-5 weekday, 9-who knows? weekend right?). This is a back door you can build in to let you turn off the whole airplane mode system if you so choose.
a.
In the profiles page
Tap "tasks" in the bottom right > "new" top right > + tasker > Profile status > select "profile 4.a" > select "off" > done
+ tasker > Profile status > select "profile 1.a" > select "off" > done
+ alert > flash > enter text "sleep automation disengaged" > check "if" enter "%SLEEPON" > tap "~" select "matches" > in the next box enter "0" > done
+ variable > variable set > Name "%SLEEPON" > enter "1" below > done
In the bottom right, there will be an icon that looks like sheets of paper, select this, and follow to add an icon to this task.
b.
Still in the task edit page
New > + tasker > Profile status > select "profile 4.a" > select "off" > done
+ tasker > Profile status > select "profile 1.a" > select "on" > done
+ alert > flash > enter text "sleep automation engaged" > check "if" enter "%SLEEPON" > tap "~" select "matches" > in the next box enter "1" > done
+ variable > variable set > Name "%SLEEPON" > enter "0" below > done
In the bottom right, there will be an icon that looks like sheets of paper, select this, and follow to add an icon to this task.
c.
Still in the task edit page
New > select the wrench and screw driver > in the top pull down menu select "menu" > done
+ tasker > perform task > select "task 5.a" > done
+ tasker > perform task > select "task 5.b" > done
Select "done"
d.
In your home screen, click and hold to add a widget, select android widget > task > in the pull down menu at the top of the page, select "task 5.c" > make widget
Now in your home screen, there will be a widget that when you click it, shows two icons, one turns on the sleep automation system, one turns it off.
Enjoy. Isn't tasker a great way to waste and hour or two?