[RELEASE] Sabbath/Holiday Mode Scheduler

Just came across your driver, and I like the approach. I'm relatively new to Hubitat but quite technical... I do have a question: Is "HolidayDaY" set to "1" for a regular Shabbos? I like to get a notification on my phone letting me know that everything is ready for that particular day, which I could do by testing for holidayDay >-1 if in fact is gets set to "1" for Shabbos.

It's set to -1 for a regular shabbos.

I don't think your plan works for holidays either, since the value of holidayDay isn't changed until the holiday begins. It's meant to control automations that are supposed to happen on that day, not as an advance notification.

If you want a notification before the day starts, I suggest setting up a timer that goes off a certain amount of time before the current candle lighting time. That's what I use in my setup.

Thanks for the quick reply. Timer idea sounds interesting but I'm not familiar enough with this system to get how to construct this. Would you be willing to share? :grinning:

Also, I see the value nextEventTime doesn't seem to be "exposed" but seems to match activeTime ... is there a built-in date/time conversion or method by which I could simply access the activeTime in a local normal value? For example to send as part of a notification?

Check out rule machine (built in) or webcore (my personal preference). Those are two good choices for rules engines.

activeTime is the value you want to use.

Webcore has a utility function for this, which means there is a built in way to do it. The value is a standard millisecond timestamp in GMT. Groovy is basically Java, so if you know Java, you can use standard Java methods. There's probably a more convenient way in hubitat, but I don't know what it is.

Shalom
I really need this. I am trying to switch from an Indigo system (now zwave devices ) to Hubitat. I have homes both in Boca Raton and one in the Old City (Jerusalem). I am trying to get this old brain working.

I am going to need help. I have no idea of how I get your stuff compiled and loaded on my Hubitat.

Richard

It's available in HPM.

Thanks so much. Somehow I succeeded in creating a virtual device with your code.
Looking at the device I am enthralled. For years I have had to manually enter dates into my Indigo system.
Now as an absolute newbie to Hubitat I have no idea of how this gets used.
I presume I must create an if case then give my shabbat lighting instructions. do I need to initialize.
can you give me some hints.

Also do you want some gelt for the work you saved me.

Start by reading the readme on the project's GitHub page; the link is in the first post, above. This will help you configure the device properly for each location. For now, you can skip over any sections that you don't fully understand.

Once your device is configured, all you really need to know is:

  • The device will automatically put your hub into "Shabbat" mode at candle lighting time...
  • ... and it will take your hub out of "Shabbat" mode (and put it back back into "Home" mode) when Shabbat ends.

For your lighting, you need to set up rules to turn your lights on and off at the times you want, but those rules should only be active when your hub is in "Shabbat" mode. If you want certain lights to turn on when Shabbat starts, you can also set up rules that trigger when your hub's mode changes to "Shabbat". Similarly, if you use any motion or contact sensors to control lights during the week, you should set up the rules for those devices to only be active when your hub is not in "Shabbat" mode.

Once you've learned more about how the Hubitat platform works, you might find ways to use some of the more advanced functionality in the device, so come back to the readme and look over those sections you skipped.

Quick question. Your driver ahs been working perfectly for me but I have not yet been around for a Pesach. When I look today at the driver data, I see it has Pesach set for April 5 which is correct of course. But it looks to me like the "next" event in the list is erev Shabbos, April 7! Could it somehow be in "Israel" mode? I have it set to OFF
I'm attaching a screen shot. Hope you see this in time!

Sorry, I think I figured it out... it just doesn't end yom tov after the first day because there is no havdalah mode... AND I was also confused because I forgot that all the scheduled times are GMT, so the dates looked wrong. Feeling better now :slight_smile: Thanks for a great driver!

Yes, you did. Your screenshot looks exactly as I'd expect it to. (Keep in mind that times in the state variables are stored in GMT.)

Fantastic! I'm not yet clear on what triggering events are available to use in a few scenarios, for example when there are multiple days of Yom Tov, to get my evening lights set.
I am thinking that either a shift to "Shabbat" mode (first day or Shabbat) or a change in the "holidayDay" value (second days or Shabbat following a Wednesday/Thursday holiday) would trigger a rule...
Also, any additional info on alerting that everything is set up for Shabbat Mode earlier in the day? You mentioned setting a timer, but I admit that I am not seeing and obvious way to do that using the Rule Machine, or what to test for and then send the alert...

This, then set up timers that are only active in Shabbat mode.

Thanks for the quick reply! Automations with actions based on time and testing for the mode (and sometimes the holiday) is the approach I’m using for lights out Shabbat night, and lights on for Shabbat morning, Shabbat Lunch and Havdalah (with fire). So for all those, the trigger is the time, and then "If Then" statements for mode, special holidays etc…
Where I had some confusion is what trigger to use for the evening lights when going from day 1 to day 2, so this morning I added a second trigger for the change in days, so that going into Shabbat mode OR changing the day of the holiday causes that Shabbat dinner lighting app/automation to run.
Does that sound right?
Also, I am a bit uncertain and am asking if there is a best way to use the rule engine to set up a trigger and test that Shabbat mode is coming in x hours prior to the mode shift… I am thinking that a trigger set for a specific time, say 1pm, and then actions that start with testing the current date (maybe available from a variable %now%?) against the activeTime or time attributes might be the right approach, but am not seeing which comparison operator to use, or which variable or number to enter... appreciate any specific ideas...
Thanks!

I don't use rule machine, so I can't answer that question.

Understood; I'm exploring if there is a straightforward way to get the device state variables.... and transform the dates into a Hubitat Global variable.... so that some of the device state variable dates can be compared with today's or tomorrow's date.
May be easier if I teach myself enough Java programming and offer an addition / modification to the driver :slight_smile:

I don't use those either... But I see no reason why you should need one. The device exposes everything you could possibly need as an attribute.

In case it's helpful, I'll share what I am seeing - I can see how to access the "Current States" in setting up a "Trigger"... and am doing so for Havdalah. I have not seen how to access those from the "Actions"....

I can create this example trigger, which is accessing the current state "time":
Select Trigger Events (ANY will trigger)
On Sun, Mon, Tue, Wed, Thu, Fri, Sat at Sunset-300 minutes(3:05 PM)
Shabbat and Holiday Scheduler reports times(Tue Apr 11
7:35 PM) contains %date%

But I don't seem to be able to do anything with it.... if I could get the next candlelighting date time into a variable, then I could set a conditional action that depends on it being equal to today's %date%.

What does seem workable is to set the mode from Home to Shabbat earlier - for example to increase the candle lighting time from 18 minutes to 30 or even 60 minutes. And do the same with the early Shabbat time. That way I can flash some lights and see early enough that the mode is set and the automation is running, and then delay a bit before turning on the other lights and turning off some things that need to be off....

You shouldn't be using "times" in any rules; it's not meant for that. That's what activeTime is for. All the exposed attributes are well documented in the instructions.

I think I had to develop a better understanding of what is happening when in the Sabbath/Holiday Mode Scheduler device, and how to use Unix Epoch Time (and working with GMT).
While it may not be all that useful to have an automation that reminds me that the Hubitat is going to shift to Shabbat mode later that day, but I still wanted to do it, and maybe later add some pre-Shabbat automations.

To get it to work, I created a variable in the Hubitat settings called "CurrentTime" of type "Number" with a starting value of "123456789" and then within an automation I created a local variable "nextShabbatTime" of type "Number".

For the automation, I have a daily rule triggered at 3pm. Within the actions, I am testing to see if next device activeTime is within 6 hours. If it is, then it sends me an alert (testing Pushover and the Hubitat app, but both seem to work equally well). Looks like this in Rule Machine:

Actions for Notify of next active candle lighting
set CurrentTime to now() in milliseconds
Set nextShabbatTime to Shabbat and Holiday Scheduler activeTime((1682114400000))
IF (Variable nextShabbatTime(1682114400000) <= CurrentTime(1682104373274) +21600000(T) [TRUE])
THEN
Notify Pushover: 'Next active Shabbos Candle lighting is in less than 6 hours.
Notify iPhone: 'Next Shabbos active time is in less than 6 hours.'
END-IF