Shabbos Mode

The following is a complete breakdown of my Home Assistant Shabbos Mode. It includes 48 light switches, 6 light bulbs, 7 Echos, and a Zwave siren. I have 4 bathrooms which have zwave motion detection light switches (not allowed on shabbos) which get disabled. It uses the Jewish Calendar integration for the automatic turning on and off of this special mode. It will also fire for yom tov (holidays). I put a lot of time and effort in to getting this to be perfect, so I figure, why not share in case someone else needs it.

You will need to have the following items configured before beginning:
Jewish Calendar integration

jewish_calendar:
  language: english
  diaspora: true
  havdalah_minutes_after_sunset: 45

An input select helper named “Mode”, this is the most integral part of my whole Home Assistant operation. There are 3 possible values: Home, Away, or Shabbos. I can preform (or restrict) automations from firing based on this setting. Also you will see that Shabbos Mode activation or deactivation is fired from the changing of this item (in case I want to turn on Shabbos mode manually).

An input select helper named “Shabbos_Guests”, this helper will have 3 options: “No Guests”, “Sleeping Guests”, “Lunch Guests”. I wont go in to this in my write-up below but this will allow you to run scenes at different times based on the selection of this entity (for example: fire the afternoon scene at 1:30p if “No Guests”, otherwise fire it at 3p). Make sure to put an action in your “Shabbos Ending” Automation that will set this entity back to “No Guests” so it resets it for the next week.

Alexa Speaks integration: I have 7 Echos through-out the house, all of which announce the the beginning and ending of Shabbos Mode. The living room Echo will announce the days weather forecast at 10:30am while the mode is active.

I set up a Lovelace tab for Shabbos even though you cant touch it :grinning:. This is mostly for testing and configuring the various lighting scenes. It’s also where I can change the Guests select.

I chose to create lighting scenes and then trigger them with automations. I felt this was cleaner and allowed me to test the scenes out easily.

Automations
I use 4 automations for Shabbos mode. It used to be more, but now with the new trigger.id method, I simplified. This first one will change the MODE helper to Shabbos at the proper time ONLY if mode is currently Home, if the house was in away mode (IE no one home), it stops. At the end of shabbos, it will change the Mode select helper back to Home.

alias: Mode Changer - Shabbos
description: Turns Shabbos Mode ON/OFF depending on existing mode
trigger:
  - platform: state
    entity_id: binary_sensor.jewish_calendar_issur_melacha_in_effect
condition: []
action:
  - service: switch.turn_on
    target:
      entity_id: switch.zwave_siren_current_value
  - choose:
      - conditions:
          - condition: template
            value_template: '{{trigger.to_state.state == ''on''}}'
          - condition: state
            entity_id: input_select.mode
            state: Home
        sequence:
          - service: input_select.select_option
            target:
              entity_id: input_select.mode
            data:
              option: Shabbos
      - conditions:
          - condition: template
            value_template: '{{trigger.to_state.state == ''off''}}'
          - condition: state
            entity_id: input_select.mode
            state: Shabbos
        sequence:
          - service: input_select.select_option
            target:
              entity_id: input_select.mode
            data:
              option: Home
    default: []
mode: single

Once MODE helper changes to Shabbos, this automation takes care of all the labor. It will ring a bell, send TTS to Alexa, Notify phones, set the first lighting scene, enables the lighting scene automation, and change the bathroom motion light switches to manual. The ‘Shabbos 0 - Deactivation’ does all these actions in a reversing manor.

alias: Shabbos 0 - Activation
description: 'On mode change to shabbos mode, activate the scene and notify'
trigger:
  - entity_id: input_select.mode
    platform: state
    to: Shabbos
condition: []
action:
  - data:
      node_id: 9
      value: 4
      value_id: '72057594195329025'
    service: zwave.set_node_value
  - scene: scene.shabbos_0_sunset
  - data:
      option: Manual
    entity_id: input_select.bathroom_mode
    service: input_select.select_option
  - data:
      message: >-
        shabbos mode has been enabled with
        {{states('input_select.shabbos_guests')}}, {% if
        states('input_select.shabbos_guests') == 'No Guests' %}standard lighting
        schedules active{% else %}lighting schedules will be extended{% endif %}
    service: script.echo_announcement
  - data:
      message: Shabbos Mode has been ENABLED
    service: notify.notify
mode: single

This automation handles all of the lighting scene changes. It used to be split in to 6 automations, but now using the new trigger.id, I have combined it in to one automation (which I can enable or disable during activation or deactivation!). I can change the time slots simply by changing the triggers but keep the same trigger.id so the actions at the bottom stay the same.

alias: Shabbos Scenes
description: Shabbos Scenes
trigger:
  - at: '22:00'
    platform: time
    id: shabbos_1_evening_house
  - at: '00:10'
    platform: time
    id: shabbos_2_night_house
  - at: '09:15'
    platform: time
    id: shabbos_3_morning_closets
  - at: '10:30'
    platform: time
    id: shabbos_4_morning_house
  - at: '14:30'
    platform: time
    id: shabbos_5_day_house
  - event: sunset
    offset: '-01:20:00'
    platform: sun
    id: shabbos_6_sunset_house
condition:
  - condition: state
    entity_id: input_select.mode
    state: Shabbos
action:
  - choose:
      - conditions:
          - condition: trigger
            id: shabbos_1_evening_house
        sequence:
          - scene: scene.shabbos_1_evening
      - conditions:
          - condition: trigger
            id: shabbos_2_night_house
        sequence:
          - scene: scene.shabbos_2_goodnight
      - conditions:
          - condition: trigger
            id: shabbos_3_morning_closets
        sequence:
          - scene: scene.shabbos_3_closets
      - conditions:
          - condition: trigger
            id: shabbos_4_morning_house
        sequence:
          - scene: scene.shabbos_4_morning
          - data:
              media_content_id: Alexa.Weather.Play
              media_content_type: sequence
            entity_id: media_player.living_room_echo
            service: media_player.play_media
      - conditions:
          - condition: trigger
            id: shabbos_5_day_house
        sequence:
          - scene: scene.shabbos_5_afternoon
      - conditions:
          - condition: trigger
            id: shabbos_6_sunset_house
        sequence:
          - scene: scene.shabbos_0_sunset
    default: []
  - service: input_text.set_value
    target:
      entity_id: input_text.shabbos_scene
    data:
      value: '{{trigger.id}}'
mode: single

Lighting Scenes
I have 6 different lighting scenes that are triggered by the Shabbos Lighting automation. Obviously your lighting will be different, so I will not post the scenes. My triggers for these automations are as follows:

  • Shabbos 0 - Sunset - This scene is triggered by the activation of Shabbos mode, so there is no need for another automation
  • Shabbos 1 - Evening - Automation triggers at 10pm (or 9pm without guests) changing lighting scene
  • Shabbos 2 - Night - Automation triggers at 12:15am changing lighting scene
  • Shabbos 3 - Morning Closets - Automation triggers at 8am changing lighting scene
  • Shabbos 4 - Morning House - Automation triggers at 10:30am (also announce todays weather on Living room echo) changing lighting scene
  • Shabbos 5 - Day House - Automation triggers at 3pm (or 2pm without guests) changing lighting scene
  • Shabbos 0 - Sunset - This scene gets triggered again one hour before sunset, this is the same scene that was triggered at the activation of Shabbos mode so in case it is a multi-day holiday, this sets the lighting back to the beginning of the loop.

Here is a picture of my lighting scenes (triggered from the automation above). These scenes change up lighting throughout the house making sure to turn off all lights that were turned on in prior scenes.

4 Likes

Awesome!
I’ve got an input select which I manually (ugh) select before Shabbos. It’s either away mode, home the entire Shabbos, or home with different variations (guests, or going out for lunch, dinner, etc). Each mode changes about 20 input_datetimes to turn on or off lights air conditioners, crockpot, etc. I used specific device schedules in case I ever need to tweak a specific entity for that week, I can do so easily. Then next week it’ll return to the proper state.
I’ve been hesitant to use triggers for setting modes when Shabbos starts like you do, as I was afraid of failures and not being able to change it. I don’t think I’ve ever had issur melacha fail me so i think you’ve inspired me to do give it a go!
Here’s my lovelace dashboard for shabbos that shows timers that are set. As well as weather and zmanim.


And here is a shot of the screen that let’s me select the scene and change a time if needed

Just wanted to thank you for this thread its awesome!!! I’ve been meaning to set something like this up for a long time and you are giving me a great head start!!! some of the other options I have which need special treatment and confusing things is “guests”, so for dinner - there are three options - just family, family + guests (need longer light times/ac), eating out. Same goes with Shabbos lunch. So three options for each and all the permutations between them - a bit hectic… lets see where I get to

I didn’t really talk about my “Guest Mode” in the post above. I felt it would be too tedious to set up multiple guest settings, eventually I’d get tired of setting them. I created one helper Input_select with 3 options (no guests, sleep over guests, lunch guests).
If input_select == sleep over extends all lighting rules, including bedtime.
If input_select == lunch extends shabbos lunch scene.
Otherwise all scenes are normal. Dont forget to set the input_select back to “no guest” when deactivating shabbos mode!
Good luck.

Very nice - thanks for sharing

How did you create the card that shows the Candle Lighting & Havdala times?

Also how did you create the guest card?

You’re welcome, its been a year since I posted this and made a few changes, so I just updated the original post to reflect them.

The Guests card is a select helper with 3 options: No Guests, Sleeping Guests, Lunch Guests. I then use that select entity to manipulate the lighting times a bit (extend time if there are guests).

Here is the custom card for candle lighting (you NEED to have the Jewish calendar integration mentioned above!)

<h1>{% if not states('sensor.jewish_calendar_holiday') == '' %}{{states('sensor.jewish_calendar_holiday')}}{% elif not states('sensor.jewish_calendar_parshat_hashavua') =='none' %}Parshat {{states('sensor.jewish_calendar_parshat_hashavua')}}{% endif %}</h1>

<ha-icon icon="mdi:candle"></ha-icon> Upcoming Candle Lighting:  <h3>{{ as_timestamp(states('sensor.jewish_calendar_upcoming_candle_lighting')) | timestamp_custom('%a, %B %d @ %I:%M%p') }}</h3>
<ha-icon icon="mdi:weather-night"></ha-icon> Upcoming Havdala Time:   <h3>{{ as_timestamp(states('sensor.jewish_calendar_upcoming_havdalah')) | timestamp_custom('%a, %B %d @ %I:%M%p') }}</h3>

This information pulled from [HebCal.com](https://www.hebcal.com/shabbat?geo=zip&zip=11516&city=&geonameid=&city-typeahead=Cedarhurst%2C+NY+11516&b=18&M=off&m=55).

Thanks, but a newcomer I don’t understand how to add this :zipper_mouth_face:

This is really helpful, I’ve been looking for something like this! I like the simplicity of one automation that works for shabbos and yom tov. 2 issues I’m trying to figure out 1) how to deal with exceptions like pesach Seder nights when I want lights to stay on later. 2) Looking for a way to have lights change prior to sunset. IE Would a negative offset work with ‘issur melacha’?

Sedar night is going to be a tough one, I do Orlando every year with the rest of the herd, you’re probably better off putting the system in shabbos mode and disabling the scene automation for those 2 days.

As far as the ‘issur melacha’ entity, you can not do a negative offset, only positive. Before they added this entity, I used to use the “next candle lighting” datetime entity subtracted from the current datetime + 10 minutes. I can’t find the exact trigger but it’s doable.

  1. Exception for Pesakh (not battle tested though!):
- id: '1609504988970'
  alias: Shabos/Yom Tov (besides Pesach) Seuda 1 Turn Plata On
  description: Turn the plata on on Shabos/Yom Tov (besides Pesach) before Seuda 1
  trigger:
  - event: sunset
    offset: 00:10
    platform: sun
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: binary_sensor.jewish_calendar_issur_melacha_in_effect
      state: 'on'
    - condition: template
      value_template: '{{ not is_state_attr(''sensor.jewish_calendar_holiday'', ''ID'',
        ''pesach'') }}'
  action:
  - data: {}
    entity_id: switch.plata
    service: switch.turn_on
  mode: single

And then on Pesakh:

- id: '1616769675672'
  alias: Pesakh Seuda 1 Turn Plata On
  description: Turn the plata on on Pesakh before Seuda 1
  trigger:
  - event: sunset
    offset: 01:00
    platform: sun
  condition:
  - condition: state
    entity_id: sensor.jewish_calendar_holiday
    state: pesach
    attribute: id
  action:
  - data: {}
    entity_id: switch.plata
    service: switch.turn_on
  mode: single
- id: '1616770064061'
  alias: Pesakh Seuda 1 Turn Plata Off
  description: Turn the plata off on Pesakh after Seuda 1
  trigger:
  - event: sunset
    offset: 04:00
    platform: sun
  condition:
  - condition: state
    entity_id: sensor.jewish_calendar_holiday
    state: pesach
    attribute: id
  action:
  - data: {}
    entity_id: switch.plata
    service: switch.turn_off
  mode: single
  1. Triggering automation prior sunset:
- id: '1609504726191'
  alias: Erev Shabos/Yom Tov Turn Oven Socket Off
  description: Turn the oven socket off on Erev Shabos/Yom Tov
  trigger:
  - event: sunset
    offset: -00:30
    platform: sun
  condition:
  - condition: template
    value_template: '{{ (as_timestamp(states(''sensor.jewish_calendar_upcoming_candle_lighting'')))
      | int - as_timestamp(utcnow()) | int < (3*60*60) }}'
  action:
  - data: {}
    entity_id: switch.plata
    service: switch.turn_off
  mode: single

What’s the best way to run a scene at Havdalah time? I had this, and it did run at Havdalah time last night, but it also ran this (Sunday) morning.

  alias: Havdalah - Run at Havdalah Time
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.jewish_calendar_upcoming_havdalah_2
  condition: []
  action:
  - service: scene.turn_on
    target:
      entity_id: scene.ha_havdalah
    metadata: {}
  mode: single

I played around with this a long time before I realized the devs already did all the work! Just use the binary_sensor.jewish_calendar_issur_melacha_in_effect . it will turn on at candle lighting and turn off at havdalah.

Here is the automation I use, on any change of the above mentioned binary_sensor, it will ring a bell and change a helper I created called “mode”.

description: Turns Shabbos Mode ON/OFF depending on existing mode
trigger:
  - platform: state
    entity_id: binary_sensor.jewish_calendar_issur_melacha_in_effect
condition: []
action:
  - service: switch.turn_on
    target:
      entity_id: switch.zwave_siren_current_value
    data: {}
  - choose:
      - conditions:
          - condition: template
            value_template: '{{trigger.to_state.state == ''on''}}'
          - condition: state
            entity_id: input_select.mode
            state: Home
        sequence:
          - service: input_select.select_option
            target:
              entity_id: input_select.mode
            data:
              option: Shabbos
      - conditions:
          - condition: template
            value_template: '{{trigger.to_state.state == ''off''}}'
          - condition: state
            entity_id: input_select.mode
            state: Shabbos
        sequence:
          - service: input_select.select_option
            target:
              entity_id: input_select.mode
            data:
              option: Home
    default: []
mode: single

I am obviously not technical enough and I need help to create 2 different automations acting on Melacha (Jewish Calendar) being either ON or OFF :
(1) IF Melacha is in effect (Condition or Trigger ???)
Action : Play Media Jewish Music Stream (I know how to set this action)
.
(2) IF Melacha is NOT in effect
Action " Play Media Radio Station X

In short, I want the station Jewish Music Stream to cast to my Chromecast when the Melacha is in effect, and I want another radio station to cast to my Chromecast when the Melacha is NOT in effect.
As mentioned I know how to automate to cast radio stations to Chromecast but I have trouble to set the Melacha (in effect or not) condition.

Thanks so much but this seems very complicated for a novice like me.
I was (am) hoping that I could just use the entity " jewish_calendar_issur_melacha_in_effect " with ON or OFF, but I am new to Home Assistant and don’t (yet) understand how to use this entity for a simple automation.

Thanks for sharing.

I tried getting a psak out of a few people about light sensors. The fact that they are disabled relative to automations is great, but the issue is they still transmit light levels (or whatever detection tech they use). Since they still transmit no one was happy to tell me to use lechatchila.

Another thing I am looking to create is a scene enforcer. i.e. something that runs every X seconds or minutes to enforce the current scene (i.e. activate it again). This would ensure that lights are on or off as wanted despite someone flipping the switch by accident (or on purpose - i.e. small children).
I’ve tried an automation that reverses the switch action, but that is supper unstable and creates blinking loops if done wrong or doesn’t work properly if ZigBee connection is not great.
I use ZigBee switches that go between light and lightbulb to avoid reliance on HA for using lights.

Maybe try an action IF /THEN, with a time condition, or a Issur Melacha condition.

@disforw

Hi There. Great work…
I am new to home Assistant and I really love the idea of making Shabbat Easier using the features here. would you mind sharing the Card template / Coding you used for displaying the Times and Parsha information. I have already installed the hebcal HACS and other jewish Calendar addons.
I am trying to develop mine now and i know I am a long way from it.

Also, I am moving soon (to my own place), where i can finally install my own things and program this fully so would you mind if i pick your brains for help.

thx

Rod

this worked like a treat. thank you.
the type of card is markdown and the code I used was the following

type: markdown
content: >

{% if not states('sensor.jewish_calendar_holiday') == '' %}{{ states('sensor.jewish_calendar_holiday') }}{% elif not states('sensor.jewish_calendar_parshat_hashavua') == 'none' %}Parshat {{ states('sensor.jewish_calendar_parshat_hashavua') }}{% endif %}

Upcoming Candle Lighting:

{{ as_timestamp(states('sensor.jewish_calendar_upcoming_candle_lighting')) | timestamp_custom('%a, %B %d @ %I:%M%p') }}

Upcoming Havdala Time:

{{ as_timestamp(states('sensor.jewish_calendar_upcoming_havdalah')) | timestamp_custom('%a, %B %d @ %I:%M%p') }}

This information is pulled from [HebCal.com](https://www.hebcal.com/shabbat?geo=zip&zip=11516&city=&geonameid=&city-typeahead=Cedarhurst%2C+NY+11516&b=18&M=off&m=55).

Hello,

We are 4 years later! Any news about your Shabbos integration?
Are you using a Smart Doorbell that you are deactivating on Shabbos?
Cameras?
If yes, which ones?