Skip to content

feat(scenes): daily schedule triggers (scheduled scenes fire directly) - #77

Merged
mohabbis merged 1 commit into
mainfrom
claude/homeassistant-homebridge-features-9gsq6r
Jul 14, 2026
Merged

feat(scenes): daily schedule triggers (scheduled scenes fire directly)#77
mohabbis merged 1 commit into
mainfrom
claude/homeassistant-homebridge-features-9gsq6r

Conversation

@mohabbis

Copy link
Copy Markdown
Owner

Summary

Implements Tier 1.2 of docs/competitive-feature-scope.md — time/schedule triggers for scenes, the most-requested automation a geofence-only model couldn't express (Home Assistant's #1 automation type).

Consent decision (yours, now logged in ROADMAP.md): scheduled scenes fire directly. Setting a scene to run at a set time is itself ahead-of-time, explicit consent — categorically different from the forbidden "auto-apply on a hunch," where Lumen infers intent. Inferred SuggestionEngine suggestions remain confirmation-gated. Every scheduled fire posts a notification for explainability/reversibility, and a grace window means a missed schedule never fires stale hours later.

What's in it

Area Change
Domain/Models/Automation/Scene.swift scheduleMinutesSinceMidnight: Int? (nullable → inferred lightweight migration, no schema-version bump, like Home.latitude) + scheduledTime helper
Services/Scene/ScheduleTiming.swift Pure, calendar-injectable due-logic: fires within a grace window, never twice the same day, midnight-safe
Services/Scene/SceneService.swift scheduleTask poller (30 s tick) → fires due scenes via the existing execute(_:) path + notification; pure scenesDue(...) routing; setSchedule(...) CRUD
Services/NotificationService.swift "schedule" case — "… ran on schedule — you set this up. Tap to adjust."
Features/Scenes/SceneDetailView.swift Schedule card (toggle + DatePicker) in the automation section, guarded so onAppear sync doesn't spuriously re-save
Features/RootView.swift Starts the schedule poller next to the geofence poller
LumenTests/ScheduleTests.swift ScheduleTiming due-logic + SceneService.scenesDue routing
ROADMAP.md Decision log entry for the fire-directly choice

Design notes

  • Mirrors the existing geofence-trigger pattern exactly: a poller + a pure routing function + a notification — geofence-triggered scenes already fired directly on a pre-authorized trigger.
  • The grace window (default 120 s) keeps firing calm: a scheduled scene runs close to its time or not at all — opening the app hours later won't trigger a stale run.
  • In-app poller only (like the geofence poller). True background firing via BGTaskScheduler/UNCalendarNotificationTrigger is a follow-up.

Verification

Can't compile Swift on Linux (macOS/Xcode only, per CLAUDE.md); the due-logic and routing are covered by ScheduleTests, and the surfaces mirror the proven geofence lane. Web CI test job unaffected (Swift + docs only).

Tier 1 status

With this, both Tier-1 competitive gaps are closed: non-HomeKit LAN device control (#75/#76) and rich automation triggers (this PR).

🤖 Generated with Claude Code


Generated by Claude Code

Adds Tier 1.2 — time/schedule triggers — the most-requested automation a
geofence-only model couldn't express. Per an explicit decision (logged in
ROADMAP.md), scheduled scenes fire directly: setting a scene to run at a set
time is itself ahead-of-time consent, categorically different from the
forbidden auto-apply-on-a-hunch. Inferred SuggestionEngine suggestions stay
confirmation-gated.

- Scene.scheduleMinutesSinceMidnight (Int?, nullable -> inferred lightweight
  migration, no schema-version bump) + a scheduledTime helper.
- ScheduleTiming: pure, calendar-injectable due-logic — fires within a grace
  window (a schedule missed by hours does not fire stale), never twice the same
  day, midnight-safe.
- SceneService: a scheduleTask poller (30s tick) that fires due scenes via the
  existing execute() path and posts a notification; pure scenesDue(...) routing;
  setSchedule(...) CRUD that clears the last-fired record.
- NotificationService: a 'schedule' case ('… ran on schedule — you set this up.
  Tap to adjust.') for explainability/reversibility.
- SceneDetailView: a schedule card (toggle + time picker) in the automation
  section, guarded so onAppear sync doesn't spuriously re-save.
- RootView.bootstrap starts the schedule poller next to the geofence poller.
- ScheduleTests: ScheduleTiming due-logic + SceneService.scenesDue routing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lumen-idpz Ready Ready Preview, Comment Jul 14, 2026 3:12pm

@mohabbis
mohabbis marked this pull request as ready for review July 14, 2026 15:12
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@mohabbis
mohabbis merged commit ac3a2c9 into main Jul 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants