Context
Rewrite pysnoo2 (Python) as a TypeScript module for sleepypod-core. This is the foundational piece for Sleepypod Mini.
Scope
Auth
- OAuth PKCE flow to Happiest Baby API
- Token refresh and persistence
- Derive PubNub UUIDs and JWT tokens from auth session
Data API (REST)
- Get device status
- Get session history (sleep sessions with timestamps, duration, soothe levels)
- Get baby profile
- Get device settings (lock, weaning mode, sound settings)
Control API (PubNub)
- Subscribe to device state channel (real-time: baby state, motion level, soothe events)
- Publish commands: start/stop, set soothe level (1-4), lock/unlock
- Handle connection lifecycle (reconnect, token refresh)
Reference
Output
src/services/mini/client.ts — Snoo API client
src/services/mini/pubnub.ts — PubNub subscription manager
src/services/mini/types.ts — TypeScript types for Snoo data model
Parent
Epic: #405
Context
Rewrite pysnoo2 (Python) as a TypeScript module for sleepypod-core. This is the foundational piece for Sleepypod Mini.
Scope
Auth
Data API (REST)
Control API (PubNub)
Reference
pysnoo2/snoo.py(auth),pysnoo2/pubnub.py(control)Output
src/services/mini/client.ts— Snoo API clientsrc/services/mini/pubnub.ts— PubNub subscription managersrc/services/mini/types.ts— TypeScript types for Snoo data modelParent
Epic: #405