feat(scenes): daily schedule triggers (scheduled scenes fire directly) - #77
Merged
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mohabbis
marked this pull request as ready for review
July 14, 2026 15:12
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. InferredSuggestionEnginesuggestions 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
Domain/Models/Automation/Scene.swiftscheduleMinutesSinceMidnight: Int?(nullable → inferred lightweight migration, no schema-version bump, likeHome.latitude) +scheduledTimehelperServices/Scene/ScheduleTiming.swiftgracewindow, never twice the same day, midnight-safeServices/Scene/SceneService.swiftscheduleTaskpoller (30 s tick) → fires due scenes via the existingexecute(_:)path + notification; purescenesDue(...)routing;setSchedule(...)CRUDServices/NotificationService.swift"schedule"case — "… ran on schedule — you set this up. Tap to adjust."Features/Scenes/SceneDetailView.swiftDatePicker) in the automation section, guarded soonAppearsync doesn't spuriously re-saveFeatures/RootView.swiftLumenTests/ScheduleTests.swiftScheduleTimingdue-logic +SceneService.scenesDueroutingROADMAP.mdDesign notes
gracewindow (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.BGTaskScheduler/UNCalendarNotificationTriggeris a follow-up.Verification
Can't compile Swift on Linux (macOS/Xcode only, per
CLAUDE.md); the due-logic and routing are covered byScheduleTests, and the surfaces mirror the proven geofence lane. Web CItestjob 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