Represents a node in the ESP Rainmaker Neo SDK. Provides access to node configuration and metadata.

Live updates arrive via the subscription manager (subscribeToNode → handleNodeUpdate) and are re-broadcast on the process-wide node-updates bus for user.subscribe(nodeUpdates).

Constructors

Properties

availableTransports: Record<string, ESPTransportConfig> = {}

Transports currently usable for this node, keyed by mode.

  • mqtt (cloud) is added when the node is connected and removed when it goes offline (from cached connectivity_status or shadow updates).
  • local is added/removed at runtime by a localDiscovery subscriber as the node appears/disappears on the LAN (via addTransport/removeTransport). Apps may also add custom string-keyed entries (pair with customTransportManagers).
config: NodeConfig
connectivityStatus: ESPRMNeoConnectivityStatusInterface = ...

Last-known connectivity. Seeded from cached connectivity_status when present (cloud config does not provide it); otherwise starts offline until an MQTT shadow online update arrives.

customTransportManagers?: Record<string, ESPTransportInterface>

Optional per-node custom transport implementations keyed by mode. When a mode in transportOrder has an entry here, the transport handler uses it in preference to the built-in local/MQTT backends. Enables BLE, WebSocket or proprietary transports without modifying the SDK.

devices: ESPRMNeoDevice[] = []
groupId: string
nodeId: string
services: ESPRMNeoService[] = []
subgroupIds: string[] = []

All subgroup IDs this node belongs to under groupId (shadow segment order from constructShadowName). Empty when the node lives only at the root group.

subscriptionConfig?: ESPNodeSubscriptionConfig

Optional per-node subscription channel order, overriding the global order on ESPRMNeoBase.subscriptionManager. Set and read via the setSubscriptionChannelOrder / getSubscriptionChannelOrder methods added by module augmentation in src/methods/ESPRMNeoNode/SubscriptionConfig.ts.

transportOrder: string[] = []

Transport priority order for this node. Initialized from the global default (ESPRMNeoBase.getTransportOrder); override per-node via setTransportOrder.

Methods

  • Creates schedules on this node.

    • Pass a single ScheduleItem to append it while preserving existing schedules (GET current list, then PUT the merged list).
    • Pass an array to replace all schedules in one PUT. Pass [] to clear.

    Calls PUT /v1/groups/{groupId}/nodes/{nodeId}/schedules.

    Single-item append is not safe under concurrent calls to the same node — two simultaneous creates can read the same existing list and the later PUT wins. Callers appending many schedules should build the array locally and pass it once.

    Parameters

    Returns Promise<ESPRMNeoSchedule>

    The created schedule, or the full list after a replace-all PUT.

    If the argument is invalid, or a single schedule's id is missing / already exists.

    If the API request fails.

  • Parameters

    Returns Promise<ESPRMNeoSchedule[]>

  • Creates triggers on this node.

    • Pass a single TriggerItem to append it while preserving existing triggers (GET current list, then PUT the merged list).
    • Pass an array to replace all triggers in one PUT. Pass [] to clear.

    Calls PUT /v1/groups/{groupId}/nodes/{nodeId}/triggers.

    Single-item append is not safe under concurrent calls to the same node — two simultaneous creates can read the same existing list and the later PUT wins. Callers appending many triggers should build the array locally and pass it once.

    Parameters

    Returns Promise<ESPRMNeoTrigger>

    The created trigger, or the full list after a replace-all PUT.

    If the argument is invalid, or a single trigger's id is missing / already exists.

    If the API request fails.

  • Parameters

    Returns Promise<ESPRMNeoTrigger[]>

  • Fully disassociates this node from the cloud account. Calls DELETE /v1/groups/{groupId}/nodes/{nodeId} at the root group.

    Returns Promise<ESPAPIResponse>

    A promise that resolves with the API response when the node has been deleted.

    If the deletion fails or the API request fails.

  • Gets aggregated time-series data for a device param from GET /v1/groups/{groupId}/nodes/{nodeId}/timeseries/aggregates.

    Query modes (all require options.window):

    • no date options: current (live) window
    • date: one completed historical window
    • startDate + endDate: paginated range of completed windows

    Parameters

    • deviceName: string

      Device name.

    • paramName: string

      Parameter name.

    • Optionaloptions: ESPRMNeoTSDataOptions

      Query options (window required; date or startDate/endDate for historical windows; paginate via pageSize/startKey or the result's fetchNext()).

    Returns Promise<ESPRMNeoTSDataResult>

    Promise resolving to time-series data with aggregates populated.

  • RainMaker params channel: rainmaker/nodes/{nodeId}/user/{shadowName}/params

    Returns string

  • Returns the effective subscription channel order for this node (node-specific order if set, otherwise the global order).

    Returns string[]

    Channel ids in priority order.

  • Removes the custom transport manager registered for a mode (if any).

    Parameters

    • mode: string

      Transport mode key to clear.

    Returns void

  • Removes a schedule from this node by id, preserving other schedules.

    RainMaker's schedules API is replace-all, so this method does two round trips: a GET to fetch the current list, then a PUT of the filtered list.

    Parameters

    • scheduleId: string

      Id of the schedule to remove.

    Returns Promise<ESPAPIResponse>

    A promise that resolves with the API response when the schedule is removed.

    If scheduleId is missing or no matching schedule exists.

    If the API request fails.

  • Removes an available transport for this node by mode.

    Parameters

    • mode: string

      Transport mode key to remove.

    Returns void

  • Removes a trigger from this node by id, preserving other triggers.

    RainMaker's triggers API is replace-all, so this method does two round trips: a GET to fetch the current list, then a PUT of the filtered list.

    Parameters

    • triggerId: string

      Id of the trigger to remove.

    Returns Promise<ESPAPIResponse>

    A promise that resolves with the API response when the trigger is removed.

    If triggerId is missing or no matching trigger exists.

    If the API request fails.

  • Publishes a parameter update to this node via the best available transport (local control first when reachable, otherwise MQTT).

    The returned response indicates the publish was accepted by the transport (local ack or MQTT publish resolved). It does not guarantee that the device received or applied the params — cloud publishes are fire-and-forget over AWS IoT.

    Parameters

    • params: Record<string, any>

      A record of device/service names to param maps.

    Returns Promise<ESPAPIResponse>

    A promise that resolves once the transport publish is accepted.

    If params is empty.

    If all available transports fail.

  • Sets the subscription channel order for this node, overriding the global order on ESPRMNeoBase.subscriptionManager. Channels are tried in order until one succeeds; only channels that support the node are used.

    Parameters

    • channelIds: string[]

      Channel ids in priority order, e.g. ["matter", "mqtt"].

    Returns void

    node.setSubscriptionChannelOrder(["matter", "mqtt"]);
    
  • Overrides the transport priority order for this node only.

    Parameters

    • order: string[]

      Non-empty ordered list of transport modes.

    Returns void

    If the order is empty or not an array.

  • Fetches the latest node config from the cloud, applies it to this instance (config, devices, services), then updates the local cache.

    Calls:

    • Root membership: GET /v1/groups/{groupId}/nodes/{nodeId}/config
    • Subgroup membership: GET /v1/groups/{groupId}/subgroups/{subGroupId}/nodes/{nodeId}/config

    Returns Promise<ESPRMNeoNode>

    If the API request fails.

  • Stops receiving MQTT shadow updates for this node.

    Specifically:

    • Unregisters the node from NodeMQTTOrchestrator
    • Removes the node's MQTT shadow listeners
    • Unsubscribes the shared shadow MQTT topics if no other registered nodes still use them

    Call this before dropping the last reference to the node instance so orchestrator registrations and MQTT subscriptions are not left behind. This does not clear local storage, node config cache, or other SDK resources.

    Returns void