Cron every X seconds?

Is it possible to use cron in flow to run every 5 seconds or more?

I tried this:

*/5 * * * * *

But the app says:

Cron expression contains 6 parts but we expect one of [5]

How should I do this?

Try to remove one unit as KWGT only use 5:

*/5 * * * *

Then it won’t do seconds but minutes. Exactly 5 minutes.

Is there a way to use cron in seconds in KLWP?

If you want to run a FLOW every 5 seconds you need a formula trigger just use $df(S)/5$, then select “on output changed” in the trigger options, this will trigger the flow every 5 seconds. You can use the same formula anywhere.

1 Like

Thank you, this worked.

Btw, for example, I have a text global count. And a flow to increment the count global by 1, automatically every 5 seconds.

Suppose the count is now 10 but I manually override it to 5, and when the flow starts to change the count, it does not change the count from 5 to 6 but instead 11.

How do I workaround this issue?

Tried this but it changes and then rapidly changes to the following number.

For example: if it was meant to change from 1 to 2, it changes to 2 then in next second to 3.

Visually:

1 > 2,3
3 > 4,5
5 > 6,7
7 > 8,9
9 > …

If you want to increment a variable every 5 seconds this is not the right way to do it, its much better to count seconds from a given time and then divide by 5. So for example.

$tf(0m0s, S)/5$

Will give the number of seconds from the start of the current hour (0 mins and 0 secs) up to now divided by 5.

If you want to reset this with a button you can set a global variable to

dp()

Then parse it back like:

$tf(gv(globalsetwithdp), S)/5

This will tell you how many “5 seconds clicks” have passed since “globalsetwithdp” has been set with dp()

1 Like