📅 Flow Scheduler - Rik van den Reijen Habits

by Rik van den Reijen

Version 1 (April 12, 2021)

Download (38 downloads)

--- Rik van den Reijen habits variant mobile

𝘉𝘺 𝘗𝘢𝘵𝘳𝘪𝘤𝘬 𝘊𝘰𝘳𝘨𝘢𝘯
Run any of your flows whenever you want. Allows you to schedule time of day, and specify a payload value to be passed to the flow. You can schedule the flow weekly (any combination of weekdays, including all), monthly (any one day in each selected month), or by interval (every 𝘹 minutes). If you schedule a flow by interval, you won't choose a start time; the flow will start 𝘹 minutes after it's added to the schedule (or after the schedule restarts; see below), and every 𝘹 minutes thereafter.
If the flow you are scheduling requires internet access, the scheduler can check for a connection before starting the flow.
If the scheduler can't start the scheduled flow, it will log the error. If the flow or flow beginning can't be found, the flow will be unscheduled.
You can schedule a flow, unschedule a flow, view the schedule, and clear the schedule.
If the flow stops, the schedule will automatically restart when the flow is restarted.

𝗡𝗼𝘁𝗲𝘀
If you select multiple months, this flow will not let you choose a day that would be after the last day of the shortest month selected (leap years are not considered, so February will always limit you to 28 days).
This behavior is due to the way dates are handled in Android. If you were to select June 31st, the "Time await" block would fire on July 1st; February 30th would cause it to fire on March 1st or 2nd, depending on leap year.
The best way to deal with this, if you want a flow to run on the last day of every month (for example), is to schedule that flow three times. Once for February 28th; once for April, June, September, and November 30th; and once for January, March, May, July, August, October, and December 31st.

🔸𝙍𝙚𝙦𝙪𝙞𝙧𝙚𝙨 𝙥𝙧𝙚𝙢𝙞𝙪𝙢🔸

⚡𝘊𝘰𝘯𝘴𝘵𝘳𝘶𝘤𝘵𝘪𝘷𝘦 𝘤𝘰𝘮𝘮𝘦𝘯𝘵𝘴 𝘢𝘯𝘥 𝘤𝘳𝘪𝘵𝘪𝘤𝘪𝘴𝘮𝘴 𝘢𝘳𝘦 𝘢𝘭𝘸𝘢𝘺𝘴 𝘸𝘦𝘭𝘤𝘰𝘮𝘦. 𝘛𝘩𝘢𝘯𝘬 𝘺𝘰𝘶!⚡

Version 2: Fixed unconnected block that was preventing scheduled flow from running.

Versions 3, 4, & 5:
-Minor code optimization
-Error trapping and logging
-Added option to check for internet connection prior to running scheduled flow.

Version 6: Fixed bug that caused the scheduler to forget whether an internet connection is required for a scheduled flow after the schedule was restarted.

Version 7: Added option to schedule flows by interval.

[Also: It's a hand. How cool is that? 👆]