The Ultimate (overcomplicated & slightly annoying) Alarm Clock! (with on-screen snooze!)

FOR UPDATES AND ASSISTANCE, PLEASE USE THIS ACTIVE THREAD ON XDA

I had a look at the alarm clock on the Tasker wiki and decided to update it with screen actions for snooze. When I was done, I felt that something was missing… so I added a couple of things, then a few more and then a few more….

First install

Download the .zip file below.

In menu options/profile data 'Import One Task':

AlarmAPOTD.tsk.xml
AlarmDayHoro.tsk.xml
AlarmInfo.tsk.xml
AlarmMQoTD.tsk.xml
AlarmNewsHeadlines.tsk.xml
AlarmNGPOTD.tsk.xml
AlarmNPOTD.tsk.xml
AlarmReset.tsk.xml
AlarmSnooze.tsk.xml
AlarmSnoozeMaths.tsk.xml
AlarmSnoozeTime.tsk.xml
AlarmUPSMaths.tsk.xml
VariableClear
AlarmHTTPCheck
(added in V2)

In menu options/profile data 'Import One Profile':

AlarmClock

In a file explorer, navigate to /sdcard/Tasker and within this folder, create the following three folders:

APOTD
NPOTD
NGPOTD

In Tasker, click ‘Tasks’ and select AlarmReset. Click on ‘Test’ within the task to set up the initial variables.

Select the task Alarm. Edit action #11 and choose the alarm sound you wish.

Turn your screen lock off and adjust your screen-time-out to 5 minutes (just for testing).

Make sure you have an active wifi (or mobile data, but profile is data intensive) connection.

Click on the time in the profile AlarmClock and press now, add one minute to each time, click done, click apply… and off we go…

Hit 'snooze' when each speech action has finished.

Theory

I did give some thought to what I’d like to wake up to every morning, but unfortunately Tasker can’t perform that… So, I decided to go a little OTT and make this alarm useful for plenty of Tasker Tips and Tricks.

I separated out all of the tasks so you can easily see what I’ve done. They are then available for you to use or amalgamate into other profiles you have or wish to create. How nice am I…? Let’s take a look at them:

Alarm

This task is first to kick off and controls the flow of what Tasker is going to do. It starts by performing the task AlarmSnoozeMaths (we’ll look at this below) and then encounters its first IF check on the created variable %ALARMCOUNT. Every time you snooze the alarm clock it increases %ALARMCOUNT by 1. When the count is greater than 10, the alarm will stop activating.

As the task continues, it encounters more IF statements for %ALARMCOUNT and performs the action if the IF is true. This way, I was able to create different alarms for different ‘snooze times’. There are four custom speaking alarms and after that, it just plays your selected alarm ringtone.

AlarmSnoozeMaths

This task calculates what the time will be (to display on the screen) when you snooze for 10 minutes. %TIME + 0.10 would have been just so easy wouldn’t it..? But unfortunately when the time is 07:52, telling you your alarm was going to go off at 07:62 was just too untidy. Following the task through, you’ll see how I’ve split the variable %TIME by the ‘.’ and therefore had two variables ‘07’ and ‘52’. From there I add 10 to ‘52’ getting ‘62’. I say that IF it’s greater than 60, minus 60 from it; leaving ‘2’. I then say IF that number is less than 10, join it to ‘:0’, so we end up with ‘:02’. Simples.

The ‘07’ was easier to deal with. IF the above minutes had gone over 60, we would need to add ‘1’ to this number. IF that number was greater than 23, we’d change it to ‘00’.

All the split variables were then joined together and ended up with a more intelligent %STIME.

AlarmSnooze

This is a simple menu task that will pop up on the screen. Pressing one of the two choices will perform the associated tasks. The text you wish to display is in the label field. One performs the task AlarmSnoozeTime which handles the ‘snooze’ and the other performs AlarmReset, which is run when the alarm is turned off. EDIT - Forgot to mention, that if neither button is pressed after 2 minutes, it defaults to 'snooze'.

AlarmSnoozeTime

This firstly ‘shuts-up’ the speech or stops the music. Cancels the notifications and then patiently waits for 10 minutes (or your chosen snooze length) before kicking off the initial Alarm task again.

AlarmReset

Again, this silences and kills notifications before resetting and clearing variables, the most important of which is %ALARMCOUNT to 1, ready for next time it’s to be used. It turns your keyguard back on and stops. EDIT - VariableClear is added to this task by default in V2

AlarmUPSMaths

There is an inbuilt variable %UPS which is the time in seconds since you booted the device (uptime). In the AlarmInfo task, this information is used (amongst many other things!), but having it quote thousands of seconds was just too ugly and really pretty uninformative unless you are a maths genius and even then, first thing in the morning? So, I wanted to change this into hours and minutes. Following the task, you’ll see it starts by dividing %UPS by 3600 to convert it to hours. The result for example of 3.5 does not of course mean 3 hours and 50 minutes; wouldn’t that be easy..? No, the 0.5 = half = 30 minutes. So, by splitting the variable %UPS (which we transferred the created variable %UPMA originally for good house keeping) at the ‘.’ we can deal with the numbers behind the decimal places and convert them to minutes. If it was so simple to be 0.5, then multiplying that number by 60 would give us 30; wouldn’t that be simple..? In the event that it’s actually 0.521331232132131 we need to do something about the getting rid of the 30.121200234423823 (eg) – we do this by again splitting the variable and keeping only what was before decimal point (the whole minutes). Finally we are left with two created variables %UPHR and %UPMIN which are used in the AlarmInfo task for all but a second and therefore was a complete waste of my life – But hey, someone, somewhere, someday will read this when trying to do the same and hit the thanks meter!

AlarmInfo

The first of the information pulling tasks we will run. It grabs the text from the chosen URL in action #1 using an HTTP GET and then starts to extract what it needs – which in this case, is today’s weather forecast. If you’d like to see what information it initially collects and then follow how it’s split, add a file weather.txt under the ‘output file’ field which will store it on your storage card. The task then goes on to speak the weather to you, along with just about everything else that I could find in the Tasker variables for it to tell you! Annoying? Yeah, but that girl’s voice seriously gives me the horn… You? No? Oh…

AlarmMQoTD

Yes, what better to wake up to than a motivational quote!? I’m starting to realise that this profile is really going to make a difference in some of your lives… Ok, so another HTTP GET, followed by a lot of splitting to leave us just the Author and quote itself. This is spoken to you again shortly after by my girlfriend, erm, I mean the speech engine you use…

AlarmDayHoro

How could you possibly consider starting the day without knowing exactly what is going to happen to you by hearing your horoscope!? I know I couldn’t… Again, an HTTP GET, a lot of splitting and that’s what you’re left with.

AlarmNewsHeadlines

This task reads out the recipe of the day for you! Or alternatively, the news headlines as the title would suggest. HTTP GET, splitting, more splitting and job done.

AlarmAPOTD

Alarms are so visual aren’t they? How about some soothing wallpaper from NASA’s astronomy picture of the day – you can admire it whilst you press snooze… Another HTTP GET, but this time we are searching for the image source only and once we’ve dissected it, another HTTP GET grabs the image and Tasker updates your wallpaper with it.

AlarmNPOTD

Same as above, but just NASA’s picture of the day. WHOOP!

AlarmNGPOTD

Same again, but this time National Geographic. %WHOOP2!

AlarmNakedHotGirlOfTheDay

You wish… but I might consider it for the next release…

VariableClear

The above tasks import a lot of text from the HTTP GET commands. Splitting them increases the amount yet further. This task is not currently instructed to run within any of the other tasks, so either run it manually (open it and press test) or add a ‘perform task’ action into AlarmReset, so it sweeps up for you.

Note: This task is HUGE. Currently (and unfortunately) you cannot join all of the split data together and clear it in one action. I’ve been reliably informed that it will be in the next Tasker update (although that comes a little too late for the 1.5hrs it took me to enter it all manually!) Have you hit the thanks meter yet? Do it again…

EDIT - Added to the AlarmReset task as standard in V2

AlarmHTTPCheck (added in V2)

Should part of a triggering task fail, Tasker is currently set up to cease further actions. Having an alarm based on the reliability of your data connectivity is never a good plan, so I had to resolve how to confirm if the HTTPGET had failed and consequently, so had the alarm. There is a built in variable %HTTPR which is the response code, but unfortunately it's not so simple to 'variable check' this in the next action - if the HTTPGET failed, then it would not go to the next action… This needs to be changed within Tasker, but in the mean time the solution was to trigger a separate task.

AlarmHTTPCheck is triggered before the HTTPGET and runs with a lower priority than the calling task to ensure the HTTPGET action is not delayed. It waits 3 seconds, before checking %HTTPR is either a value of 200 or 400 denoting success. The task will cease if this is the case. If it isn't, it will increase the value of %ALARMCOUNT to 5 (+1 will be added in the task Alarm) so all further HTTPGET alarm calls are skipped and only the alarm music is triggered. The disadvantage of this is having less snoozes, but if you are not woken up to your expected informative speech tasks, I'm sure even your sleepy self will realise something is amiss. Sorted?

Customisation

Time – Changed by clicking the profile

Alarm Sound – Changed in the task Alarm, action #11

Star Sign – Change the text gem-in-eye to whatever you want the speech to try and say in action #9 of AlarmDayHoro. Change your star sign in the HTTP GET action #1 in the URL.

Weather – go to this link and type your location in the search box. Click on it and note the code/extension of your local weather station in the URL. Change this in the HTTP GET server:Port field – mine is 03534. If you live in the US, you need to add in different information after auto/ical – the blog post #4 here gives you an example

Female – Feel free to rewrite the speech entries so they are flattering to a girl. Or alternatively, call me… and I’ll talk dirty to you, robot-style.

Snooze interval – Change the wait time in AlarmSnoozeTime to the snooze interval you wish. Change the value in AlarmSnoozeMaths, action #3 to display the correct 'snoozing-to-time'.

Pop-up Notifications - You can add your own background by clicking 'tools' in AlarmSnooze.

.
Latest Download here <-——
.

Credits

Unknown for weather
Unknown for APOD Wallpaper
Daweav for original wiki alarm with snooze
UncleMike for AM/PM variable splits

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License