Code Monkey home page Code Monkey logo

homebridge-jewish-calendar's Introduction

npm version GitHub release GitHub license verified-by-homebridge

"Jewish Calendar" Plugin

This Plugin creates a series of Contact Switches that you can use in Automation related to the Hebrew Calendar. The heavy lift of this is from he-date and sun-calc. The rest was just calculating the various events.

Example config.json:


    "accessories": [
        {
            "accessory": "JewishCalendar"
            "name": "Jewish Calendar",
            "latitude": 40.7128,
            "longitude": -74.0060,
            "candlelighting": 18,
            "havdalah": 42,
            "offset": 0,
            "israel": false,
            "sheminiatzeret_in_sukkot": false,
            "Shabbat": "Shabbes",
            "YomTov": "Yom Tov",
            "RoshHashana": "Rosh Hashana",
            "YomKippur": "Yom Kippur",
            "Sukkot": "Sukkot",
            "SheminiAtzeret": "Simchat Torah",
            "Pesach": "Passover",
            "Shavuot": "Shavuot",
            "Chanukah": "Hanukkah",
            "Kodesh": "Kodesh",
            "Mourning": "Mourning",
            "Omer": "Omer",
            "SefiratOmer": "Sefirat Omer",
            "sefiratOmerCustom": "Ashkenazi",
            "ThreeWeeks": "Three Weeks",
            "threeWeeksCustom": "Ashkenazi",
    ]

Explanation of Plugin and Config

The project was originally designed for me to have a better "Shabbat Mode" in Homekit, but for completeness I added some very specific ones. The settings in the Config for the holidays are to change spelling. I use a modern Transliterated spelling, but feel free to replace with Hebrew, Ashkenazi transliterations, English, or whatever language you prefer. If you look in the sample above, you can see a variation of languages.

Caveats

Suncalc is known to occaisionaly have issues of a few minutes. Unfortunately the other library I found was not compatible with Homebridge. If you are concerned with Halachic specificity, you need to add at least 1 minute to cover the fractional minute between updates, and 3 minutes for safety on Sun-Calc. In general, this is more useful for limiting Trigger Events in your Automation rules than serious Halachic implications.

How to Use in Automations

I use the Home App for building my scenes (to include Homepods), and the Eve App for programing. But any Homekit app should work.

Example of Programming:

Turn the Dining Room on for lunch on all Sabbath and Holidays, except Sukkot. On Sukkot, we turn the Sukkah on instead.

Trigger: Timer: 12:30 PM Conditions: Kodesh: Open Sukkot: Closed Scene: Dining Room Entertaining

Trigger: Timer 12:30 PM Conditions: Kodesh: Closed Sukkot: Closed Scene: Sukkah On

NOTE: Because of quirks in how Sun-Calc and Apple can calculate things like Sundown, I recommend that you either use a fixed Time for your Trigger, or Sundown or later. But setting it to run 15 minutes before Sundown when Shabbat: On should work.

On/Off Settings - the words may be backwards. Contact sensors are open/closed. Eve is a fantastic for editing rules but it terminology felt "backwards" for checking the settings.

Debugging your rules

You can set the Offset to add (negative to subtract) minutes to the date/time to allow you to test rules. This is important if you are testing Shabbat rules and don't want to be using your electronics on Shabbat.

If you want to code your Shabbat rules on Sunday, you can do offset: -1440, and it will run everything as though then.

Hat tip to moshed for the idea, Issue #3 #3

Silly but valid examples

Trigger: at Sundown each day Conditions: Chanukah: on

Action: turn on Menorah Outlet

Trigger: at Midnight each day Action: turn off Menorah Outlet

Use: a store/dorm that wants a Hanukkah Menorah to light up their window during Chanukah.

Trigger: at 7:00 AM Conditions: Kodesh: off Mourning: off Action: Scene Good Morning Music

If you come up with clever hacks, feel free to let me know. I mostly disable the rules fired by my motion sensors

Explanations of some Specifics:

Koshesh is true whenever Shabbat or Yom Tov is true. I have it so I can check a single value when disabling routines that run off motion sensors.

Sefirat Omer settings are: Ashkenazi: Pesach 2 -> before Lag B'omer Sephardic: Pesach 2 -> Lag B'omer Iyar: Rosh Chodesh Iyar until Sivan 3 Iyar 2: Iyar 2 until Shavuot

Three Weeks Settings: Ashkenazi: Fast of Tamuz through day after Tisha B'av Fast Sephardic: Rosh Chodesh Av through day after Tisha B'av Fast

Sukkot: is on from beginning of holiday through Shemini Atzeret. If you enable sheminiatzeret_in_sukkot in the config, it will run until Simchat Torah (or end of Shemini Atzeret in Israel). Chol Hamoed is part of this Sensor.

Pesach: runs from beginning of holiday through the end, including Chol Hamoed.

Special Thank You

Hat tip to shayweiss who found the bug and the fix. It's Suncalc Issue #11, apparently not being fixed mourner/suncalc#11

How to say thank you for this

Drop me an email, [email protected] will always forward to me and say thanks. It's happened a few times, and it really makes my day. If you want to do more, please consider a donation to your local Jewish Federation in honor of Homebridge Jewish Calendar.

homebridge-jewish-calendar's People

Contributors

scorpionmit01 avatar apexad avatar

Stargazers

Meir Vaikselbom avatar Michael J. Radwin avatar Aharon avatar

Watchers

 avatar

homebridge-jewish-calendar's Issues

Israeli independence day

Hey!
Just discovered this plugin, absolutely love it! Thank you 😇
I know it isn't a religious holiday by any means, but Israeli independence day is the only Holiday/vacation that is celebrated by Hebrew date that I can think of that is not on this plugin's list.
I would really appreciate if it can be added 🙏🏼
maybe as an optional setting.

If you do end up adding support, please take these rules into account:

  • Israeli independence day is on the Fifth of Iyar.
  • If this is a Friday or Saturday, it will be celebrated earlier, on Thursday.
  • If this is a Monday, it will be celebrated later, on Tuesday.

Omer vs. Sefirat Haomer

Now that it's that time of year I'm noticing I have 2 sensors: Omer and Sefirat Haomer. Is there a difference between the 2, or a reason to have both?

Offset Time

hey its me from the other thread. its kind of difficult to test these out as during kodesh times as you cant use the phone. would it be possible to set an offset time so that we can test this out easily

“Kodesh” sensor turning off and on unexpectedly

I’ve built 2 automations based on this plugin:

  1. Once the “Kodesh” sensor triggers On -> operate a scene that turns on all the lights needed
  2. Trigger: On 00:30 daily, Condition: if Kodesh contact is Open, Action: operate a scene that turns off all the lights needed.

In practice, light turned on as needed on Knissat Shabbat, but didn’t turn off at 00:30…

When I’ve looked at HB logs, I’ve noticed few weird things:

  1. At 00:30 there was nothing happening
  2. At 00:40 the scene of “Turn On” was triggered…

This led me to think that somewhere during evening (maybe at 00:00??) the “Kodesh” sensor was getting Off (hence on 00:30 the automation wasn’t done eventually…) but then around 00:40 “Kodesh” sensor triggered On again, which in turn activated the ”Turn On” scene…

Is that the expected behavior of the sensor?
I couldn’t see any related logs of the plug-in in HB logs - is there any option to activate it?

Kodesh turning on too early

Hello,
My Kodesh switch seems to be turning on around an hour and a half too early on shabbos. I double checked my lat/lng.

also another minor thing, the setting for “longitude” seems to say “latitude” instead.

this is awesome!

just wanted to say thanks! this plugin is awesome!

gonna try to hook this up to not allow my motion sensors to turn on lights when its kodesh

Error with the contact sensors'name with the new iOS 16.

Hello,

I can see the name in homebridge of the contact sensor, on my iPad running iPad os 15.7 but on devices with iOS 16 all sensors are named as "JewishCalendar".

Maybe with the update apple change the variable name to identify the sensor ?

node-red

hey its me again! have you considered making this a standalone node for node red. im currently using the hb contrib node to bring all my HomeKit devices into node red but this seems like an extra step.

thanks for all your hard work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.