Phase 0 — Screen boot and event listener
Layer: JS only
User lands on the commissioning screen with a scanned QR payload.
- Commissioning hook mounts → registers listener on
MatterCommissioningEvent. - Immediately starts fabric prep and commissioning.
iOS listener
Uses DeviceEventEmitter.addListener(MatterCommissioningEvent, …) — not NativeEventEmitter(ESPMatterModule).
Why listener first
Fabric prep can take time; native may emit terminal events while JS is still running bootstrap. The listener must be active before starting new work.
UI phases
loading → optional needs_conversion → converting / preparing → commissioning.
What could go wrong
No active home or user not logged in → hook stops in error phase (noActiveHome, authRequired).