Skip to content

feat(local-network): LocalNetworkBridge for non-HomeKit LAN devices - #75

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

feat(local-network): LocalNetworkBridge for non-HomeKit LAN devices#75
mohabbis merged 1 commit into
mainfrom
claude/homeassistant-homebridge-features-9gsq6r

Conversation

@mohabbis

Copy link
Copy Markdown
Owner

Summary

Implements Tier 1.1 of docs/competitive-feature-scope.md — 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 — stays local-first).

Because it registers through DeviceService.registerBridge and routes by BridgeID (.localNetwork), these devices flow through the same DeviceStateStore → 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)

File Role
Integrations/LocalNetwork/LocalDeviceTransport.swift The value-type seam (mirrors IRTransport). Vendor-neutral LocalComponent (relay/light) so Tasmota/ESPHome/generic-REST can conform later.
Integrations/LocalNetwork/ShellyGen2Transport.swift Shelly Gen2 RPC over local HTTP. Pure, unit-tested normalizedBaseURL / setURL / statusURL / parseReading helpers (same pattern as HTTPIRTransport).
Integrations/LocalNetwork/LocalNetworkDevice.swift SmartDevice wrapper + on/off & brightness capabilities that read/write through the transport (like the HomeKit capability structs). Plus LocalDeviceConfig / LocalDeviceKind.
Integrations/LocalNetwork/LocalNetworkBridge.swift An actor conforming to SmartHomeBridge, driven by injected [LocalDeviceConfig] + a transport factory so the whole vertical is testable without a network.
LumenTests/LocalNetworkTests.swift Shelly codec vs crafted URLs/JSON + bridge/device/capability flow vs a fake LocalDeviceTransport (discover, reachability probe, action routing, device lookup).

Design notes

  • Value types only cross the seam (LocalTarget / LocalDeviceCommand / LocalDeviceReading), matching the SmartHomeBridge snapshot convention — no model ever reaches a transport.
  • Unlike HomeKit there is no OS authorization gate and no push channel: local HTTP is read on demand, so the state stream stays open for a future poller but only emits an echo after an executed action.
  • Xcode 16 synchronized file groups pick up the new files automatically — no .pbxproj changes.

Scope / follow-up

Engine only. Persisting LocalDeviceConfigs (SwiftData) + a Settings surface to author devices, then registering the bridge in RootView, are the next step — documented as scaffolded but not yet wired in CLAUDE.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 proven HomeKitBridge / HTTPIRTransport / BroadlinkTests patterns and the new logic is covered by LocalNetworkTests. The web CI test job is unaffected (Swift + docs only).

🤖 Generated with Claude Code


Generated by Claude Code

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>
@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:10am

@mohabbis
mohabbis marked this pull request as ready for review July 14, 2026 02:10
@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 32b1fb6 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