Alternating Schedule - Is this possible?

I am attempting to figure out how to alternate a lighting schedule for my wife. I have lights that come on when I get up in the morning to go to the gym. She personally doesn't want the lights on the days she gets up to go to the gym. My issues is that we have an alternating schedule for when we go to the gym.

Our schedule: Mon, Weds, Fri. My wife will go for these days, and I will go Tues & Thurs. The following week we switch schedule and now I will go Mon, Weds, Friday and she will go Tues and Thursday.

Week 1 - Mon, Weds, Friday - ON
Week 1 - Tues, Thurs - OFF
Week 2 - Mon, Weds, Friday - OFF
Week 2 - Tues, Thurs - ON
Week 3 - Mon, Weds, Friday - ON
Week 3 - Tues, Thurs - OFF
Week 4 - Mon, Weds, Friday - OFF
Week 4 - Tues, Thurs - ON

How do I make a schedule in RM to execute this type of scheduled lighting?

This is possible, but what's missing is how you want the lights to turn on or off in the first place: motion sensor, contact sensor, just time of day, or what. You probably don't even need Ruled Machine to make that work, and other apps may be simpler to set up, but if you already have an automation that gets you part way there, someone can probably suggest an easy modification.

Sorry, forgot about this aspect in my post. I did setup an RL rule to control that. My thoughts was to enable and disable the rule with the schedule.

In that case, there are a few ways you can do it, and which is best might depend on your existing set up. But a fairly straightfoward one would be under Means to Activate Lights > Activate Lights Options, where under Limit activation under these conditions, you could select the days of the week where you don't want them to turn on.

It would then only work on those days set in RL rule, it still wouldn't alternate for the weekly cycle.

I think I figured it out. Looks terrible, but I believe this will work out. I used a boolean variable and a ton of conditions to limit it and schedule it. Resets the boolean at the end of the week on it's final execution in the schedule. I am sure I could've simplified this with ELSE statements, instead of seperate IF's.

Ah, didn't see that extra nuance.

What I was going to suggest in that case was something similar but add a variable or virtual switch to them mix. Then, use a rule to set that switch or variable to the opposite state every other week. (A periodic trigger can do that, plus, of course, the correct action for your device.) You can continue to use these as activation limitation options in RL. It may be easiest to have two instances.

But it looks like your rule might do something similar in the end, so if that works, it works! :smiley:

If I'm reading it right, what you have is actually just an alternating setting for each day, perhaps with some smarts to handle the weekend. EDIT - Now that I read a little more closely, that is actually in the title :slight_smile:

If you map out an entire two week period you end up with

Mon - ON
Tue - OFF
Wed - ON
Thu - OFF
Fri - ON
Sat - OFF
Sun - ON
Mon - OFF
Tue - ON
etc

You could just have a switch that you toggle once a day and reference that in your RL setup.

1 Like

This actually makes sense. How would you go about mapping it out? In RM or is it possible in RL?

In RM you could use the rule's Private Boolean like this

Trigger Events
When time is 6:00 AM

Actions to Run
IF (Day in [Monday, Tuesday, Wednesday, Thursday, Friday] AND Private Boolean is true) THEN
    On: Light
END-IF
IF (Private Boolean is true) THEN
    Set Private Boolean False
ELSE
    Set Private Boolean True
END-IF

You want the rule to run over the weekend to toggle the PB to keep the sequence going but take no action on the light. You could also use a virtual switch instead of the PB and just use the toggle action for the same result.

2 Likes

Thinking about this more, you don't need it to run over the weekend so the rule can be simplified

Required Expression
Day in [Monday, Tuesday, Wednesday, Thursday, Friday]

Trigger Events
When time is 6:00 AM

Actions to Run
IF (Private Boolean is true) THEN
    On: Light
    Set Private Boolean False
ELSE
    Set Private Boolean True
END-IF
2 Likes

You could also use date/Time parser isDayOfYear blah blah

Sounds like you are referring to a custom driver or app, but it’s hard to understand what you mean.

1 Like

Would 2 rules - one for wife one for husband work? something like this?

1 Like

This actually seems less complicated then my method. Would the 2nd rule just be opposite schedule and ODD from date parser for required expression?

I think this looks about right, will be testing it out the next few weeks. Much more simple than my original rule. Thanks.

1 Like

from a quick glance. that looks efficient and effective - and easy to manage :slight_smile: lot better than the old if then else statements of Basic language hehee

1 Like