Macro to detect a change in the next scheduled alarm time and report when that will be to the user

Abalsam

Active member
This macro will detect a change in the next scheduled alarm (including those scheduled by MacroDroid to support executing an action on time) and report it to the user as an alert.

This macro's core functionality relies on installing the ClockTask plug in which can be found in Google play here: https://play.google.com/store/apps/details?id=com.balda.clocktask.

The macro has been posted as a template at http://www.macrodroid.com/macrostore?id=11583

If you need to reconfigure the plug in trigger, follow these instructions and screen shots:

First to configure the trigger,
1) Click on the trigger and select "Configure" from the context menu.
2) Select "ClockTask" from the list of available plug-ins. Screenshot_20220120-224101-302.png
3) Select the event you are looking to trigger off of which "Next alarm change" .
Screenshot_20220120-224251-167.png
4) Make sure Array handling section is set to "Comma separated string", App name App name owner of next alarm is set to variable "nav" and the Next alarm Seconds in UTC time is assigned to variable "nasec" and click "OK".
Screenshot_20220121-073654-607.png
5) Save the macro.
 
Last edited:

HameleOn

New member
the trigger works every minute and shows that there is 1 minute left and not, for example, like the clock has 4 hours 20 minutes
 

Attachments

  • Screenshot_2022-01-21-19-27-04-730_com.arlosoft.macrodroid.jpg
    Screenshot_2022-01-21-19-27-04-730_com.arlosoft.macrodroid.jpg
    461.7 KB · Views: 11

Abalsam

Active member
It looks like MacroDroid has an internal alarm set which is the next alarm the system is reporting.

MacroDroid sets those internal alarms to make sure triggers execute when they are supposed to and all the system knows is when the alarm is scheduled and which app scheduled it.
 

indstructive

New member
Hello, thinks for this amazing share !

I'm trying since yesterday to find a solution to disable plane mode 30 seconds before the alarm rings (so i can sleep in plane mode and wake up with spotify song alarm).

Do you have any idea if it's possible ?
And do you have any idea to make this macro ?

Thinks :)

ps : i already try to disable the plane mode when the alarm rings but it's not a spotify song which is played because the alarm rings first and then the phone disable plane mode (i'm using the google clock to wake up with spotify songs)
 

Abalsam

Active member
Yes I have a macro that does this and a few other things. If you can tell me specifically what features you are looking for (ie describe what the macro should do and any expected exceptions such as not shutting off DND on weekends) please let me know and I can customize it for you.
 

Abalsam

Active member
Yes I have a macro that does this and a few other things. If you can tell me specifically what features you are looking for (ie describe what the macro should do and any expected exceptions such as not shutting off DND on weekends) please let me know and I can customize it for you.
To further expand on this, I can think of several ways to approach this depending on specific features needed and how you intend to use it.

For example, do you really mean plane mode (as in airplane mode where the phone has no network connectivity) or do not disturb (silence) mode (I am assuming you meant do not disturb)? Do you intend to silence your phone at a set time every evening or will it vary nightly? Does your alarm tend to go off at the same time every morning, after the same number of hours of sleep or varied each day so the macro would need to figure it out? Would you expect the same behavior on weekends or something else?

The answers to these questions would help me figure out specifically what you are looking for.

Thanks
 

indstructive

New member
Hello, thank you for your answer, really

Ideally, I would like a script that disables plane mode (not do not disturb mode) a few seconds before my alarm rings.
In fact, I use the google clock application to program a music or spotify playlist for the alarm clock. The problem is that if my phone is in plane mode, the alarm doesn't go off with spotify music because it says it's not connected to the internet.
I've already tried making a macro that disables plane mode when the alarm rings, but it doesn't work (I guess the alarm rings first and then aeroplane mode disables).

The time I set my alarm is not fixed, it changes every day because my school schedule changes :(
Same thing for the weekend, I don't have a fixed wake up time.

I hope I've been as clear as possible, if you have any other questions on points I haven't been precise enough, don't hesitate, I'll try to answer them as soon as possible.

Thank you very much for your time.

Have a nice day :)

ps : sorry if my English is not perfect, i'm french ;)
 

Abalsam

Active member
Hello, thank you for your answer, really

Ideally, I would like a script that disables plane mode (not do not disturb mode) a few seconds before my alarm rings.
In fact, I use the google clock application to program a music or spotify playlist for the alarm clock. The problem is that if my phone is in plane mode, the alarm doesn't go off with spotify music because it says it's not connected to the internet.
I've already tried making a macro that disables plane mode when the alarm rings, but it doesn't work (I guess the alarm rings first and then aeroplane mode disables).

The time I set my alarm is not fixed, it changes every day because my school schedule changes :(
Same thing for the weekend, I don't have a fixed wake up time.

I hope I've been as clear as possible, if you have any other questions on points I haven't been precise enough, don't hesitate, I'll try to answer them as soon as possible.

Thank you very much for your time.

Have a nice day :)

ps : sorry if my English is not perfect, i'm french ;)
There are 2 possible ways I can think of doing this. Setting the alarm through MacroDroid or setting it through the Clock app. However, since you have the alarm use Spotify, this will get complicated (not sure if MacroDroid can set Spotify for alarm...)

Need to give this some more thought. A couple of quick questions though.
1) Why do you use airplane mode? What advantage does it give you?
2) Would there be an issue if you had a macro run at say 5am (ie before the alarm could possibly ring) to disable airplane mode?
3) what clock program do you use? Is it the Google default app or something else? I am asking because the app used could change how we figure out the alarm time.

In terms of French, while I do not speak it, my wife does and my son spent a yr and a semester in France, so worst case if I really need a translation I can get one :).
 

Snurre

Well-known member
You can use HTTP GET to run a playlist from Spotify
So make a Day/time trigger (or something)
Actions: Disable Airplane mode, run http get with your playlist url
 

Abalsam

Active member
You can use HTTP GET to run a playlist from Spotify
So make a Day/time trigger (or something)
Actions: Disable Airplane mode, run http get with your playlist url
But it sounds like he wants it tied/played with his wakeup alarm (not a set time). Otherwise yes that would be an option ;).
 

Abalsam

Active member
Yes one is an interface the user is familiar with and the other one they are unfamiliar with. Since this is accommodating the user's preference, I would say it could be.
 

Snurre

Well-known member
See what you mean
Another solution could be to set the clock alarm to silent or play a short beep or some local soundfile
Then use App launched (alarm clock) as trigger to the mentioned macro
 

Abalsam

Active member
See what you mean
Another solution could be to set the clock alarm to silent or play a short beep or some local soundfile
Then use App launched (alarm clock) as trigger to the mentioned macro
Yes those are all possible which is why I am asking all of the questions I am to make sure the final product is something actually usable for them. ;). I hope that makes sense.
 

tanutanu

Well-known member
Hello, thinks for this amazing share !

I'm trying since yesterday to find a solution to disable plane mode 30 seconds before the alarm rings (so i can sleep in plane mode and wake up with spotify song alarm).

Do you have any idea if it's possible ?
And do you have any idea to make this macro ?

Thinks :)

ps : i already try to disable the plane mode when the alarm rings but it's not a spotify song which is played because the alarm rings first and then the phone disable plane mode (i'm using the google clock to wake up with spotify songs)
Think it simple:)
Write it in your local schedule or set another alarm clock with no sound for the trigger 30sec in advance.
 

Abalsam

Active member
I am leaning toward modifying this macro (to detect the next scheduled alarm) to do the following if the alarm is scheduled for the morning (defined range) set a timer trigger for 60 seconds before to disable airplane mode.
 
Top