Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[TUT] Tasker | The Ultimate (over-informative & annoying) Alarm Clock V3|With Snooze!

OP brandall

2nd May 2011, 02:44 AM   |  #1  
brandall's Avatar
OP Senior Member
Flag Birmingham
Thanks Meter: 4,649
 
2,620 posts
Join Date:Joined: May 2008
Donate to Me
More
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.

New to Tasker? Download the free trial here
Last edited by brandall; 10th May 2011 at 10:25 AM.
The Following 27 Users Say Thank You to brandall For This Useful Post: [ View ]
2nd May 2011, 02:45 AM   |  #2  
brandall's Avatar
OP Senior Member
Flag Birmingham
Thanks Meter: 4,649
 
2,620 posts
Join Date:Joined: May 2008
Donate to Me
More
Disclaimer

Should this alarm fail, not wake you up, you lose your job, followed by your house and wife, please note that compensation claims will only be payable by cheque and may take up to 400 years to process <- You know what I’m sayin

Theory

Q) Do you honestly think I’m ever going to use this? You seriously need to get out more.
A) Well maybe? I do!

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 if the thanks meter increases sufficiently, I’ll 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?

Credits

Unknown for weather
Unknown for APOD Wallpaper
Daweav for original wiki alarm with snooze
UncleMike for AM/PM variable splits
Last edited by brandall; 5th May 2011 at 08:00 PM.
The Following 25 Users Say Thank You to brandall For This Useful Post: [ View ]
2nd May 2011, 02:45 AM   |  #3  
brandall's Avatar
OP Senior Member
Flag Birmingham
Thanks Meter: 4,649
 
2,620 posts
Join Date:Joined: May 2008
Donate to Me
More
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. You will also need to change the sign=# in the splitter as it turns out that each horoscope has a different number too. I'll put a list up of them all shortly, but in the mean time you'll have to look at the URL in a browser and spot your number please - Credit torsrex

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.

Change Log

Code:
V2

Added task AlarmHTTPCheck to ensure alarm didn't fail if a connection or connecting task failed.
Added task VariableClear to AlarmReset as standard
Changed collision handling in AlarmSnooze
Changed task priorities to ensure AlarmSnooze has a minimal delay at most
Changed task priorities to ensure AlarmSnoozemaths always completes prior to use in the notification.

V3

* Stupid spelling mistakes in AlarmNGPOTD & AlarmAPOTD fixed
* Added day of the week as a context and removed from task Alarm
Bug/Issue Report

Keyguard/Lockscreen - The keyguard action set off (#3) in the task Alarm has been left in. You’ll need to add Keyguard, set on to action #7 in AlarmReset. Please let me know how your device handles this and what lock you use. I’ll see if I can put something in as standard.

Slow device/internet connection – I’m not sure how your device will handle the multiple HPPT GET actions and if consequently, this will delay other actions such as the %STIME maths.

No/failed data connectionSOLVED in V2

Yahoo News Headlines - Appear to have started adding 'non text' to their headlines since testing... damn.

Development/Requests

NHGoTD currently at request level 1!

If you have a better RSS feed for the above or any requests, please do let me know.
If you adapt this to use your own RSS topics, please do share to save others with the headache of %HTTPD splitting
.

FAQ

Q) I like parts of this alarm, but not all of it. How do I change it just to suit me?
A) Instructions are written for you here

Q) I'm using your data sync profiles, can I combine these to start and stop the data connection before and after this task?
A) Absolutely, you can activate the data connection and then use any of the variables such as %WIFIOC or %WIFIORS to turn it off again, or leave it as it was. You could even make it that you only use this alarm when you are at home IF %WIFIHOME = 2 (reading %WIFIPREF).

Q) Why do you always transfer the %HTTPD data straight into another created variable?
A) Within the tasks, %HTTPD is populated with various different data. Transferring the data out of it as quick as possible prevents it being overwritten by a following HTTPGET task. We don't have to apply wait actions this way or confirm that one %HTTPD task has completed before another is allowed to start.

Q) I have many other Tasker questions, can I post them here??
A) To avoid clutter, probably best to use this official Google group

Q) Where can I learn more about Tasker?
A) The manual and Profiles and step-throughs on the Tasker wiki and you’ll be up to speed in no time.


Installation Instructions

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


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

AlarmClock

No need to install V2 first, go straight for V3!

The thanks meter lets me know I'm appreciated!
Attached Files
File Type: zip Tasker Ultimate Alarm V3.zip - [Click for QR Code] (10.0 KB, 4045 views)
Last edited by brandall; 17th May 2011 at 08:14 PM.
The Following 32 Users Say Thank You to brandall For This Useful Post: [ View ]
3rd May 2011, 12:13 AM   |  #4  
brandall's Avatar
OP Senior Member
Flag Birmingham
Thanks Meter: 4,649
 
2,620 posts
Join Date:Joined: May 2008
Donate to Me
More
Exclamation V2 Up
Change Log

V2

* Added task AlarmHTTPCheck to ensure alarm didn't fail if a connection or connecting task failed.
* Added task VariableClear to AlarmReset as standard
* Changed collision handling in AlarmSnooze
* Changed task priorities to ensure AlarmSnooze has a minimal delay at most
* Changed task priorities to ensure AlarmSnoozemaths always completes prior to use in the notification.

V3

* Added day of the week as a context and removed from task Alarm
* Corrected spelling mistakes in NGPOTD & APOTD
Last edited by brandall; 10th May 2011 at 10:33 AM.
The Following 4 Users Say Thank You to brandall For This Useful Post: [ View ]
3rd May 2011, 01:03 AM   |  #5  
adianlorenzana's Avatar
Senior Member
Flag Grosse Pointe Park
Thanks Meter: 4
 
203 posts
Join Date:Joined: Sep 2010
More
Wow, I love this post a lot.
Release that naked hot girl of the day please dear god
3rd May 2011, 04:41 PM   |  #6  
brandall's Avatar
OP Senior Member
Flag Birmingham
Thanks Meter: 4,649
 
2,620 posts
Join Date:Joined: May 2008
Donate to Me
More
Quote:
Originally Posted by adianlorenzana

Wow, I love this post a lot.
Release that naked hot girl of the day please dear god

Ha! Glad you found it useful. Please provide feedback when you can if all working correctly, so I can add it to the Tasker Wiki

Current count of %NHGoTD = 1! (yeah, that was a Tasker joke...)
The Following User Says Thank You to brandall For This Useful Post: [ View ]
4th May 2011, 01:05 PM   |  #7  
Junior Member
Thanks Meter: 0
 
2 posts
Join Date:Joined: Sep 2007
random snooze?
would it be possible in Tasker to add a random snooze duration, say between 2 and 10 minutes?
That will keep you on your toes!
4th May 2011, 10:03 PM   |  #8  
brandall's Avatar
OP Senior Member
Flag Birmingham
Thanks Meter: 4,649
 
2,620 posts
Join Date:Joined: May 2008
Donate to Me
More
Quote:
Originally Posted by thermopyl

would it be possible in Tasker to add a random snooze duration, say between 2 and 10 minutes?
That will keep you on your toes!

It would indeed! In answer to your question - yes! There is a variable randomize option which could be used in AlarmSnoozeMaths and then the same number in AlarmSnoozetime...

Tasker allows you to add variables so you could easily say %TIME + %RANDOMTIMEBETWEEN2AND10 = next alarm!

If it helps you get up in the morning, let us know and I'll put it in as standard!
The Following 2 Users Say Thank You to brandall For This Useful Post: [ View ]
6th May 2011, 02:16 PM   |  #9  
Senior Member
Flag Pune
Thanks Meter: 13
 
170 posts
Join Date:Joined: Sep 2010
More
I wish there was a stripped down version of this. I want the AlarmInfo task (which I can see has weather info and the usual text to say), but don't want horoscope, news or anything else (that wallpaper change thingy etc).
What do I do?
6th May 2011, 10:02 PM   |  #10  
brandall's Avatar
OP Senior Member
Flag Birmingham
Thanks Meter: 4,649
 
2,620 posts
Join Date:Joined: May 2008
Donate to Me
More
Quote:
Originally Posted by thehrushi

I wish there was a stripped down version of this. I want the AlarmInfo task (which I can see has weather info and the usual text to say), but don't want horoscope, news or anything else (that wallpaper change thingy etc).
What do I do?

Should be quite easy - I'll post instructions for you later

EDIT - The instructions are here in post #11 for you.
Last edited by brandall; 6th May 2011 at 11:10 PM.

Post Reply Subscribe to Thread

Tags
alarm, profiles, tasker, tutorial
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes