Work/Hardware & home

ShulClimate

ShulClimate plans when a synagogue's air conditioners should run, based on what is happening in the building that day. On Shabbos and holidays it cannot turn one off.

Private buildHomeKit

The synagogue is not named. Room names and device IDs in the example config are placeholders.

ShulClimate, signal path with interlocks Signal path: schedule to each unit, with the fail-safe interlocks Board feed schedule, holy days Holy windows candles -60 min havdala +45 min Planner pre-cool 45 min 70 °F / 75 °F Frozen plan one file per window, offline Home Assistant on the Shul Pi poll 10 min S1 guard on at rest 75 °F clamp 66 to 78 °F S2 approval default plan: all on, comfort fail-safe rail: on Tuya cloud API AUX cloud or LAN local SmartLife ACs x2 AUX AC x1 Kasa switches S1 Inside a Shabbos or Yom Tov window an off becomes on at the rest temperature and is logged. Every set point is clamped to the Shul limits, 66 to 78 °F, always. S2 A gabbai approves the frozen plan before candle lighting minus 2 h; the file carries a sha-256 digest. No approval, or a digest that does not match: the default plan runs, every unit on, the whole window. Modes: watch (log only), weekdays (never on Shabbos or Yom Tov), full. Executor not built yet. Friday check: every unit answers, every sensor reports, plan approved, clock right, UPS charged. Any failure texts the gabbaim; a unit can go manual for that Shabbos. Figures are the config defaults. ShulClimate plate 1 of 1 not to scale Built on the Beach
Every interlock fails onto one rail: the unit stays on at the rest temperature, never off.

Drag to pan the drawing.

The Shabbos guard tests

$ python -m pytest -p no:cacheprovider -v tests/test_brain.py
============================= test session starts ==============================
platform darwin -- Python 3.14.7, pytest-9.1.1, pluggy-1.6.0 --
  python
rootdir: ~/project
collecting ... collected 13 items

tests/test_brain.py::test_rosh_hashanah_on_shabbos_is_one_window PASSED  [  7%]
tests/test_brain.py::test_tishrei_windows PASSED                         [ 15%]
tests/test_brain.py::test_chol_hamoed_is_not_holy PASSED                 [ 23%]
tests/test_brain.py::test_run_reaching_end_of_data_stays_open PASSED     [ 30%]
tests/test_brain.py::test_guard_refuses_off_on_shabbos PASSED            [ 38%]
tests/test_brain.py::test_guard_allows_off_on_weekday PASSED             [ 46%]
tests/test_brain.py::test_guard_clamps PASSED                            [ 53%]
tests/test_brain.py::test_no_ac_off_anywhere_inside_holy_windows PASSED  [ 61%]
tests/test_brain.py::test_precool_before_mincha PASSED                   [ 69%]
tests/test_brain.py::test_unapproved_plan_runs_default PASSED            [ 76%]
tests/test_brain.py::test_freeze_approve_and_tamper PASSED               [ 84%]
tests/test_brain.py::test_hand_edited_off_with_matching_digest_is_still_guarded
  PASSED [ 92%]
tests/test_brain.py::test_no_changes_after_deadline PASSED               [100%]

============================== 13 passed in 0.07s ==============================

What it does

The building's air conditioners came with three different apps and three different logins. ShulClimate reads the building's own event calendar instead, works out which room needs cooling before each event, and lets the rooms rest in between. Shabbos and holiday times come from the same calendar, with a margin on each side.

On Friday a gabbai approves the plan for Shabbos, and after that nothing about it can change. If nobody gets to it, a safe default runs, with every unit on at the standard temperature from candle lighting until Havdala. The rule underneath is simple. When anything fails, the building stays comfortable.

Hard problem we solved

A bug that could turn the AC off on Shabbos

An air conditioner left on costs a little power. An air conditioner turned off by mistake ruins Shabbos for everyone in the building, and nobody will touch a switch until it ends. So the planner is built so that every failure lands on the warm side.

Safety has five layers. The Friday plan is frozen with a digest, so an edit after approval is caught and nothing changes after the deadline. Every desired state passes through a guard last, and an OFF inside a Shabbos or Yom Tov window becomes ON at the rest temperature, with the refusal logged. Set points are clamped to a fixed band on any day. The units hold their last state, a Friday health check runs, and the rollout is staged, from watch-only to weekdays only to full. The windows themselves come from the schedule feed, stretched with a margin before and after, and they handle two-day Yom Tov and Yom Tov next to Shabbos.

The tests check the guard against real Tishrei dates, including Rosh Hashanah on Shabbos and Chol Hamoed. One test hand-edits a frozen plan to contain an OFF and gives it a matching digest, and the guard still refuses it. Right now the planner runs watch-only. It logs what it would do and touches no device.

Schedule feedevents, Shabbos flagsPlannerPython, per-room planSafety guardno OFF inside a windowHome Assistantdevice layer, on a PiVendor cloudsTuya, AUX, sensorsMini-split ACsWi-Fi modulesRoom sensorstemperature

Where it stands

The planner and its safety guard are built and tested in watch-only mode, and no building device is controlled yet.

HomeControl

Gets a mini-split and a backyard weather station talking to Apple Home.

Next in Hardware & home