Skip to content

feat: MQTT transport with HA auto-discovery#8

Closed
manonstreet wants to merge 1 commit into
v1.1-betafrom
feature/mqtt-transport
Closed

feat: MQTT transport with HA auto-discovery#8
manonstreet wants to merge 1 commit into
v1.1-betafrom
feature/mqtt-transport

Conversation

@manonstreet

Copy link
Copy Markdown
Owner

Summary

  • MQTT transport as alternative to REST — users pick one mode in Access Settings
  • HA auto-discovery creates device_tracker entities automatically (no known_devices.yaml)
  • Rich attributes via json_attributes_topic: altitude, speed, course, motion state, location labels from secureLocations bplist blobs
  • CocoaMQTT 2.1.9 with TLS support, exponential backoff reconnect
  • DMG packaging in build.sh release workflow (replaces ZIP)
  • Transport-aware UI across Home, Access Settings, and Device Manager
  • README updated for dual transport setup

Changed Files

File Change
Models/RichLocationAttributes.swift new — rich location data model
MQTTClient.swift new — MQTT client with HA discovery
Models/DevicePoint.swift add optional richAttributes
LocalStorageDecryptor.swift extract additional bplist fields
Models/SettingsStore.swift TransportMode enum, MQTT settings
Helpers/Keychain.swift add .mqttPassword case
HAClient.swift make PostSummary/PostResult shared
SyncEngine.swift transport branching, MQTT preflight
Models/AppModel.swift MQTT lifecycle with scheduler
Views/AccessSettingsView.swift transport picker, MQTT broker card
Views/HomeView.swift conditional transport rows
Views/DeviceManagerView.swift conditional MAC row
project.pbxproj CocoaMQTT SPM dependency

Test plan

  • Build succeeds (Debug)
  • All 52 existing tests pass
  • No new SwiftLint errors
  • Manual: MQTT broker connection with HA Mosquitto add-on
  • Manual: Verify HA auto-discovery creates device_tracker entities
  • Manual: Verify rich attributes appear on entity
  • Manual: REST still works when selected
  • Manual: Transport mode switch persists across relaunch

🤖 Generated with Claude Code

Add MQTT as an alternative transport alongside REST. Users pick one mode
in Access Settings — MQTT publishes via HA auto-discovery with
json_attributes_topic carrying altitude, speed, motion state, and
location labels from secureLocations bplist blobs.

- RichLocationAttributes model + DevicePoint enrichment from LocalStorage
- TransportMode enum (.rest/.mqtt) with migration for existing REST users
- MQTTClient with CocoaMQTT 2.1.9, connection lifecycle, exponential backoff
- Transport-aware SyncEngine post phase and preflight
- Settings UI: transport picker, MQTT broker card, generic connection test
- HomeView/DeviceManager conditional transport rows
- DMG packaging in build.sh release workflow
- README updated for dual transport

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@manonstreet

Copy link
Copy Markdown
Owner Author

Superseded by v1.2-beta branch

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.

1 participant