# Home Assistant Shabbat & Yom Tov Automations

This post details how to configure Home Assistant to support the observance of Shabbat and Yom Tov. This is an updated guide, building on previous documentation with modifications that simplify the setup process.

AI credit: Cloud 3.5 Sonnet for rewriting some of the previous YAML in order to avoid redundancies and unnecessary additional automations.

If you're interested in this topic, you are likely already familiar with Shabbat, Yom Tov, and Home Assistant.

For those who aren't, these observances involve refraining from using electricity for a 24-hour period, making them ideal for home automation.

Part 1: Configuring Time Sensors

In order to provide the automations with the correct times for Shabbat, we need to use a sensor providing these. Additionally, we need to make sure that our geolocation is correctly configured in Home Assistant because Jewish religious times are geosensitive. You might have this configured out of the box, or if not, you can add it.

The sensors for providing the zmanim (religious times) are:

Hebcal API: This API provides the necessary data for Jewish religious times.

Jewish-Sabbaths-Holidays Home Assistant integration: This integration makes the Hebcal API accessible within Home Assistant. It's available through HACS.

Configuring Your Geolocation

To get started, ensure your geolocation is configured in Home Assistant. This is required for accurate time calculations. In your configuration.yaml file:

homeassistant: latitude: 32.0667 longitude: 34.7667 time_zone: Asia/Jerusalem

Replace the example coordinates with your own, and choose the right time zone.

You can find coordinates using various utilities like this one. You'll also need to have HACS installed.

Adding Shabbat Settings

Once we have integrated the sensor providing the Shabbat and Yom Tov times, we need to make sure that it is properly configured in our configuration.yaml .

The following YAML provides a baseline configuration for HebCal (at the time of writing).

sensor: - platform: hebcal resources: - shabbat_in - shabbat_out

In the above code, we are making sure that HebCal is integrated with our Home Assistant and telling it that we will be using the shabbat_in and shabbat_out sensors (only).

However, we can configure more granular settings such as using the name of the Yom Tov, specifying what havdalah setting we wish to use and even calling in the resource which provides the name of the weekly parsha.

One of the nice things that you can do with all this sensor data is to configure a dashboard to run on a display tablet during Shabbat.

Here's a recent version of one that I set up.

You might notice that I have the red alert sensors configured also as well as the current weather in Jerusalem. These are provided through the Home Alert integration and then styled a little for presentation:

type: custom:button-card entity: binary_sensor.oref_alert_jerusalem_all_areas name: Jerusalem All Areas icon: mdi:check-circle styles: card: - padding: 12px name: - font-weight: bold - color: white state: - color: white icon: - color: white - width: 24px - height: 24px state: - value: "on" name: Jerusalem All Areas (UNSAFE) icon: mdi:alert-octagram styles: card: - background-color: "#ea4335" icon: - animation: blink 1s ease infinite - value: "off" name: Jerusalem All Areas (Safe) styles: card: - background-color: "#34a853" - value: unavailable styles: card: - background-color: "#ffa500"

I have this running on a Android display tablet and have also automated the turning on and turning off of the tablet to coincide with Shabbat.

Here's what a more extensive configuration for the HebCal sensor might look like:

sensor: - platform: hebcal havdalah_calc: 42 time_before_check: 10 time_after_check: 1 jerusalem_candle: False tzeit_hakochavim: False omer_count_type: 0 language: english resources: - shabbat_in - shabbat_out - parasha - hebrew_date - is_shabbat - yomtov_in - yomtov_out - is_yomtov - yomtov_name - event_name - omer_day - zmanim

Refer to the add-on’s Github repository for full configuration options.

Creating a Combined Shabbat and Yom Tov Sensor To Drive Automations

The Jewish Sabbaths and Holidays Times integration provides, out of the box, two binary sensors to use in Home Assistant: is_shabbat and is_yomtov .

But for my specific use case, and likely for many others, it's more practical to use a single binary sensor that indicates if it is either Shabbat or Yom Tov.

To enable this, I created a binary sensor, which is a sensor template that works downstream of the sensors provided through the add-on. The additional benefit of doing this means that if you later want to use a different method for determining zmanim, you can simply update your sensor template with a new upstream provider.

binary_sensor: - platform: template sensors: is_shabbat: friendly_name: "Is Shabbat" value_template: " {{ states('sensor.hebcal_is_it_shabbat') == 'True' }} " is_yom_tov: friendly_name: "Is Yom Tov" value_template: " {{ states('sensor.hebcal_is_it_yom_tov') != 'No Info' }} " is_shabbat_or_yom_tov: friendly_name: "Is Shabbat or Yom Tov" value_template: >- {{ states('sensor.hebcal_is_it_shabbat') == 'True' or states('sensor.hebcal_is_it_yom_tov') != 'No Info' }}

The above YAML should be added to your Home Assistant instance’s default configuration file ( configuration.yaml ) and creates three downstream sensors: one for Shabbat, the other for Yom Tov and the final one that runs against both. This approach provides you the flexibility to create automations which are specific to Shabbat or Yom Tov. But I'd venture to guess that for most people the last is like me the one that will be useful

The Is Yom Tov? sensor provided by the Jewish holidays add-on reports either with the name of the Yom Tov or with ‘No Info’. So my filtering logic uses an “anything other than No Info'“) check to translate that into a true/false binary value which we can use for driving the automations:

If the state of the upstream Yom Tov checking sensor ( sensor.hebcal_is_it_yom_tov ) is anything other than ‘No Info’, it's determined to be ‘True’, and ‘No Info’ is interpreted as a false binary sensor state.

Needless to say, if the add-on changes its logic, you'll need to modify the configuration just a bit.

Part 2: Configuring Automations

Using the Combined Sensor for Automations

The point of configuring sensors to check whether it's Shabbat or Yom Tov is to drive a series of automations around the house to automate the turning on and off of lights, switches and appliances when it’s Shabbat or Yom Tov.

My method of doing this is creating different scenes for different times over Shabbat and in the automation adding the sensor state condition check as a conditional so that the automations will only run on Shabbat or Yom Tov and not on regular days.

I've created several scenes for different times during Shabbat and Yom Tov:

Start of Shabbat/Hag

Evening

Morning

Afternoon

End of Shabbat/Hag

The last one turns off the Shabbat or Hag visual indicators which are just Zigbee E27s that I’ve set up specifically for this purpose (see: below). When Shabbat is in they come on and when it's out they turn off.

A down the line aspiration is to build a more decorative Shabbat state indicator using the same bulbs.

Create Your Scenes For Various Shabbat Times

Before we create the linking automations, we'll need to set up the scenes for various times on Shabbat.

A start of Shabbat scene might be turning on the living room lights while turning off the lighting and switches in the home office for example.

A bedtime Shabbat scene might be turning off the lights in the living areas and bedrooms. Etc, etc. Modify according to your own requirements!

Create these just as you would any other scene in Home Assistants and give them a clearly identifiable name:

Linking Scenes to Automations

Now we've set up our sensors, configured our scenes, and all that's left to do is create the automations that bring everything together.

While Home Assistant can sometimes seem frustratingly complicated, there are some advantages to taking the approaches that it kind of forces you to work with: it's easy to update the run times for any of the scenes when those are configured in automations - you can simply update the trigger time for any of them!

This is useful when you might want to tweak air conditioner settings or lights on and off times according to the season. Alternatively, you could add a separate sensor that is active when you have guests staying over and which can add additional configurations to a guest bedroom. These can all be tied together in an automation.

If, like me, you find writing YAML slightly crazy-inducing, this is one of the LLM use cases that first got me amazed by them. I haven't tried this automation yet, so configure it at your own caution, but here is a quick one that Claude drafted asking for a guest mode button:

automation: - alias: "Guest Mode - Start Monitoring" trigger: - platform: state entity_id: input_boolean.guest_mode to: 'on' action: - service: automation.turn_on target: entity_id: - automation.guest_mode_lights_on_morning - automation.guest_mode_lights_off_night - alias: "Guest Mode - Lights On Morning" trigger: - platform: time at: "07:00:00" condition: - condition: state entity_id: input_boolean.guest_mode state: 'on' action: - service: light.turn_on target: entity_id: light.guest_room data: brightness: 255 - alias: "Guest Mode - Lights Off Night" trigger: - platform: time at: "22:00:00" condition: - condition: state entity_id: input_boolean.guest_mode state: 'on' action: - service: light.turn_off target: entity_id: light.guest_room - alias: "Guest Mode - End Monitoring" trigger: - platform: state entity_id: input_boolean.guest_mode to: 'on' for: hours: 24 action: - service: input_boolean.turn_off target: entity_id: input_boolean.guest_mode - service: automation.turn_off target: entity_id: - automation.guest_mode_lights_on_morning - automation.guest_mode_lights_off_night

Here's an example automation for triggering the Shabbat bedtime at midnight that has the condition that my downstream sensor needs to be true in order to run. This condition check prevents it from running on any other day. As you can see, I have added a living room AC scene in order to turn off the air conditioning in the living space.

alias: Shabbat or Hag bedtime description: Triggers bedtime lighting on Shabbat or Hag triggers: - at: "00:00:00" trigger: time conditions: - condition: state entity_id: binary_sensor.is_shabbat_or_yom_tov state: "on" actions: - metadata: {} target: entity_id: scene.shabbat_bedtime action: scene.turn_on data: {} - metadata: {} target: entity_id: scene.living_room_ac_off action: scene.turn_on data: {} mode: single

Optional: Shabbat Control Dashboards

Finally, you might want to add a control dashboard to do things like add an occasional guest mode switch and monitor that everything is working as expected. This is especially valuable the first time that you set it up and you want to be able to check that everything is running as expected.

I added quick links to the various scenes in my dashboard to make it easy to periodically update values and have monitoring entities for the sensors driving the automations and the individual peripherals that need to be controlled by them:

Enjoy Your Shabbat Automated Home!

In order to get going with Home Assistant, I picked up an industrial fanless mini PC and installed Home Assistant OS on Proxmox. But if you don't envision making other use of the mini PC, it makes more sense to install Home Assistant OS on bare metal. It can also be run as a Docker container, but doing so will limit your ability to access much of this functionality. So HAOS is, in my view, the definite way to go.

You’ll also probably want to pick up a ZigBee coordinator and Zigbee devices to control:

E27 light bulbs

Light switches

Smart plugs

It might seem like a lot but the nice thing about Home Assistant is that you can gradually build out your smart home over time. I started with AliExpress Tuya devices, then picked up my coordinator and purchased ZigBee devices as my mesh network took shape (I use MQTT).

Good luck!

**Source:** [https://heyitworks.tech/home-assistant-automations-for-yom-tov-shabbat-observance](https://heyitworks.tech/home-assistant-automations-for-yom-tov-shabbat-observance)