Skip to main content
npmGitHub

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:

  1. The UI calls a method on a CDF entity (for example group.getNodes() or automation.update(...)).
  2. The entity runs the adaptor operations (the underlying SDK call).
  3. The entity emits a typed operation event (success or failure).
  4. The matching store synchronizer handles the event and updates observables.
  5. MobX propagates the change and the UI re-renders.
PieceRole
AdaptorsPlug an SDK into CDF; transform source objects into CDF entities and supply operation delegates
EntitiesThin wrappers your UI calls; emit events, do not own long-lived store coupling
StoresHold observable maps/lists (userStore, nodeStore, groupStore, …)
SynchronizersSubscribe 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.

EntityUse for
ESPCDFUserAuth session, profile, provisioning entry points
ESPCDFGroupHomes, rooms, membership, sharing
ESPCDFNodeOne device/node; params, connectivity, OTA
ESPCDFNodeConfigRead-only config snapshot on a node
ESPCDFDeviceDevice slice under a node (Light, Fan, …)
ESPCDFDeviceParamSingle reactive device parameter
ESPCDFServiceOptional service slice on a node
ESPCDFServiceParamParameter on a service
ESPCDFSceneMulti-device scene
ESPCDFScheduleTime-based actions
ESPCDFAutomationEvent-driven rules
ESPCDFGroupSharingRequestIncoming / outgoing group share
ESPCDFProvisioningDeviceEphemeral 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.

StoreHolds
userStoreAuthenticated user and auth helpers
nodeStoreNodes / devices
groupStoreHomes, rooms, sharing lists
sceneStoreScenes
scheduleStoreSchedules
automationStoreAutomations
subscriptionStorePush / transport events into the other stores

Technical reference

ResourceWhat it covers
esp-rainmaker-app-cdf-tsSource, README, architecture
TypeDoc homeGenerated API entry
EntitiesAll entity classes
StoresESPCDF, initCDF, store modules
ESP RainMaker HomeReference app that uses CDF