In religiously-observant Jewish households, certain activities are proscribed or prohibited depending upon whether or not it's "Shabbat" (the Jewish Sabbath).
Shabbat is a weekly ritual beginning around sundown on Friday afternoon and concluding with the emergence of three stars the following night.
Precise times for the purpose of calculating Jewish religious observance can be obtained easily by polling a geolocation.
HebCal Zmanim APIsHebCal maintains a series of APIs to enable these times (called in Hebrew 'zmanim') to be programatically integrated with other services.
A Shabbat times API is used by the Jewish Shabbat Yomtov And Holidays Times And Events Home Assistant plugin (Github link).
That integration exposes (among other resources) two simple binary sensors which can be used for the purpose of triggering automations.
The resources to poll whether it is currently Shabbat or Yom Tov (a holy day) are (respectively)
is_shabbat
And
is_yomtov
This simple automation project involves creating an automation that illuminates and turns off an E27 Zigbee bulb depending upon the detected binary state.
This can be used to create decorative projects such as illuminated signage to create a visually appealing and fun way to know whether it's Shabbat or not.
Step 1: Install Jewish Sabbaths And Holidays Plugin (HACS)The plugin can be installed manually or via HACS. A supervised Home Assistant installation is required.
Search for Jewish Sabbaths and download the integration:
Because zmanim depend upon geolocation, it's essential that you have configured your geolocation in configuration.yaml:
For example:
homeassistant:
latitude: 32.0667
longitude: 34.7667
time_zone: Asia/Jerusalem
If you don't know the geocordinates of your home, you can find them easily here.
Configuration parameters are documented on the Github repository. If you're located in Jerusalem - where candle-lighting is advanced by 40 minutes - make sure to pass the jerusalem_candle: True parameter in your configuration:
An abridged version of the template configuration provided by the repository is here and can be added to configuration.yaml:
sensor:
- platform: hebcal
havdalah_calc: 42
time_before_check: 10
time_after_check: 1
jerusalem_candle: True
tzeit_hakochavim: False
omer_count_type: 0
language: english
resources:
- shabbat_in
- shabbat_out
- is_shabbat
- yomtov_in
- yomtov_out
- is_yomtov
- yomtov_name
Step 2: Create An Automation Using The is_shabbat ResourceFirstly, we'll need to integrate our E27 light (or whatever smart bulb you'd like; this integration could just as well be configured using a smart socket or smart plug!).
After adding the plugin you should restart Home Assistant.
If all has gone well, you should be able to see the entities created by the plugin by searching through all your registered entities for 'hebcal'.
I've highlighted in red the sensor that we want to use:
By clicking on the cog wheel, we can see that it's a simple False/True sensor:
With our light bulb added, let's make the actual automation:
For the trigger, we'll choose 'Entity' and then 'State':
Choose the binary Shabbat entity in the 'When' section:
The trigger should be configured for when the state turns to True
Or in YAML mode:
platform: state
entity_id:
- sensor.hebcal_is_shabbat
to: "True"
Then I just need to choose the target action as turning on the Shabbat indicator light:
Comments