interface EnergyPreferenceBehavior {
    [reference]: Datasource<StateType>;
    agent: Agent;
    cluster: never;
    context: ActionContext;
    endpoint: Endpoint<Empty>;
    env: Environment;
    events: EventEmitter & Omit<Events, never> & {} & {} & {} & {} & {} & {};
    features: TypeFromBitSchema<{
        energyBalance: BitFlag;
        lowPowerModeSensitivity: BitFlag;
    }>;
    session: SecureSession;
    state: Omit<{}, never> & {} & {} & {} & {};
    [asyncDispose](): MaybePromise;
    asAdmin(fn: (() => void)): void;
    assertAttributeEnabled<This, K>(this: This, attributeName: K): void;
    callback<A, R>(reactor: Reactor<A, R>, options?: Reactor.Options): ((...args: A) => undefined | R);
    initialize(_options?: {}): MaybePromise;
    reactTo<O>(observable: O, reactor: Reactor<Parameters<O["emit"]>, ReturnType<O["emit"]>>, options?: Reactor.Options): void;
    requireAttributeEnabled<This, K>(this: This, attributeName: K): Exclude<This["state"][K], undefined>;
    toString(): string;
    State: any;
}

Hierarchy (view full)

Properties

[reference]: Datasource<StateType>
agent: Agent
cluster: never

The implemented cluster.

context: ActionContext
endpoint: Endpoint<Empty>
events: EventEmitter & Omit<Events, never> & {} & {} & {} & {} & {} & {}

Access the behavior's events.

features: TypeFromBitSchema<{
    energyBalance: BitFlag;
    lowPowerModeSensitivity: BitFlag;
}>

Supported features as a flag object.

Type declaration

  • ReadonlyenergyBalance: BitFlag

    EnergyBalance

    This feature allows a user to select from a list of energy balances with associated descriptions of which strategies a device will use to target the specified balance.

    MatterSpecification.v13.Cluster § 9.5.4.1

  • ReadonlylowPowerModeSensitivity: BitFlag

    LowPowerModeSensitivity

    This feature allows the user to select a condition or set of conditions which will cause the device to switch to a mode using less power. For example, a device might provide a scale of durations that must elapse without user interaction before it goes to sleep.

    MatterSpecification.v13.Cluster § 9.5.4.2

session: SecureSession
state: Omit<{}, never> & {} & {} & {} & {}

Access the behavior's state.

Methods

  • Create a generic callback function that has the same properties as a Reactor.

    Like a reactor, the callback's "this" will be bound to an active Behavior instance. Because of this: The reactor MUST be a real JS function - arrow functions will not work!

    Type Parameters

    • A extends any[]
    • R

    Parameters

    Returns ((...args: A) => undefined | R)

      • (...args): undefined | R
      • Parameters

        • Rest...args: A

        Returns undefined | R

  • Behaviors are ephemeral and should not perform initialization in their constructor. They can override this method instead.

    This method may be synchronous or asyncronous. If asynchronous, the behavior will not be available for external use until initialization completes.

    Parameters

    • Optional_options: {}

      Returns MaybePromise

    • Install a Reactor.

      Important: The reactor MUST be a real JS function - arrow functions will not work!

      Type Parameters

      Parameters

      Returns void