Friday, December 30, 2011

Nighty Night, Tasker!

If there's a time where I want something else to do all my work for me, it's right before going to bed and just after I get up. When it comes to my phone, I'm fortunate to have that thing in the form of Tasker. Now, this set of profiles might seem a bit lazy, but why do extra steps I don't need to?

The first part of this has to do with the app I use for an alarm clock, Gentle Alarm. It was the App of the Day on the Amazon store a long, long time ago and I'm glad I took advantage of that offer. I highly recommend it as your alarm clock app for a couple of reasons. First, the gentle alarm function. As I've mentioned before, I have trouble getting up in the morning. Here's the blurb about how Gentle Alarm helps with this:

Alarm clocks can't know if you are in light sleep or deep sleep (those movement based alarm clock don't work) but they can play a very quiet pre-alarm which you will only hear if you are in light sleep. If you are in deep sleep, you will simply sleep through the pre-alarm.

The pre-alarm plays 30min before you really want to get up (you can change that). If the pre-alarm wakes you up, you will be more refreshed than if you had slept until the main alarm because at that time you would have fallen back into deep sleep. Give it a try and I am sure you won't want to miss it anymore.


Now, since shifting to nights, I haven't had much need for an alarm clock. But, I do have to get up early from time to time and can say that it does seem to go a lot easier when I use Gentle Alarm to get me up. Take my anecdote for the datum it isn't. :)

Secondly, Gentle Alarm integrates with Tasker. That will come into play later, though as I want to go over the "Nighty Night" task first. This profile came about due to some weirdness that was going on with my phone. Some nights, not every night, Gentle Alarm would switch from it's darkened Night Mode to regular mode. As the screen was generally at full brightness before I put it into Night Mode, it would come on and flood the room....waking my wife. Not good. As it would occur in the middle of the night when I was asleep, and didn't happen consistently, troubleshooting it was out of the question. I needed a workaround.

I already had a profile set that would silence my phone starting at 11pm, I thought maybe I could integrate the workaround into that. But, in thinking about the various permutations, I wasn't happy with a simple timed launch of the event. For example, I could be up late one night, or go to bed earlier another. An entry that was tied to a specific time just wasn't going to cut it. I wanted more manual control of the automated process (I know, right?) and that's where Tasker's ability to create notifications comes in.



At 9:30pm each night, Tasker puts an icon in my notification area entitled "Nighty Night" (Alert task -> Notify). When I click that notification (State event -> Notification click), it runs the Nighty Night task which sets up my phone for going to bed:


* Turns all of the volumes off
* Sets screen orientation back to "on" (I don't like having my screen rotate most of the time, so I leave it off, but Gentle Alarm works better rotated)
* Reduces screen brightness to 35
* Creates a new notification called "Wakey Wakey"
* Launches Gentle Alarm.
* Enable my Daily alarm that is set to go off at 9am (in case I get to sleep in, more on this later).



So, just prior to going to sleep, I hit my notification, hit the Night Mode button on Gentle Alarm and I'm good to go! Two taps to get everything just how I like it before heading to sleep.

Then, comes the morning. Again, permutations of when I'll get up demanded I have some level of manual intervention here and that's where the Wakey Wakey notification mentioned above, as well as the Tasker integration of Gentle Alarm, comes in. If it's a morning where my daughter gets up well before my daily 9am alarm goes off, I can hit the Wakey Wakey icon and it'll reset everything that Nighty Night sets (orientation, screen brightness, etc). It'll also disable the Daily alarm since I don't need it now that I'm awake. On the other hand, if this is one of those mornings my wife lets me sleep in, when I dismiss the Daily alarm it signals Tasker to run Wakey Wakey instead. This way, no matter what time I wake up, whatever I do first will set my phone up for regular use.



The last thing Wakey Wakey does is put up another notification that allows me to reboot the phone with one click. My ROM of choice on my Evo is MIUI. It's a great and gorgeous ROM, but some of the builds have been a little flaky, so I've taken to rebooting it in the morning each day. With the notification, I hit reboot and by the time I've gotten downstairs and had a swig of water, my phone is again ready for use. Done!



As I said, these are all tiny tasks, but these are the minutiae that our days are made up of. These minor tasks never seem a burden until you figure out how to get rid of them...and then you wonder why you put up with them so long! Tasker..it does a body good!

4 comments:

  1. Hi, Thanks for the profile this is almost what i have been trying to accomplish, Just to add you can bring this down to 1 click instead of two by using the Locale Execute plugin to run shell commands via Tasker.

    Install the above plugin and add an additional action to your nighty nite task (Plugin -> Execute) then add this shell line:

    @!/system/bin/am start -n com.mobitobi.android.gentlealarm/.Activity_Nightmode --activity-exclude-from-recent

    The above action will put GA straight into night display.

    ReplyDelete
  2. You're a lifesaver! Where did you find that trick?

    ReplyDelete
  3. Mind sharing your XML file for your profiles? I would love to setup my phone like yours but can't for the life of me figure out how you did it? Or maybe a break down of the contexts and actions you used?

    ReplyDelete
  4. Just dropped you an email. I guess it WOULD make sense to post the XMLs when I do one of these articles, wouldn't it? :)

    ReplyDelete