@espressif/rainmaker-base-cdf
    Preparing search index...

    Schedule - Manages schedule operations

    This class handles all schedule-related operations including:

    • Schedule CRUD operations (Create, Read, Update, Delete)
    • Schedule enable/disable functionality
    • Schedule transformation and payload generation
    • Node-specific schedule operations

    Schedule

    Implements

    Index

    Constructors

    • Creates a new Schedule instance

      Initializes a schedule with the provided data and sets up the necessary operations and bindings. The schedule is linked to the root store for accessing other stores and services.

      Parameters

      • schedule: default

        The schedule data to initialize with

      • rootStore: CDF

        Reference to the root CDF store

      Returns default

      const schedule = new Schedule({
      id: 'schedule123',
      name: 'Morning Schedule',
      nodes: ['node1'],
      action: { node1: { light: { power: true } } }
      triggers: [{ m: 30, d: 1 }]
      }, rootStore);

    Properties

    add: () => Promise<undefined | ESPAPIResponse | MultiNodeResponsePayload[]>
    callbackUpdateOperation: { [key: string]: ScheduleOperation }
    devicesCount: number
    disable: () => Promise<undefined | ESPAPIResponse | MultiNodeResponsePayload[]>
    edit: (
        __namedParameters: ScheduleEditParams,
    ) => Promise<undefined | ESPAPIResponse | MultiNodeResponsePayload[]>
    enable: () => Promise<undefined | ESPAPIResponse | MultiNodeResponsePayload[]>
    enabled?: boolean
    flags?: null | number
    id: string
    info?: null | string
    name: string
    nodes: string[]
    outOfSyncMeta: Record<string, any>
    remove: () => Promise<undefined | ESPAPIResponse | MultiNodeResponsePayload[]>
    triggers: ScheduleTrigger[]
    validity?: null | { end: number; start: number }

    Methods

    • Adds out-of-sync metadata for a specific node

      This method stores metadata indicating that a node's schedule configuration is not synchronized with the server state.

      Parameters

      • nodeId: string

        The identifier of the node

      • value: any

        The metadata value to store

      Returns void

      schedule.addOutOfSyncMeta('node1', { lastSync: timestamp });
      
    • Clears all out-of-sync metadata

      This method removes all stored metadata about node synchronization status, effectively marking all nodes as synchronized.

      Returns void

      schedule.clearOutOfSyncMeta();
      
    • Retrieves out-of-sync metadata for a specific node

      Parameters

      • nodeId: string

        The identifier of the node

      Returns any

      The stored metadata for the node

      const syncStatus = schedule.getOutOfSyncMeta('node1');
      
    • Checks if the schedule is enabled

      Returns boolean

      True if the schedule is enabled, false otherwise

    • Removes out-of-sync metadata for a specific node

      This method clears the stored metadata indicating that a node's schedule configuration has been synchronized.

      Parameters

      • nodeId: string

        The identifier of the node

      Returns void

      schedule.removeOutOfSyncMeta('node1');