Every 14 days

I need a rule that runs every 2 weeks. Yes i seached and still not understanding why this isnt work or even why this is so difficult.
CRON doesnt have 2 week or 14 day support.

We should be able to run automation without learning programming. If i want to run a rule every 18 days or 23 days or whatever we should have drop down or selections.

Take a look at Life Event Calendar. It lets you create events on a regular schedule that will run a RM rule. It is available via HPM or here. [BETA] Life Event Calendar - Never miss an important Life Event again! Schedule reminders easily and locally

Seems like it’s possible in Rule Machine…

10 Likes

Better solution than mine.

1 Like

The solution offered above by @ogiewon won't work, as Cron doesn't work that way.

To get every other week you need to use an every week schedule, and a Boolean variable or Private Boolean. Flip the variable each week, and only when true do whatever it is. That will cause it to skip every other week.

You can also use a community app called Event Engine, which allows you to create cogs (similar to rules in RM) that you can set to run at any interval. Below I've set a cog to run every two weeks (which is many, many minutes)... :wink:


Event Engine is available in Hubitat Package Manager. Very functional and flexible, easy to configure via drop-down selections, and is well supported by it's developer, @bptworld:

4 Likes

Since we're offering options, this little device driver https://raw.githubusercontent.com/thebearmay/hubitat/main/evenDaySwitch.groovy offers a even/odd week option that auto adjusts for leap year.

3 Likes

Options (both native and community) are what make HE such a strong platform. :slight_smile:

4 Likes

Curious then… how would a RM rule behave whose trigger was configured as shown above? (I.e. Periodic Daily, every 14 days). :thinking:

For more "unusual" intervals (like 23 days) i would run the rule daily and do something like this...

Create a local variable called DayCount or similar.
Trigger daily at preferred time.
Action:
Increment DayCount by +1
IF DayCount = 23 THEN
Do actions.
Set DayCount = 0
END-IF

1 Like

Cron is weird, as it is based on months for every-n-days based schedules.

Whereas if you do it every week on a given day, it gets it right:

And, Periodic Schedule is just a Cron string generator. See here: Free Online Cron Expression Generator and Describer - FreeFormatter.com

4 Likes

or maybe this would work -

Thanks for the explanation, Bruce. I can see to this leading to some amount of confusion amongst users, as cron scheduling is not all that intuitive to the vast majority of users.

4 Likes

About as intuitive as brain surgery, yes. :wink:

1 Like

That's what i need but you might as well told me i need a boggy boggy and a thing....and i have programmed in Java and C+ .... but not sure about this.

I need it to run every 14 days on Wednesday.

Any other assistance would be appreciated

I have the same setup; a reminder set for every other Friday. I use the Google Calendar App, it switches a virtual switch whenever a matching event is in your Google calendar. Once you have the app up and running you can leverage all of Google's calendar features to create your event(s).
You can find details here... [RELEASE] Google Calendar, Task, and Reminder Search

Did this not meet your needs?

First setup a Periodic Schedule trigger using weekly:

Then setup the actions:

This rule would run on the first Tuesday after it was setup, and then every two weeks thereafter. It actually wakes up every week, but only does whatever you want it to every two weeks, because the Else just flips the Private Boolean back to true.

7 Likes