RM to control modes instead of Mode Manager, need Help with HOLIDAYS

Thanks for catching the Evening/Night issue..

The 8p was more about my kids bedtimes than anything else.. I'll need to adjust things to make sure evening comes first!

I'm interested in something like this as well. (Long time lurker - I have a few rules but not many).

My issue is that I have some motion sensors, but I am Jewish and on Sabbath we can't use motion sensors. It's easy enough to schedule the motion sensors to be off from Friday evening to Saturday night, but the issue is that when Holidays fall on weekdays. So I would love a way to set up automatic "Holiday" modes based on a calendar, that allows me to enter "Sabbath" mode and pause my other modes.

Presence is awesome, but unfortunately not able to be used on Sabbath and Holidays..

1 Like

Welcome to the community... very friendly here

Hopefully we find a way to search calendars for dates to enable modes.

You can use a rule in Rule Machine to do this, based on dates. I guess it would be a bit of a hassle as the dates vary, so the rule would need updating from time to time to have the right dates. But, you could certainly have a Holiday mode, and use that mode to disable those automations that should not run during that mode.

@dannyzen ported a SmartThings app that uses the Hebcal.com API for Sabbath and holidays.
hubitat_shabbat/shabbat-and-holiday-modes.groovy at master ¡ Dannyzen/hubitat_shabbat ¡ GitHub

2 Likes

thanks! my app does work for holidays during the week which prohibit the usage f electricity (yomtov) as it gets candle lighting times from hebcal.com. if you need help lmk, happy to lend a hand for setup.

3 Likes

now that I'm thinking about it. importing calendars could be interesting functionality. just a thought.

1 Like

Thanks so much!!! Not sure how many people will find this of value, but I'm very appreciative!

So at candle lighting it turns on a mode and at Havdala returns the mode back to "___"? So for a 2-3 day holiday, the mode change happens daily or just once?

I have Sabbath start based on times every Fri and end on Sat evening. So I have rules that say when Sabbath starts set the lights in such a way. If your app changes the mode on a Monday, that would do the same thing for my rule, but it won't help on Tuesday night.

Do you know a way to set a rule to "check" a mode status, instead of being triggered by a "rule change"?

Also, does your app distinguish between Yom Tov and non-restrictive dates, like chol hamoed/Purim, etc?

Thanks
(Sorry not sure why my messages keep getting listed as SPAM @bravenel?)

So glad you're interested. I've updated the readme and hope that it answers all of your questions :slight_smile:

Amazing work. More info always leads to more questions :frowning:

  1. love the groups idea- how do I make a “group”?
  2. even though it can’t distinguish between Purim and pesach, that doesn’t matter because Purim doesn’t have candle lighting, correct? This issue does persist for Hanukkah but I think I’ll manage for those days.
  3. with regards to “after Shabbat” is that a mode? Is that different than just a "night" mode? Since all Yomtovs end at night?
  4. I assume the notification just shoots off whenever "shabbat" mode is entered?

THANKS FOR THE GREAT IDEAS!!
My Lutron dimmers won't toggle.. but will definitely make them go on and off, Love IT!!

love the groups idea- how do I make a “group”?
https://docs.hubitat.com/index.php?title=Groups_and_Scenes

even though it can’t distinguish between Purim and pesach, that doesn’t matter because Purim doesn’t have candle lighting, correct? This issue does persist for Hanukkah but I think I’ll manage for those days.
Correct.

with regards to “after Shabbat” is that a mode? Is that different than just a "night" mode? Since all Yomtovs end at night?
You got it. I use two different modes as I use 'night' for a totally different scene for my home and switching from shabbat to night when shabbos ends at 6pm isn't the experience I want.

I assume the notification just shoots off whenever "shabbat" mode is entered?
Correct! Why Are Shabbat Candles Lit 18 Minutes Before Sunset? - Shabbat for the '18 minute' rule. In this case, since we get a notification 'at candle lighting time' we still have 18 minutes before we turn into a pumpkin. :slight_smile:

What are your thoughts on this for YomTov? (for everyone else Sabbath is typically only 25 hours from sunset Friday until sunset on Saturday -but a 2 or 3 day "sabbath-like" holiday can occur throughout the year. Basically I want the "Lights - Sabbath" rule to run every day for 2-3 days.

I've never done a repeating event before so would love some help. I made a separate rule that when the mode changes to "After-Sabbath" it should pause this rule... is that how the "stopable" repeating event works? What is a better way to accomplish this?
@aaiyar.. if you don’t mind weighing in?

Caveat emptor - my rule machine skills are very poor. However, I think this will work, assuming that Mode becomes Shabbat well before Sunset on the first day.

Want to add - I think this is a very clever use of automation that will help you celebrate the High Holidays!

Thanks!

  1. how much before sunset? Typically mode becomes “Shabbat” about 18 minutes prior to sunset?
  2. so on a regular week, when sabbath is only Friday night and Saturday, will the changing of the mode to “after sabbath” cancel this repetition after just 1 go through? The “after sabbath” rule is set to pause this rule when it comes on... (hope I explained that well...) or is there a better way to signify not to keep repeating within this rule?

I appreciate your honesty about your expertise with RM, is there someone else I should ask? I apologize for bringing you in, you seem pretty active in most threads.

Robert (@bertabcd1234) is extremely knowledgeable. I'm tagging him in the hope that he has the time to go over your automation.

Confession: I don't like repeating rules and avoid them whenever I can. :slight_smile: I often refer people to this thread from Bruce (the RM author), where he provides several examples and explanations of what works. It's also possible that I don't understand something that your rule is trying to accomplish, but I agree with @aaiyar that your rule looks to me like it should do what you want (as long as sunset doesn't get earlier by more than 30 or so minutes each night).

Again keeping in mind that I might not understand something that is trying to be accomplished with this rule, I think you might be able to do it without repeats and make it a little simpler to write (and understand, at least for me). Here's what I'm thinking:

Trigger: Time is sunset

Actions:

IF (Mode is Shabatt) THEN
  Dim: Kitchen Lights: 50
  Dim: Living Room 1, Main Hall, Dining Room Playroom, Living Room 2: 35
  Wait for events: When time is 6:30 AM EDT
  Dim: Living Room 1, Playroom, Kitchen: 60
  Wait for events: When time is 11:00 AM EDT
  Dim: Kitchen Lights: 90
  Dim: Living Room 1, Main Hall, Dining Room, Living Room 2: 40
END-IF

The tradeoff is that this rule triggers every day at sunset, even if the mode is not Shabbat, instead of triggering based only on the mode becoming Shabbat (and then, in either case, creating specific scheduled jobs from there). However, unless you have a lot of things happening at that time or are otherwise taxing your hub, this should be inconsequential (in my opinion), especially because it will more or less immediately exit if the condition (the mode) isn't met.

Again, I might be missing something, so feel free to comment--anyone--if this doesn't seem right! (Or if you totally disagree and think repeats make this easier.)

2 Likes

I really appreciate you taking a stab at it!

The only issue I can see (which is something I was struggling with) is that on every single week sabbath starts at sunset on Friday and ends about an hour after sunset on Saturday. So I set the rule like I did because on Saturday at sunset, the mode will still be sabbath, but I don’t want the rule to trigger because sabbath will be over in an hour. So I was looking for a way to do what you are doing, BUT TO HAVE A WAY TO EXIT THE RULE. At the end of sabbath the mode automatically switches to “after-sabbath”, and then to either evening or night depending... so would a “after sabbath rule” that cancels “Lights-Sabbath” work to stop this rule? I guess as part of that rule I could undo the light changes made here... hmmm

Something to ponder.

Side question: if a rule is triggered by an “if mode is x”, when and how often would RM check to see if that condition is met?

Will take a look at that other post as well

Triggers are events, not conditions. Alternatively stated, they are momentary/durationless (something that happens: it becoming a specific time, a sensor opening or closing, etc.). Conditions are evaluations of states that can be said to be "true" or "false," like "is this contact sensor open?".

So the answer to this question is: RM doesn't really "check," it just responds at the exact time the trigger matches (here, when mode becomes Shabbat) and runs the actions accordingly. If you want to check for conditions, the Actions section is the place to do that. You can see a simple example of that in the above.

Is the last time these actions run always a specific day of week? (Sorry for my lack of knowledge here.) If so, you could add it as an additional condition in the rule wherever needed. And if knowing this helps, "Exit Rule" is also an action you can run (stops running the action list, sometimes easier than writing all your conditionals in such a way that undesirable actions don't run under a specific condition). Alternatively, maybe you could use a local (or global) variable to count the number of times it has run so far and work this variable's value into a condition where needed as well. Just a couple ideas that might help!

1 Like

I see, so a conditional event can never be the trigger. I missed that you changed the trigger to sunset, instead of mode change.

First, please do not apologize, if it's not your religion then there is no reason you should have all the knowledge; in fact it is mine and I still don't know/understand all of the rules. In short - no. Sabbath in and of itself occurs every single Friday at Sunset until Saturday about an hour after sundown (during that time we can't use electricity - hence setting all the lights to timers [a bit of a work-around]). It is easy to plan and execute for Sabbath since it is every single week.

The tricky part here is that we have a number of holidays throughout the year (typically 2 days) where we have a "sabbath-like" day (no electricity) and those can occur on any day of the week (follows the lunar calendar). So for example, Passover may start on a Monday night (sunset) and end on Wednesday (hour after sunset). In addition, if the holiday starts on a Wednesday night and goes until Friday night, then it goes right into Sabbath so effectively its a 3 day period of no electricity. This was probably more background than you needed...

Dannyzen's app (above) is amazing in that it will find all of these dates for me throughout the year and will change my mode to "sabbath" (or any mode I choose) on sunset on those dates. But in the example above, it will set my mode to "sabbath" on Wednesday night for the holiday, but then it stays "sabbath" until the holiday/sabbath ends on Saturday night. I'm looking for a way to repeat this set of lighting rules to start on Wednesday at sunset and continue through Thursday, Friday, and Saturday until Saturday night, when the mode switches to "After-Sabbath". But if the holiday falls on a Monday night and ends on a Wednesday night, I only need the rules to run for 2 periods instead of 3 in the prior example. And on the Sabbath that occurs EVERY SINGLE WEEK, I only need it to run once...

Basically, I want it to start running when the mode becomes "Sabbath" and run every single day until the mode becomes "After-Sabbath" - hopefully this helps you understand a little bit, even if you can't help me with my rules :wink:

Your help is greatly appreciated!