Skip to content

feat(local-network): persist local devices + Settings surface (bridge now reachable) - #76

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

feat(local-network): persist local devices + Settings surface (bridge now reachable)#76
mohabbis merged 1 commit into
mainfrom
claude/homeassistant-homebridge-features-9gsq6r

Conversation

@mohabbis

Copy link
Copy Markdown
Owner

Summary

Follow-up to the merged LocalNetworkBridge engine (#75). Makes local-network device control reachable end to end — the "control devices Apple Home can't see" surface (Home Assistant / Homebridge parity) is now something a user can actually configure and use.

What's new

File Role
Domain/Models/LocalNetwork/LocalDeviceRecord.swift @Model (schema V4) — persisted authoring record; maps to the value-type LocalDeviceConfig, never reaching the integration layer.
Services/LocalNetwork/LocalDeviceService.swift @Observable @MainActor — record CRUD + keeps the bridge in sync. On every change it republishes a thread-safe LocalDeviceConfigProvider snapshot and re-registers the bridge through DeviceService (add → discovered, delete → pruned). Transport factory is injectable for tests.
Features/LocalNetwork/LocalDeviceListView.swift + LocalDeviceDetailView.swift Settings → Local Devices — author name / address / kind (Shelly switch or dimmer) / channel, mirroring the Settings → Remotes lane.
LumenTests/LocalDeviceServiceTests.swift CRUD → bridge (re)registration vs a stub transport: add surfaces a device in the store, delete prunes it, kind/address edits republish.

Schema

  • New model → new versioned schema V4 + a lightweight V3 → V4 migration stage (additive table), following the ExecutionEvent → V2 precedent. PersistenceCoordinator now uses V4. PersistenceTests don't pin a version, so they're unaffected.

Wiring

  • LumenApp constructs and injects LocalDeviceService.
  • RootView.bootstrap registers the bridge via reloadBridge() behind the same XCTest guard as HomeKit.
  • New Swift files are auto-included by Xcode 16 synchronized file groups — no .pbxproj changes.

Design notes

  • The bridge is an actor whose @Sendable config closure may run off the main actor, so the config snapshot lives behind a lock (LocalDeviceConfigProvider) rather than on the main-actor service.
  • Re-registration (not just refreshAll) on change is deliberate: mergeDevices upserts but doesn't prune, so unregister-then-register is what correctly removes a deleted device's live state.
  • No moat/consent boundary touched — local devices route through the existing scene/consent pipeline unchanged.

Verification

Can't compile Swift on Linux (macOS/Xcode only, per CLAUDE.md); the new service/CRUD → bridge flow is covered by LocalDeviceServiceTests, and the surfaces mirror the proven Remote lane. Web CI test job is unaffected (Swift + docs only).

Still not built (awaiting your consent-boundary call): Tier 1.2 time/schedule triggers.

🤖 Generated with Claude Code


Generated by Claude Code

…ettings

Makes the LocalNetworkBridge user-reachable end to end:

- LocalDeviceRecord (@model, schema V4 + lightweight V3->V4 migration stage):
  persisted authoring record that maps to the value-type LocalDeviceConfig.
- LocalDeviceService (@observable @mainactor): owns record CRUD and keeps the
  bridge in sync. On any change it republishes a thread-safe
  LocalDeviceConfigProvider snapshot and re-registers the bridge through
  DeviceService, so added devices are discovered and removed ones pruned.
  Transport factory is injectable so the whole flow is testable off-network.
- Settings -> Local Devices: LocalDeviceListView + LocalDeviceDetailView author
  name / address / kind (Shelly switch or dimmer) / channel, mirroring the
  Settings -> Remotes lane.
- Wiring: LumenApp constructs and injects LocalDeviceService; RootView.bootstrap
  registers the bridge via reloadBridge() behind the same XCTest guard as
  HomeKit.
- LocalDeviceServiceTests: CRUD -> bridge (re)registration vs a stub transport
  (add surfaces a device, delete prunes it, kind/address edits republish).

Docs (CLAUDE.md/AGENTS.md) updated: local-network devices moved from
scaffolded to wired, schema V4, new model/service/test rows.

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 2:54pm

@mohabbis
mohabbis marked this pull request as ready for review July 14, 2026 14:54
@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 0f39a24 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