Repeat an automation every 14 days?

I have a scenario where I only need an automation to repeat every 14 days.
I work compressed work weeks and have every other Friday off. On my day off, I don’t want my office lighting routines to run.

I’ve looked at the various drivers available, but haven’t found anything to easily have a task repeat every 14 days.

Right now I’m using Hubitat’s Rule machine to set a virtual switch in Hubitat every 14 days, which is shared to Alexa.

I have another virtual switch defined in SmartThings that is also shared with Alexa.

I then have an Alexa routine that updates the SmartThings virtual switch when the Hubitat virtual switch state changes.

The switch on the SmartThings side is used as a Holiday flag; when it’s active, my office lights do not execute their weekday routines.

Once Corey’s Hubitat integration is available, I’m going to try using that to streamline things, but for now I’ve got 3 systems on the go to handle this scenario.

Is there something on the SmartThings side that could handle this easily?

Two options come to mind - I used IFTTT to replace the GCal integration smartapp. You could do that and drive it through a Google calendar (or probably others), then you have the option of including other holidays and vacations or making adjustments if your two-week cycle were to shift for some reason. Still three systems (but a different three systems!).

The other option is to use SharpTools. Here’s a rule that runs every other week. That only requires two systems.

2 Likes

Would it not be easier to have something trigger the routine when you DO want it to happen?

What is the routine you are trying? For example:
IF I open the door to the office
THEN start the lights
ONLY once a day

Something like that?

It’s a set of time based routines.

Since routines don’t support multiple conditions and associated actions in a single routine, I have to split it into three separate routines.

Monday to Friday one week and Monday to Thursday the following week (holiday switch = off):

At 7:20 AM turn on the office light at 50% brightness.
At 8:00 AM set the office light to 100% brightness.
At 4:30 PM set the office light to 50% brightness.

At 5:00 turn off the office light (this condition is set on the device itself).

I would just make 3 routines then with a door sensor added and to start them IF the door was openend.

Door sensor is a good idea, except the office door is always open.

I had a test set up for today, but unfortunately the virtual switch on the SmartThings side got reset somehow and it was off when the routine started this morning.
I’ve manually turned it on, so I’ll know shortly whether the routine is actually working.

The parallel setup I created on Hubitat with a different light worked great and is much cleaner (one routine vs three).

1 Like

@BlackRose67
“I’ve looked at the various drivers available, but haven’t found anything to easily have a task repeat every 14 days.
Is there something on the SmartThings side that could handle this easily?”

Super easy


Create virtual switch “Every other Friday”, and add routine that will Turn On or Turn Off that switch on Friday at 1am.
One Friday switch will turn On, next Friday it will turn Off, and so on and off…
Use that switch when is On every other week to do whatever you want

1 Like

Yes, that would work, but I would need to create a second set of automations for Monday thru Thursday, when I do want the light on.

Use this switch as precondition.

It is a precondition.

That’s one of the three routines that runs every weekday, except when the Holiday switch is on.

With the state of the switch only changing once a week, the light would only come on half the time with the routine written the way it is.

OK I see the problem. I would add another virtual switch that would turn on, when Holiday ST is on, and auto turn it off 23 hours later, and use that switch in your routine instead of one that that switches every other week. You will end up having 2 virtual switches, but using only one in routine. Not the perfect solution but it works. You will end up with one virtual switch being On only on every second Friday. Add that one as precondition when is off (13 days) to fire up your lights.
I have couple of virtual switches that I use to store variables like this. For example ecobee mode (heating or cooling) as current integration doesn’t have a way to continue with current mode.

What I ended up doing for this was to use IFTTT to connect the two systems together.

I have a Rule Machine rule set up in Hubitat that runs every 2 weeks; it turns on a virtual switch in Hubitat at midnight and turns it off at 11:59 PM.

IFTTT detects the Hubitat virtual switch has been turned on/off, and turns on/off the respective virtual switch in SmartThings.

The SmartThings virtual switch is used as a condition in my weekday “Smart lighting” office lighting routines.

Takes 3 to 4 seconds to activate in either direction.

1 Like

This might work.

Check out @Mariano_Colmenarejo Edge Driver Virtual Appliances Mc which has a virtual text device. In theory, I’m thinking two routines. One routine to run on Friday at 0000 if pre-condition virtual text field equals Work Week, then set virtual text field to Holiday Week with a delay of at least 2 minutes. And another routine to run on Friday at 0000 if pre-condition virtual text field equals Holiday Week, then set virtual text field to Work Week with a delay of at least 2 minutes and turn On the Holiday switch with auto-turn off in X hours. If this works, then it has the added benefit of running local on the Hub. Plus you can manually change the virtual text field to either Work Week or Holiday Week depending on your schedule, or even remove the text field completely to disable the routines from running.

2 Likes

Clever idea.

I do have his Virtual Appliance Mc driver installed.

This week is my Holiday week, so I’ve set up a test run for this afternoon to see how this works out.
Would be nice to have it all local versus C2C.

I’ll let you know how it turns out.

1 Like

I’m not really the clever one, that’s @Mariano_Colmenarejo since he (like others here creating these wonderful Edge virtual drivers) have contributed the time and effort to make things like this possible.

The text or number virtual devices are essentially variable containers.

I’ve used the virtual text device like others on this forum have to replace the STHM. So now most of my security and intrusion response routines run local now instead of cloud which the STHM does, and my routines maintain the text message notifications which kept disappearing in the STHM response section.

I’ve even setup the Android Tasker app to post via API command my current home network ISP’s IP address to a virtual text field. I’ve been planning to change it to using the virtual number fields by placing each octet of the ISP’s IP address into different number fields so that I could then setup a routine notification if my home ISP’s IP address (any number field) changes (no longer matches). But Tasker is capable of doing that on it’s own anyway.

1 Like

@BlackRose67 @DaWeav

There is a new version of Virtual Appliances Mc

3 Likes