[APP][Pro] CronJob - Trigger Flows with Cron Expressions

A very simple cron scheduler. I didn’t want to have to create a separate device or handle some hidden away app settings just to run a flow on a certain schedule as some other apps do.

You can use any cron expression which is supported by cron - npm (npmjs.com).

You can use online tools like Crontab.guru - The cron schedule expression generator to help you generate your desired cron expression.

Some examples:

  • 0 0,12 1 */2 * → On the first day of every second month at midnight and noon
  • 30 5-20/3 * * * → 30 seconds after every third full hour between 05:00 and 20:00+
  • */5 * * 6-9 1-5 → Every 5 minutes on weekdays (Mo-Fr) in summer months (June-September)

Stable Version: CronJob App for Homey | Homey
Source Code: github.com

Any suggestions or additional translations are welcome. But I explicitly want to keep the App somewhat simple.

If you like what I have created you can buy me a beer through Paypal.

5 Likes

Great, I grew up (IT wise) with UNIX systems in the 1980s. Though it is some time ago, I fell like home. It is the natural way for recurring jobs for Linux based systems and still one of the most flexible systems.
For example when you have many jobs that have to run once every hour, you can spread them over the hour, that you don’t have high cpu usage at the beginning of the hour.
And for tasks like every 20 minutes from 6am to 8pm, on Mondays, Tuesdays and Fridays, and only during summer months you don’t need complicated And… cards.
I will love it definitely.
Many thanks :pray: :heart::people_hugging:

1 Like

How do you stop the cronjob?
Just delete the card?

Hi @Anders_Gregow ,
I do not really understand, what you want to do?

  • The flow starts each time the condition is met and stops, when there there is nothing else to do.
  • When you do not want the flows start after a defined hour/day/month, just put it in the condition.
  • If you think you do not need the flow temporarily, you can de-activate the flow. And you can activate it again whenever you need it.
  • If you want to do it by any external control (e.g. a variable), you can do it by checking the variable in an And condition card.
  • If you don’t need the flow any longer, you can delete the entire flow.
  • Only in the case, you have many When conditions (triggers) in an advanced flow and one of them is now obsolete, it is useful to delete the single card in the flow.
    So I hope your understanding of “stop the cronjob” is included in my answers.
1 Like

If I have a cronjob triggering every hour on wednesdays it will re-trigger automatically (of course).
But when I do not want this to trigger any more (I want to remove the cronjob), do I then delete the flow triggered by the cron job?

e.g.
“Schedule … triggered” → send push-notis to myself.

If I remove the “Schedule … triggered”, will the cronjob stop and be removed? If I understand your answers correctly, the answer is “YES”. :slight_smile:

Why I ask is due to “normally” you start a timer with a “Start timer” card and then use a “Timer triggered” card.
Not calling the “Start timer” will disable the timer, i.e. “removing” it.

In case, you are sure you won’t need the flow again in the near future (e.g. up to one year) just delete the flow. If you only delete the card, you keep an unusable flow.
If you might want to use it again. just de-activate it. In case, you want to use it again (maybe after some amendments) you can activate it again.

1 Like