Skip to content

Instantly share code, notes, and snippets.

@danielrosehill
Last active May 15, 2025 20:09
Show Gist options
  • Save danielrosehill/16c2195a35e3c7badd79f71b561b6885 to your computer and use it in GitHub Desktop.
Save danielrosehill/16c2195a35e3c7badd79f71b561b6885 to your computer and use it in GitHub Desktop.

Combined Shabbat or Yom Tov Binary Sensor for Home Assistant

This example uses the Jewish Sabbaths & Holidays integration by rt400, which provides a variety of sensors including:

  • sensor.hebcal_is_shabbat β€” returns 'True' if it's currently Shabbat, otherwise 'False'
  • sensor.hebcal_is_yomtov β€” returns 'No Info' if it's not Yom Tov, otherwise a string with the holiday name

If you want to drive automations based on either Shabbat or Yom Tov, you can create a combined binary sensor using a template sensor.


Logic

We define a binary_sensor.is_shabbat_or_yomtov which returns on if:

  • sensor.hebcal_is_shabbat is 'True' OR
  • sensor.hebcal_is_yomtov is anything other than 'No Info'

πŸ› οΈ YAML Configuration

Add this under your binary_sensor: section:

- platform: template
  sensors:
    is_shabbat_or_yomtov:
      friendly_name: "Is it Shabbat or Yom Tov"
      value_template: >-
        {{ is_state('sensor.hebcal_is_shabbat', 'True') or not is_state('sensor.hebcal_is_yomtov', 'No Info') }}
      icon_template: >-
        {% if is_state('sensor.hebcal_is_shabbat', 'True') or not is_state('sensor.hebcal_is_yomtov', 'No Info') %}
          mdi:candle
        {% else %}
          mdi:calendar-remove
        {% endif %}

πŸ’‘ Use Case

This is useful for:

  • Controlling lighting automations on holy days
  • Muting notifications
  • Displaying a clear Shabbat/Yom Tov status indicator on dashboards

πŸ“Ž Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment