Commit Graph

2 Commits

Author SHA1 Message Date
ruv 48db60a65e feat(adr-125 tier1 #1): multi-characteristic accessory + JSON-state IPC
The HAP accessory now carries three services on the same paired
entity (HomeKit allows multiple services per accessory; iPhone
refetches /accessories when config_number bumps):

  - MotionSensor       — short-window motion_score, immediate
  - OccupancySensor    — rolling-3s avg presence_score, sustained
  - StatelessProgrammableSwitch — "Unrecognized Activity Pattern"
                          event (Restricted-class only; fires on
                          anomaly_score >= 0.7); ADR-125 §2.1.d
                          semantic naming, not security state

New JSON IPC contract `/tmp/ruview-state.json` between watcher
and HAP daemon:

  { "motion": bool, "occupancy": bool, "anomaly_ts": float,
    "ts": float }

Atomic writes (tmp + rename). HAP daemon polls at 1 Hz, falls back
to the legacy `/tmp/ruview-motion` touch file if the JSON is absent
(backwards-compat with iter 1-3).

Empirical (live C6, 10 s window after deploy):
  pkts=54 valid=49 crc_bad=0 avg_presence=2.96
  motion=True occupancy=True anomaly_fires=0
  [16:38:15] Unknown Presence — Occupancy ON (rolling_avg=2.79)

Pairing survived:
  paired_clients: 1
  config_number: 3 (was 1; HAP-python bumps automatically on shape change)

Tier 1 #1 (multi-characteristic) of the Tier 1+2 sprint. Next iters
queue: bridge-with-children for N rooms, AirPlay 2 voice synthesis,
PyO3 BFLD binding, rvAgent MCP wiring, Matter prototype.

Refs ADR-125 §2.1.c (bridge topology), §2.1.d (semantic events),
ADR-118.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-25 16:39:27 -04:00
ruv 19b445f9bb chore(adr-125 iter 1): fix C6 COM port + ship HAP-python reference impl
Two changes from the ADR-125 e2e bootstrap session:

1. CLAUDE.md hardware table: COM4 -> COM12 for ESP32-C6 (the C6 +
   Seeed MR60BHA2 dev kit now enumerates on COM12 on ruvzen, not
   COM4 as previously documented). Same fix applied to the ESP32-S3
   row (COM7 -> COM9) which CLAUDE.local.md already covered but the
   top-level table had not been updated.

2. scripts/hap-test-sensor.py — the ~80 LOC HAP-python sidecar that
   ADR-125 §2.1.a names as the reference implementation. Already
   running on ruv-mac-mini, already paired with operator's iPhone
   (paired_clients: 1), already round-trips a MotionDetected
   characteristic from a touch-file toggle through the HomePod (as
   Home Hub) to the Home app.

Substrate validated for iter 2+:
  - C6 provisioned on ruv.net (IP 192.168.1.179, ch 5, RSSI -38)
  - UDP frames: 44 packets in 8s @ mac-mini:5005 (~5.5 pps)
  - HAP bridge paired and live

Refs ADR-125, #794.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-25 16:14:51 -04:00