feat(local-network): LocalNetworkBridge for non-HomeKit LAN devices - #75
Merged
Merged
Conversation
Adds a second real SmartHomeBridge alongside HomeKit — the 'control devices Apple Home can't see' surface that Home Assistant and Homebridge exist for. LocalNetworkBridge reaches user-configured LAN devices over their local HTTP APIs (no cloud, no account), routing through DeviceService.registerBridge and BridgeID so they flow through the same DeviceStateStore -> capability UI -> scene pipeline as HomeKit with no view changes. - LocalDeviceTransport: the value-type seam (mirrors IRTransport), with a vendor-neutral LocalComponent (relay/light) so more protocols can conform. - ShellyGen2Transport: Shelly Gen2 RPC over local HTTP, with pure unit-tested URL-building and JSON-parsing helpers (like HTTPIRTransport). - LocalNetworkDevice + capabilities: on/off and brightness read/write through the transport (like the HomeKit capability structs). - LocalNetworkBridge: an actor conforming to SmartHomeBridge, driven by injected [LocalDeviceConfig] + a transport factory so the whole vertical is testable without a network. - LocalNetworkTests: Shelly codec vs crafted URLs/JSON + bridge/device/ capability flow vs a fake transport. Engine only: persisting LocalDeviceConfigs and a Settings surface to author them (then registering the bridge in RootView) are the next step, documented as scaffolded-but-not-yet-wired in CLAUDE.md/AGENTS.md. 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 02:10
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Jul 14, 2026
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.1 of
docs/competitive-feature-scope.md— a second realSmartHomeBridgealongside HomeKit, the "control devices Apple Home can't see" surface that Home Assistant and Homebridge exist for.LocalNetworkBridgereaches user-configured LAN devices over their local HTTP APIs (no cloud, no account — stays local-first).Because it registers through
DeviceService.registerBridgeand routes byBridgeID(.localNetwork), these devices flow through the sameDeviceStateStore→ capability UI → scene pipeline as HomeKit, with no view changes. HomeKit was never special — just the first bridge registered.What's in this PR (the engine)
Integrations/LocalNetwork/LocalDeviceTransport.swiftIRTransport). Vendor-neutralLocalComponent(relay/light) so Tasmota/ESPHome/generic-REST can conform later.Integrations/LocalNetwork/ShellyGen2Transport.swiftnormalizedBaseURL/setURL/statusURL/parseReadinghelpers (same pattern asHTTPIRTransport).Integrations/LocalNetwork/LocalNetworkDevice.swiftSmartDevicewrapper + on/off & brightness capabilities that read/write through the transport (like the HomeKit capability structs). PlusLocalDeviceConfig/LocalDeviceKind.Integrations/LocalNetwork/LocalNetworkBridge.swiftactorconforming toSmartHomeBridge, driven by injected[LocalDeviceConfig]+ a transport factory so the whole vertical is testable without a network.LumenTests/LocalNetworkTests.swiftLocalDeviceTransport(discover, reachability probe, action routing, device lookup).Design notes
LocalTarget/LocalDeviceCommand/LocalDeviceReading), matching theSmartHomeBridgesnapshot convention — no model ever reaches a transport..pbxprojchanges.Scope / follow-up
Engine only. Persisting
LocalDeviceConfigs (SwiftData) + a Settings surface to author devices, then registering the bridge inRootView, are the next step — documented as scaffolded but not yet wired inCLAUDE.md/AGENTS.md(same convention as Zones, and how Broadlink landed codec-first). No moat/consent boundary is touched: local devices route through the existing scene/consent pipeline unchanged.Not built here (still needs your consent-boundary call before I start): Tier 1.2 time/schedule triggers.
Verification
Can't compile Swift on Linux (macOS/Xcode only, per
CLAUDE.md); code mirrors the provenHomeKitBridge/HTTPIRTransport/BroadlinkTestspatterns and the new logic is covered byLocalNetworkTests. The web CItestjob is unaffected (Swift + docs only).🤖 Generated with Claude Code
Generated by Claude Code