Variable-defined time trigger

e.t.l

New member
It would be great to have (and should be simple to implement) a Trigger that is defined by a variable value in UTC.

In other words, if the user creates an integer variable and gives it a value of "1642680000", and creates a trigger defined by that variable, then that trigger will fire at noon GMT on Jan 20th 2022. They key improvement that this feature offers is that other macros would be able to change trigger time programmatically.
 

Abalsam

Active member
Currently this can be done using the stopwatch trigger.

How the stopwatch trigger works is that you calculate the difference in seconds between the time you want the trigger to invoke and the current time and define that difference as the stopwatch trigger.

The advantage of doing this is that you can set the trigger programmatically. The downside though is that if the macro is disabled and re-enabled, macrodroid is reinitialized or the phone restarted, the stopwatch trigger is lost. Therefore, using stopwatch triggers for far in the future will likely be lost unless the macro has other triggers in place to check to see if the stopwatch trigger is active and if not reactivate it.

Hope that helps
 

e.t.l

New member
The advantage of doing this is that you can set the trigger programmatically. The downside though is that if the macro is disabled and re-enabled, macrodroid is reinitialized or the phone restarted, the stopwatch trigger is lost. Therefore, using stopwatch triggers for far in the future will likely be lost unless the macro has other triggers in place to check to see if the stopwatch trigger is active and if not reactivate it.
Currently this can NOT be done using the stopwatch trigger. Thank you for illustrating exactly why.
 

Abalsam

Active member
I had a brainstorm on how to ensure persistence for a stopwatch trigger which I want to test out. If it works I will let you know. However, as an alternative, you could set up a daily trigger at say midnight that would compare the current time (adjusted to UTC) and subtract that from your trigger time. If the difference is less than a full day of seconds (86,400) set the stopwatch trigger to that amount.

I will keep you posted.
 

Abalsam

Active member
I just tested my POC stopwatch persistence macro by starting a stopwatch timer before updating macrodroid to confirm the stopwatch will restart and complete as scheduled. I can report success as the macrodroid initialized trigger ran after the update, adjusted the stopwatch trigger variable to the trigger time - the current time and then restarted the stopwatch.

It JUST fired the stopwatch trigger as scheduled before updating macrodroid.

Thanks
 
Top