Discrete cuckoo clock using Tasker – Android customization
We actually had some fun last week going over some of our best Android customization posts from the year, it reminded us some of the fun we’ve had. It’s almost the new year now, and forgive me for stretching here, but I am inspired to think of time. Before we really dive into root stuff, let’s do one more lazy Tasker project, a clock.
The idea is simple, we’re building a type of cuckoo clock, but silent. Every hour, on the hour, we’ll make your phone vibrate one tick for each hour of the current time. Simple enough, at 4pm, your device will vibrate four quick spurts (or 16 if you use the 24 hour clock like I do) and there is no need to pull your phone out to check the time.
Hey, it’s the end of the year, let’s have some fun. Truth is, I was planning to give you a big project here today, we were going to use Tasker to act as a musical instrument, to play Auld Lang Syne. Feel free to check out MIDI and all the magic and horror it can bring, or hold on, perhaps I’ll get this thing working at a later date.
Before we begin
There are a few steps in this tutorial, but we’re going to work with a simple For Loop instead of properly creating an array variable. No time for that level of crazy brain usage this holiday season, let’s just make some noise.
No delay’s, let’s just get into this. Also, I’ll leave it to you to go back and check out previous tutorials to learn how exactly to do some of these things. I’ll leave links for you along the way.
Fire up Tasker, head into the Tasks tab and fire up a new Task, I’ll name mine “SilentClock”.
First up, a few variables.
Create a new Variable. Name: “%timetoalert“. To: “%TIME”
That gives you the current time in format 4.48, (or 16.48,) for example. So we will now split the variable to get just the hour.
Variable Split. Name: “%timetoalert“. Splitter: “.” and feel free to Delete Base, we won’t need it.
Now we will use a For Loop to handle the next part. As mentioned earlier, the proper thing to do would be to build an array with the vibration times saved in ms. We’re keeping it simple, we’ll just loop as many times as the hour count, that’ll be four times, for our example.
How to: For Loop with Tasker
Add a new For Loop, Tasks -> For. Then Variable: “%arrtime“. Items: “1:%timetoalert1“.
I bet that made no sense at all. I explain the variable part in the tutorial linked above, but where did that “1:%timetoalert1” come from? It’s easy, actually, we need to run the loop at least once, and repeat it for as many times as the hour in the day. If you recall how Variable Split works, we stripped out the 4 in our example 4.48 using the “.” as a splitter, now %timetoalert1 has the value of 4, and if you wanted it, %timetoalert2 has value 48. In this example, we told the the loop to run from 1:4. 4 o-clock, bingo.
Now vibrate, I don’t recall if we have done this one before.
Tap the “+” button, select Alert, select Vibrate.
Set the Time to something short, like 200.
Now manually wait for a second. “+” -> Task -> Wait -> 1 second.
Now finish up the loop properly with an End For, easy, “+” -> Task -> End For.
That’s the core of the Task, now just need a little Profile to make it happen.
Head over to the Profile tab and create a new Profile.
I recommend only having this Profile active during your waking hours, no point ruining your sleep. Set From to the nearest even hour your after you normally wake up, let’s say 8am (08:00).
Set To to your usual bed time plus a couple minutes, say 10:02pm (22:02).
Finally, set Repeat to every 1 hour.
That’s it. Starting at the next active hour your device will vibrate as many times as the hour of the day. Feel free to increase the vibration time if the 200ms is too quick, just be sure that your vibration time is less than your Wait time.
I added a little ‘heads-up’ for this project, just a 1000ms vibration followed by a 3 second delay before my Loop begins. I found I was missing the first few ticks, so this warning gets my attention, then I can count the ticks.
I talked earlier about using an array and the Vibrate Pattern action to do this properly. Truth told, I have no plan on handling this any time soon, you’re on your own, folks. No worries, array variables are a common enough topic around the Tasker water coolers, Google it up and you’ll find what you need.
If you find that your notification isn’t working exactly as you’d expect, let’s say, for example, that your vibrations do not go off in succession like they should, we may change Profile priority. Long press the Profile then tap the menu icon in the top right of the screen. Under Launched Task Priority, bump it up a bit, I’ve moved mine to 30, which should get the job done. It is not advised to go too high here, but keep bumping it up until you get teh desired results.
Final thoughts, the concept of this project is once again to get you thinking and experiencing Tasker, we have certainly not built a bullet proof silent clock here. Of primary concern, the new Doze functionality of Android 6.x Marshmallow will, by default, put Tasker to sleep. You’ll need to open up Doze to allow Tasker through (perhaps we’ll look at that another day) or accept that your silent cuckoo clock is just not going to work when your device has been immobile for a while. Sorry.
I admit this project was a little over-simplified, not that that makes it a bad project, there were things to learn in this project, like that silly For Loop variable requirement, hope it works out for you. Next week is going to be tough for me folks, we’ll be on the floor at CES and I may not get to post anything for you, I feel bad about that, but I promise to learn a trick or two at the show that I can share later. Once we’re back to normal, next up on our Android customization series we’ll be continuing with root fun, we’ve got that Nexus 7 all ready to rock.
Happy New Year!