• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Bluetooth Countdown Alarm Widget with Tasker

james899

Lurker
Aug 11, 2012
9
0
I'm trying to do this:

When a bluetooth device connects I need a countdown timer to start for a preset time (e.g. 20 mins). The remaining time should be shown decreasing on a 1x1 widget (showing the seconds, as well as minutes remaining is preferable). When the countdown finishes I need an audible alarm with popup button to snooze or dismiss it.

If the bluetooth connection is dropped before the countdown ends, the countdown should be dismissed (until a bt connection is made again at which point it should begin a new countdown).

It would be even better if the preset time could be a random figure within a set range e.g. between 30 mins to 70 mins.

UPDATE: Here's a basic summary of how I did most of this:

Create a profile with state bluetooth connected. Then create a task (e.g. Let's call it "Bt Alarm")

For

Variable %mins Items 20:1

Set Widget Label
Name Alarm Widget Label %mins

Wait
Minutes 1

End For

Perform Task
Bt Alarm 2

You need to create a task widget on your homescreen with the name "Alarm Widget" which points to this task called "Bt Alarm". This sets up a loop which will run for 20 times, each time, reducing the variable %mins by 1, and by re-setting the label of the widget each loop, the widget label effectively becomes a countdown widget. When the countdown is up, it performs the task "Bt Alarm 2" which is:

Music Play
File:
Popup Task Buttons:
Bluetooth Snooze
Bluetooth Cancel


Bluetooth Snooze:
Music Stop
Set Widget Label Alarm Widget Label: Snooze
Wait Minutes 5
Perform Task: Bt Alarm 2

Bluetooth Cancel:
Music Stop
Stop Task: Bluetooth Snooze
Set Widget Label: Alarm Widget Label: Off.

To cancel when bluetooth disconnects before the alarm goes off:
Create a profile for bluetooth Not connected (i.e. Inverted Bluetooth connected). Then:
Stop Task: Bt Alarm 2
Stop Task: Bluetooth Snooze
Stop Task: Bt Alarm
Set Widget Label: Alarm Widget Label Off.

It might not be beautifully written but it works for me. Reply, if I haven't explained well enough.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones