Logo

dev-resources.site

for different kinds of informations.

Shabbat / Yom Tov Home Assistant Automations — Part 2 (Helper Configuration)

Published at
3/26/2024
Categories
homeassistant
homeautomation
Author
danielrosehill
Categories
2 categories in total
homeassistant
open
homeautomation
open
Author
14 person written this
danielrosehill
open
Shabbat / Yom Tov Home Assistant Automations — Part 2 (Helper Configuration)

Jewish homeowners who want to configure automations in Home Assistant to facilitate religious observance will want to do so in two instances:

  • It’s Shabbat (a weekly event!)

  • It’s a Yom Tov (an event that occurs at intervals in the calendar)

The Jewish Sabbath Holidays Home Assistant add-on provides two sensors that are very helpful for configuring automations (these in turn are derived from the HebCal API:

sensor.hebcal_is_shabbat

This is a simple binary sensor (True/False) for determining whether or not it’s Shabbat (based upon your preconfigured candle-lighting time etc).

And:

sensor.hebcal_is_yomtov

This sensor states “No Info” unless it’s a Yom Tov (and changes to the Yom Tov name when one is in effect).

To simplify our automations, let’s try to condense both of these sensors into one state that we can (in turn) use to drive our lighting automations (etc).

I think that this is pretty straightforward, but it sometimes gets confusing thinking about devices, entities, helpers, automations, and so on.

Here’s what we’re doing:

Image description

Step 1: Create A Toggle (Type Of Helper)

Firstly, we’re going to create a toggle called Shabbat Or Hag State (name as you wish)

Image description

We could roll all of this into one automation but to make any potential troubleshooting easier I decided to create two separate automations.

Step 2: Build The Automations That Will Drive The Toggle

The Shabbat one is a bit easier.

When the Shabbat sensor moves to “True” we want to shift the toggle from off to on:

This is what I came up with:

alias: Shabbat activates Shabbat/Hag mode
description: "When the Shabbat sensor switches to 'True' we're going to turn the Shabbat or Hag toggle on"
trigger:
  - platform: state
    entity_id:
      - sensor.hebcal_is_shabbat
    to: "True"
condition: []
action:
  - service: input_boolean.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.shabbat_mode
mode: single
Enter fullscreen mode Exit fullscreen mode

For the Yom Tov sensor:

The sensor reports ‘No Info’ unless it’s a hag/Yom Tov in which case it will report the name of the hag.

The logic we need here is that we want to trigger the toggle if the sensor changes to any value other than ‘No Info’.

I used this value template (thanks to those who shared it on the Home Assistant forums).

alias: Hag triggers state
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.hebcal_is_yomtov
condition:
  - condition: template
    value_template: "{{ not is_state('sensor.hebcal_is_yomtov', 'No Info') }}"
action:
  - service: input_boolean.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.shabbat_mode
mode: single
Enter fullscreen mode Exit fullscreen mode

Step 3: Automate Based On The Toggle State

You could trigger an entire cascade of automations that trigger at various times IF it’s either Shabbat or Yom Tov:

IF it’s Shabbat or Yom Tov and 23:00, automatically get the apartment into bedtime config.
IF it’s Shabbat or Yom Tov and 09:00, automatically get the apartment into morning config.
Etc.

For instance, here’s an automation that triggers a lighting scene for the start of Shabbat/Yom Tov when the helper toggle becomes true:

alias: Start of Shabbat / Yom Tov automation
description: >-
  Activates the start of Shabbat / Yom Tov scene when the Shabbat or Yom Tov
  helper becomes true.
trigger:
  - platform: state
    entity_id:
      - input_boolean.shabbat_mode
    to: "True"
condition: []
action:
  - service: scene.turn_on
    metadata: {}
    target:
      entity_id: scene.start_of_shabbat
mode: single
Enter fullscreen mode Exit fullscreen mode

Step 4: Configure The ‘Toggle Off’ Automations

Finally we’re going to need to configure automations that reverse the toggle state (to off) when Shabbat or Hag ends.

To save a bit of time we can use the ‘Duplicate’ button in ‘Automations’.

Here’s the Shabbat one.

alias: Shabbat over, Shabbat/Hag toggle off
description: "When the Shabbat sensor reports 'false' we'll move the helper trigger to off too."
trigger:
  - platform: state
    entity_id:
      - sensor.hebcal_is_shabbat
    to: "False"
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id:
        - input_boolean.shabbat_mode
    data: {}
mode: single
Enter fullscreen mode Exit fullscreen mode

Then do the same for the hagim/Yom Tov switch. If the sensor goes back to reporting ‘No Info’ we’ll move the toggle back over to false:

alias: Hag is over, toggle goes to false
description: >-
  When the is_yomtov sensor reports 'No Info' (it's not Yom Tov) we'll move the
  toggle back to false.
trigger:
  - platform: state
    entity_id:
      - sensor.hebcal_is_yomtov
    to: No Info
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id:
        - input_boolean.shabbat_mode
    data: {}
mode: single
Enter fullscreen mode Exit fullscreen mode

Optional But Nice To Have: A Monitoring Dashboard:

My Shabbat monitoring dashboard continues to evolve.

It pulls in entities both from Home Assistant’s (built in) Jewish Calendar integration and from the aforementioned third-party one.

It serves two purposes: before Shabbat get Shabbat times. And monitoring and troubleshooting, if required (the right column / ‘Automation States’).

Image description

homeautomation Article's
30 articles in total
Favicon
The Future of Smart Homes: Top Devices, Trends & Innovations for 2024
Favicon
Tektronix Technologies: Home Automation Experts in Dubai, Abu Dhabi & Beyond
Favicon
Replace Philips Hue automation with Home Assistant's
Favicon
Navigating the Future: Smart Home Innovations and IoT Trends You Need to Know
Favicon
The Home Assistant model
Favicon
Revolutionizing Living Spaces: The Latest in Smart Home & IoT Innovations
Favicon
Revolutionizing Smart Homes: Apple’s Bold Step into IoT with Intelligent Innovations
Favicon
Unlocking the Future: Top Smart Home Devices & Trends of 2024
Favicon
Smart Cupboard System with Robotic Arm: Precision and Accessibility in Home Automation
Favicon
Apple's Next Big Thing: Smart Home Displays Set to Change Our Homes in 2025
Favicon
Apple's Game-Changer: New Smart Home Device Set for 2025 Unveiling
Favicon
Unlocking the Future: Exciting Innovations in Smart Home and IoT for 2024
Favicon
Unlocking the Future: Smart Home Breakthroughs and IoT Innovations
Favicon
MajorDom — Your Effortlessly Simple Smart Home, Launched on Kickstarter
Favicon
Smarter Than You Think: NLP-Powered Voice Assistants
Favicon
Building Smart Home Automation with JavaScript
Favicon
Crafting My Perfect Home Assistant Dashboard
Favicon
Raspberry Pi: What you need to know
Favicon
Unlocking Vision: Evaluating LLMs for Home Security
Favicon
Is it Dry Yet?
Favicon
Creating NFC Or QR Code Automations In Home Assistant Using Webhooks
Favicon
Shabbat / Yom Tov Home Assistant Automations — Part 2 (Helper Configuration)
Favicon
Live Average Carbon Intensity rating with Octopus Home Mini in Home Assistant
Favicon
Atom8 Robotic Lab's Comprehensive Home Automation Solutions
Favicon
The Role of LIN Protocol in Smart Home Automation
Favicon
The Future of Smart Homes: How IoT is Changing the Way We Live
Favicon
Adding school morning routine for my son via Homeassistant
Favicon
First Month With My Raspberry Pi
Favicon
How to Control Philips Wiz Bulb Using Go
Favicon
Open-source Sonos apps

Featured ones: