Skip to main content

Canonical technical source, synchronized from the repository at build time. GitHub

Feature 012 — Settings, study notifications and pre-candle reminders

Accepted scope​

Administrator-configured SMS/app push for climate studies and Shabbat/Yom Tov plan observations. Use already-installed Twilio capability; no integration installation, credentials collection, device action or automatic enablement. Provider adapter: installed Twilio SMS UI 1.0.3 service contract (twilio_sms_ui.send_message, target/message/from_number), inspected on host. No third-party source is copied or package added.

Functional requirements​

  • SN-FR-001: For the SMS channel, discover a loaded Twilio SMS UI provider with a registered send service and at least one configured E.164 sender. Never infer capability from a service name alone. Unsupported/missing providers or sender configuration produce a visible unavailable reason and prevent enablement; recheck immediately before sending.
  • SN-FR-002: Provide private admin-only settings shared by both study types: SMS enabled (default false), configured sender, one E.164 recipient, English/Hebrew, per-type participation and started/stopped/completed event toggles. Explicit Save is required. Saving settings sends no message and does not start observations. Recipients and notification metadata stay out of study exports and public repository.
  • SN-FR-003: Record notifications only for lifecycle transitions committed after settings are enabled: observing starts, explicit early stop, automatic completion. Scheduled plan creation is not actual collection start. No retroactive completed-run messages or duplicate completion/stop messages.
  • SN-FR-004: Optional SMS completion/stop report link uses configured HTTPS external HA URL and the frozen run ID. It opens an admin-authenticated report with PDF/Print and JSON controls; never publish PDFs or mint bearer download URLs. Without a safe external URL, explain and omit links while retaining SMS status support.
  • SN-FR-005: Surface disabled, available/configured, unavailable, provider-submitted/unconfirmed, failed, interrupted/unknown and cancelled outcomes. Provider acceptance does not prove handset delivery; this adapter may swallow upstream errors. No test messages or delivery claims without explicit evidence.

Nonfunctional requirements​

  • SN-NFR-001: Dependency discovery reads only bounded runtime metadata and registered services. No Twilio credentials are exported or stored by this app. SMS content omits household names, entities, temperatures and notes. Existing admin API checks apply to settings and reports.
  • SN-NFR-002: Persist a bounded 500-event notification ledger and claim before dispatch. At most one attempt per lifecycle event; interrupted claims are not retried automatically. Use a ten-second service timeout. Lost/uncertain notifications remain visible rather than risk duplicate sends. Store/notification failures must not stop observation collection.
  • SN-NFR-003: Settings changes/disablement cancel pending work from older revisions. Do not reroute queued events to a new recipient. Collection/device ownership stays unchanged. No message by default, during discovery, configuration save or deployment.
  • SN-NFR-004: Localized accessible EN/HE controls. Compatibility tests cover unavailable providers, sender/recipient validation, event filtering, retry/restart deduplication, disable/revision cancellation, failures/timeouts and export redaction. Production deployment is separate from sending an SMS.

Acceptance​

A1 Missing provider disables SMS controls with guidance; loaded configured provider enables opt-in configuration. A2 Only explicit settings plus qualifying future transitions invoke the exact supported SMS service. A3 Repeated ticks/restarts do not repeat attempts; errors remain notification-only. A4 Report links require HA admin login and offer existing PDF/print; no public report files. A5 Actual delivery test remains pending until an administrator configures a recipient and permits a lifecycle event.

Settings and channel follow-up​

  • SN-FR-006: Provide a dedicated Settings navigation page with live read-only dependency discovery, requirement scope (required, required for a feature, preferred with manual fallback, optional), available/missing/needs-setup status and configuration guidance. Cover core panel/API, areas, Jewish Calendar event calendars/service, Twilio, Companion App push, HTTPS report URL, HVAC, weather, reference temperature, labels, automation introspection and the optional Jewish Calendar live issur signal. Never install providers, change registries or automatically enable integrations. Show manual-calendar selection separately from provider capability. Calendar availability is not future-period validation; automation detection is not full forecastability; issur detection is not automatic binding.
  • SN-FR-007: Allow independently enabled SMS and Companion App push channels (either or both). Discover only registered notify.mobile_app_* actions with a loaded mobile_app provider; administrators explicitly select one device. No arbitrary action names, broadcast groups or automatic fallback. Each lifecycle event has a distinct durable attempt per channel. Report push includes iOS url and Android clickAction with the same relative authenticated HA report path. SMS needs external HTTPS for links; push does not. Both channels default off.
  • SN-NFR-005: Discovery performs no service calls; refresh is explicit. Notification credentials/device targets remain private settings; no targets in study exports or message text. UI includes EN/HE/RTL guidance. Unit/integration checks cover partial/missing/ready dependencies, push-only/both/disabled settings, allowlisted targets and per-channel deduplication. Provider availability does not verify remote connectivity, phone permissions or delivery.

A6 Settings remains usable with optional dependencies missing; incompatible channels cannot be enabled. One broken channel must not prevent the other or observation collection. A channel already in flight cannot be recalled by disabling; queued attempts are cancelled.

Pre-candle plan reminders​

  • SN-FR-008: Offer separately opted-in multiple app push plan-preparation reminders before an upcoming Shabbat/Yom Tov period. Use the selected Companion App device, independent of study lifecycle push enablement. Defaults are 180, 60 and 30 minutes before candle lighting; administrator can configure 1–8 unique integer offsets, each 5–720 minutes. Default disabled. Saving does not send or arm anything. Reminder opens house planning, not a device action.
  • SN-FR-009: Anchor reminders to the validated next continuous observance period’s first candle-lighting timestamp from the configured Jewish Calendar provider. Only send on that candle’s local calendar date and strictly before candles, when the unique enabled same-provider issur_melacha_in_effect entity is explicitly off. Suppress when on, unknown, unavailable, missing, ambiguous, or no valid future calendar coverage. Never remind during a continuous multi-day issur period or substitute sunset/current binary state for future dated anchors. Manual planning remains usable but cannot supply these automatic reminders.
  • SN-FR-010: Use reminders to prompt preparation/review even if a draft already exists; no inference that a saved draft was reviewed, approved or activated. Do not create plans, activate automation, approve scenarios, send during issur, or schedule delayed execution through reminders.
  • SN-NFR-006: Check due reminders at one-minute cadence; cache read-only future calendar lookup for at most 15 minutes, only while reminders are enabled and issur is off. No calendar query is made by dependency detection. Recheck issur/date/candle boundary before dispatch. Claim each period/offset/channel durably at most once, including restart. A reminder more than two minutes late is suppressed; no catch-up burst after downtime. Concurrent settings changes cancel older pending attempts. Reminder/calendar failures do not halt observation collection or lifecycle notifications. UTC comparisons and the snapshot timezone must handle DST and local date boundaries.

A7 Multiple offsets on a valid preparation day each produce at most one selected-device push. At candle time, during issur, on a prior local date, after the late grace window or with uncertain calendar/status data, there is no reminder. Disabling/restarting does not repeat a sent reminder. A reminder never mutates plan or devices.