Using constraint 'Time Of Day'

Lee

New member
I am trying to run a macro to turn my data settings and volume on and off during the day

I can't get it to activate the 'time of day' when time of day isn't at the trigger time

Do I need the macro to re-start at the time needed (or is it active all day once triggered) and if I do need it to re-start.... how do I do this?
Using constraint 'Time Of Day'.jpg
 
Last edited:

Dm114

Well-known member
I am trying to run a macro to turn my data settings and volume on and off during the day

I can't get it to activate the 'time of day' when time of day isn't at the trigger time

Do I need the macro to re-start at the time needed (or is it active all day once triggered) and if I do need it to re-start.... how do I do this?
View attachment 2946
To learn how triggers work, have a look to MacroDroid Wiki.

To answer your question:
1⁰) If your macro is enabled (not disabled), MD will launch it according to its triggers: here, every day at 3:30 or when MD is initialized ;
2⁰) When a macro is launched, it does what it has to do and then stops (its the normal behavior) until it is launched again.

So, your constraints are OK when testing day of week (as your macro triggers every day) but useless and inefficient when testing time of day (as your macro triggers at 3:30 only and then ends).

You must add triggers for every time of day range and test which trigger fired to know what actions to activate.
 
  • Like
Reactions: Lee

Lee

New member
Thanks @Dm114 I hadn't realised you could have more than one trigger in a macro which puts it all in the air a little...

If the bits I want only run at the times I want them to how do you mean by inefficient?

Ta for the Wiki!
 

Dm114

Well-known member
Thanks @Dm114 I hadn't realised you could have more than one trigger in a macro which puts it all in the air a little...

If the bits I want only run at the times I want them to how do you mean by inefficient?

Ta for the Wiki!
The constraints are inefficient because at the time your macro will run (i.e. 3:30) they will always be "false": at 3:30, it's not 4:30, nor 8:30...

What you have to do is:
T1: Day/Time from Mon to Sun at 4:30
T2: Day/Time from Mon to Fri at 4:46
:
Tⁿ: ...
A: IF T1 fired
A: actions according to T1 trigger
A: Else If T2 fired
A: actions according to T2 trigger
:
A: Else If Tⁿ fired
A: actions according to Tⁿ trigger
A: End If
 

Lee

New member
The constraints are inefficient because at the time your macro will run (i.e. 3:30) they will always be "false": at 3:30, it's not 4:30, nor 8:30...

What you have to do is:
T1: Day/Time from Mon to Sun at 4:30
T2: Day/Time from Mon to Fri at 4:46
:
Tⁿ: ...
A: IF T1 fired
A: actions according to T1 trigger
A: Else If T2 fired
A: actions according to T2 trigger
:
A: Else If Tⁿ fired
A: actions according to Tⁿ trigger
A: End
I see what you mean ... although if I do trigger it again at 0830 the 0430 event won't run then either so isn't that inefficient?

Cheers tho, I'll upload a multi trigger update later see what you all think
 

Dm114

Well-known member
I see what you mean ... although if I do trigger it again at 0830 the 0430 event won't run then either so isn't that inefficient?

Cheers tho, I'll upload a multi trigger update later see what you all think
I think you misunderstood how triggers really work. As explained in the MD Wiki, a trigger fires at the exact moment the associated event occurs, whatever the kind of trigger (day/time or any other kind of event).

Then, when a trigger fires, it launches the macro which executes its actions, depending on constraints or If clauses.

So, if a trigger fires at 4:30, you have to write the actions related to this time (with an If clause for instance). If another trigger fires at 8:30, you have to write other actions. Unless you want to execute the same actions. If so, add an OR clause to the If statement
 
Top