inefficient email sync flow?

Post your questions and help other users.

Moderator: Martin

Post Reply
luke77
Posts: 1
Joined: 13 Sep 2017 07:41

inefficient email sync flow?

Post by luke77 » 11 Oct 2017 09:21

hi there,

i've got a simple flow (attached) which turns on and off the sync to a work gmail account at different times, it works well but i have a couple of issues - i'd be grateful for any advice.

the idea is it should sync all time except...

- Monday to Friday between 17.30 - 08.45 am
- Saturday and Sunday off from 17.30 until 08.45 am Monday

couple of questions...

1) is the 5 minute periodic check necessary? or is there a more efficient way for it to 'know' what time it is?! (ie 'flavour flav' mode?! :D )
2) on a Monday morning it syncs early, i think because of the Sunday midnight rule... how can i get around this with the least number of decisions?

thanks kindly for any tips!

cheers,

Luke
Attachments
emailSync.png
emailSync.png (62.13 KiB) Viewed 7136 times

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: inefficient email sync flow?

Post by Desmanto » 11 Oct 2017 17:02

luke77 wrote: - Monday to Friday between 17.30 - 08.45 am
- Saturday and Sunday off from 17.30 until 08.45 am Monday
I don't understand those two bolded sentences. Don't they mean everyday?
It seems the better phrase is you want to sync the email everyday, only from 08.45 - 17.30 (sync email during working hours, including saturday/sunday).
Use negation wording only for the special exception.

Don't use time range as the trigger. Time range only used to check extra state/condition for other trigger. If you rephrase the wording, it is more logically to say
When : time is 08.45
Do : turn on email sync

When : time is 17.30
Do : turn off email sync.
So the trigger is time, not period timer. No condition needed, only two triggers with two actions in two flows.

Since both flows only has single action, it will be wasted to keep them in two flows.
Better combine them together and check the trigger using extra condition expression.

Trigger 1 : Time: everyday 08:45
Trigger 2 : Time: everyday 17:30
Condition : Expression

Code: Select all

trigger == "Time: everyday 08:45"
Action True : Set Auto Sync on for certain email account
Action False : Set Auto Sync off for certain email account.

To add new trigger, after adding trigger 1, tap the trigger and tap the 5 line icon on the top, tap new to add the 17:30 trigger.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply