[CUB-229] Design camera auto-discovery and registration flow #22

Open
opened 2026-05-27 10:55:48 -04:00 by Hermes · 10 comments
Owner

Imported from Linear: CUB-229
Linear URL: https://linear.app/cubecraft-creations/issue/CUB-229/design-camera-auto-discovery-and-registration-flow

Description

How does the hub discover new ESP32/camera nodes? ESP32 auto-registers on first MQTT connect using MAC/unique ID. Design: registration message format, hub response protocol, what gets stored in DB.

Imported Linear metadata

  • Linear ID: CUB-229
  • State: In Review
  • Priority: High
  • Project: RemoteRig
  • Labels: Dex
  • Due date: none
  • Original assignee: unassigned
  • Creator: CubeCraft Creations
  • Linear branch name: cubecraftcreations1/cub-229-design-camera-auto-discovery-and-registration-flow
  • Linear comments archived/imported: 10
Imported from Linear: **CUB-229** Linear URL: https://linear.app/cubecraft-creations/issue/CUB-229/design-camera-auto-discovery-and-registration-flow ## Description How does the hub discover new ESP32/camera nodes? ESP32 auto-registers on first MQTT connect using MAC/unique ID. Design: registration message format, hub response protocol, what gets stored in DB. ## Imported Linear metadata - Linear ID: CUB-229 - State: In Review - Priority: High - Project: RemoteRig - Labels: Dex - Due date: none - Original assignee: unassigned - Creator: CubeCraft Creations - Linear branch name: cubecraftcreations1/cub-229-design-camera-auto-discovery-and-registration-flow - Linear comments archived/imported: 10
Hermes added the agent/dexpriority/highstate/in-reviewproject/remoterig labels 2026-05-27 10:55:48 -04:00
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-27T01:51:54.054Z on CUB-229:


⚠️ CI FAILURE — 3+ days stale
PR: #14
Failing check: CI/CD / build
Assigned to: Dex
Action: Investigate build failure, push a fix.

Imported Linear comment from **CubeCraft Creations** at `2026-05-27T01:51:54.054Z` on **CUB-229**: --- ⚠️ **CI FAILURE — 3+ days stale** PR: https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/14 Failing check: `CI/CD / build` Assigned to: Dex Action: Investigate build failure, push a fix.
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-25T13:52:06.254Z on CUB-229:


⚠️ CI failure on PR — action required

PR: #14
REPO: remote-rig
FAILING CHECK: CI/CD / build (Failing after 8s)
ASSIGNED TO: Dex
ACTION: Investigate CI failure, push a fix.

Failure has persisted since May 23 (~2 days).

Imported Linear comment from **CubeCraft Creations** at `2026-05-25T13:52:06.254Z` on **CUB-229**: --- ⚠️ CI failure on PR — action required PR: https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/14 REPO: remote-rig FAILING CHECK: CI/CD / build (Failing after 8s) ASSIGNED TO: Dex ACTION: Investigate CI failure, push a fix. Failure has persisted since May 23 (~2 days).
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-24T13:51:10.586Z on CUB-229:


⚠️ CI failure on PR — action required
PR: #14
REPO: remote-rig
FAILING CHECK: CI/CD / build (Failing after 8s)
ASSIGNED TO: Dex
AGE: ~18 hours (since 2026-05-23)
ACTION: Investigate CI failure, push a fix.

Imported Linear comment from **CubeCraft Creations** at `2026-05-24T13:51:10.586Z` on **CUB-229**: --- ⚠️ CI failure on PR — action required PR: https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/14 REPO: remote-rig FAILING CHECK: CI/CD / build (Failing after 8s) ASSIGNED TO: Dex AGE: ~18 hours (since 2026-05-23) ACTION: Investigate CI failure, push a fix.
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-24T13:51:01.236Z on CUB-229:


⚠️ CI failure on PR — action required
PR: #14
REPO: remote-rig
FAILING CHECK: CI/CD / build (Failing after 8s)
ASSIGNED TO: Dex
AGE: ~18 hours (since 2026-05-23)
ACTION: Investigate CI failure, push a fix.

Imported Linear comment from **CubeCraft Creations** at `2026-05-24T13:51:01.236Z` on **CUB-229**: --- ⚠️ CI failure on PR — action required PR: https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/14 REPO: remote-rig FAILING CHECK: CI/CD / build (Failing after 8s) ASSIGNED TO: Dex AGE: ~18 hours (since 2026-05-23) ACTION: Investigate CI failure, push a fix.
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T14:07:39.809Z on CUB-229:


CUB-229 — Design Complete

PR: #14
Branch: agent/dex/CUB-229-camera-auto-discovery
Commit: 95c225eCUB-229: Design camera auto-discovery and registration flow
File: docs/design/camera-auto-discovery.md (508 lines)

Deliverable Summary

Design document covering the full camera auto-discovery and registration flow:

  1. ESP32 Announce Schema — JSON Schema with MAC address as identity, capabilities array, firmware version, device type, and optional fields
  2. Hub Response Protocolregistered / registration_error commands published to the existing command topic, with structured error codes (INVALID_MAC, CAPABILITY_REQUIRED, DB_WRITE_FAILED, RATE_LIMITED) and retry hints
  3. ESP32 Retry Logic — Exponential backoff (5s/10s/20s/30s) with fatal vs. transient error handling; NVS storage of assigned camera_id to skip announce on subsequent boots
  4. Database Schema — 6 new columns on cameras table (firmware_version, capabilities, device_type, registration_status, last_announce_at, registration_error, mqtt_client_id)
  5. Mermaid Sequence Diagram — Full flow: first boot → announce → validation → rate limit → MAC lookup → insert or update → response → SSE broadcast
  6. Rate Limiting — 5 per 60s, 20 per 5 min per MAC
  7. Implementation Plan — Broken into 9 sub-issues (CUB-229a through CUB-229i)

Design Principles Honored

  • Zero-touch provisioning (MAC as identity, no dashboard interaction needed)
  • Re-registration safe (same MAC = update, not duplicate)
  • Idempotent (retained announce replay handled safely)
  • Backward compatible (extends existing MQTT_CONTRACT.md v1.0.0)
  • Observable (SSE events: camera_registered, camera_reconnected)
Imported Linear comment from **CubeCraft Creations** at `2026-05-23T14:07:39.809Z` on **CUB-229**: --- ## CUB-229 — Design Complete ✅ **PR:** https://code.cubecraftcreations.com/CubeCraft-Creations/remote-rig/pulls/14 **Branch:** `agent/dex/CUB-229-camera-auto-discovery` **Commit:** `95c225e` — `CUB-229: Design camera auto-discovery and registration flow` **File:** `docs/design/camera-auto-discovery.md` (508 lines) ### Deliverable Summary Design document covering the full camera auto-discovery and registration flow: 1. **ESP32 Announce Schema** — JSON Schema with MAC address as identity, capabilities array, firmware version, device type, and optional fields 2. **Hub Response Protocol** — `registered` / `registration_error` commands published to the existing `command` topic, with structured error codes (`INVALID_MAC`, `CAPABILITY_REQUIRED`, `DB_WRITE_FAILED`, `RATE_LIMITED`) and retry hints 3. **ESP32 Retry Logic** — Exponential backoff (5s/10s/20s/30s) with fatal vs. transient error handling; NVS storage of assigned `camera_id` to skip announce on subsequent boots 4. **Database Schema** — 6 new columns on `cameras` table (`firmware_version`, `capabilities`, `device_type`, `registration_status`, `last_announce_at`, `registration_error`, `mqtt_client_id`) 5. **Mermaid Sequence Diagram** — Full flow: first boot → announce → validation → rate limit → MAC lookup → insert or update → response → SSE broadcast 6. **Rate Limiting** — 5 per 60s, 20 per 5 min per MAC 7. **Implementation Plan** — Broken into 9 sub-issues (CUB-229a through CUB-229i) ### Design Principles Honored - ✅ Zero-touch provisioning (MAC as identity, no dashboard interaction needed) - ✅ Re-registration safe (same MAC = update, not duplicate) - ✅ Idempotent (retained announce replay handled safely) - ✅ Backward compatible (extends existing `MQTT_CONTRACT.md` v1.0.0) - ✅ Observable (SSE events: `camera_registered`, `camera_reconnected`)
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T14:06:36.588Z on CUB-229:


Validation: PASS — design document created at docs/design/camera-auto-discovery.md (508 lines, 11 sections covering MQTT announce schema, hub response protocol with error codes, database schema extension, rate limiting, sequence diagram, ESP32 retry logic, and implementation plan)

Imported Linear comment from **CubeCraft Creations** at `2026-05-23T14:06:36.588Z` on **CUB-229**: --- Validation: PASS — design document created at docs/design/camera-auto-discovery.md (508 lines, 11 sections covering MQTT announce schema, hub response protocol with error codes, database schema extension, rate limiting, sequence diagram, ESP32 retry logic, and implementation plan)
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T14:04:51.379Z on CUB-229:


Branch: agent/dex/CUB-229-camera-auto-discovery

Imported Linear comment from **CubeCraft Creations** at `2026-05-23T14:04:51.379Z` on **CUB-229**: --- Branch: agent/dex/CUB-229-camera-auto-discovery
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T14:03:23.791Z on CUB-229:


📤 Dispatching CUB-229 to Dex.

Imported Linear comment from **CubeCraft Creations** at `2026-05-23T14:03:23.791Z` on **CUB-229**: --- 📤 Dispatching CUB-229 to Dex.
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-23T14:03:16.882Z on CUB-229:


🚀 Otto: picked up CUB-229 — routing to specialist.

Imported Linear comment from **CubeCraft Creations** at `2026-05-23T14:03:16.882Z` on **CUB-229**: --- 🚀 Otto: picked up CUB-229 — routing to specialist.
Author
Owner

Imported Linear comment from CubeCraft Creations at 2026-05-22T02:28:31.710Z on CUB-229:


@larry: missing @otto: context — cannot break down

Imported Linear comment from **CubeCraft Creations** at `2026-05-22T02:28:31.710Z` on **CUB-229**: --- @larry: missing @otto: context — cannot break down
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/remote-rig#22