State Manager (CDF)
@espressif/rainmaker-base-cdf is the Central Data Framework used by the ESP RainMaker Home app. It is the state manager that binds the ESP RainMaker Neo SDK to UI-facing entities — one app-facing contract across adaptor implementations.
Your screens do not talk to raw SDK types. They read MobX-backed stores and call methods on unified entities. Adaptors run the SDK underneath; synchronizers apply success/failure results back into those stores so the UI re-renders. Fetch, cache, and sync stay inside CDF so feature code can stay thin.
How the SDK reaches the UI
A typical operation path:
- The UI calls a method on a CDF entity (for example
group.getNodes()orautomation.update(...)). - The entity runs the adaptor
operations(the underlying SDK call). - The entity emits a typed operation event (success or failure).
- The matching store synchronizer handles the event and updates observables.
- MobX propagates the change and the UI re-renders.
| Piece | Role |
|---|---|
| Adaptors | Plug an SDK into CDF; transform source objects into CDF entities and supply operation delegates |
| Entities | Thin wrappers your UI calls; emit events, do not own long-lived store coupling |
| Stores | Hold observable maps/lists (userStore, nodeStore, groupStore, …) |
| Synchronizers | Subscribe to entity events and apply all observable state updates |
You do not need to rewrite or extend CDF adaptors to use Neo. Use the Home app path as-is, or call the SDK directly if you already own state management.
Entities
Entities are the stable objects your UI binds to — users, nodes, groups, scenes, and so on. Full API for each class is in the entities module.
| Entity | Use for |
|---|---|
| ESPCDFUser | Auth session, profile, provisioning entry points |
| ESPCDFGroup | Homes, rooms, membership, sharing |
| ESPCDFNode | One device/node; params, connectivity, OTA |
| ESPCDFNodeConfig | Read-only config snapshot on a node |
| ESPCDFDevice | Device slice under a node (Light, Fan, …) |
| ESPCDFDeviceParam | Single reactive device parameter |
| ESPCDFService | Optional service slice on a node |
| ESPCDFServiceParam | Parameter on a service |
| ESPCDFScene | Multi-device scene |
| ESPCDFSchedule | Time-based actions |
| ESPCDFAutomation | Event-driven rules |
| ESPCDFGroupSharingRequest | Incoming / outgoing group share |
| ESPCDFProvisioningDevice | Ephemeral peer during provisioning |
Stores
Stores are where the UI reads lists and lookups. They sit on the root ESPCDF instance returned by initCDF. See the store module.
| Store | Holds |
|---|---|
| userStore | Authenticated user and auth helpers |
| nodeStore | Nodes / devices |
| groupStore | Homes, rooms, sharing lists |
| sceneStore | Scenes |
| scheduleStore | Schedules |
| automationStore | Automations |
| subscriptionStore | Push / transport events into the other stores |
Technical reference
| Resource | What it covers |
|---|---|
| esp-rainmaker-app-cdf-ts | Source, README, architecture |
| TypeDoc home | Generated API entry |
| Entities | All entity classes |
| Stores | ESPCDF, initCDF, store modules |
| ESP RainMaker Home | Reference app that uses CDF |
