This is the default server implementation of ModeSelectBehavior.

This implementation supports StartupMode and OnMode handling, when the OnOff feature is activated. You should use ModeSelectServer.with to specialize the class for the features your implementation supports. Alternatively you can extend this class and override the methods you need.

It should be sufficient to use the class without changes and just react on the currentMode changed events.

Hierarchy

  • ModeSelectServerBase
    • ModeSelectServerLogic

Constructors

Properties

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

The implemented cluster.

context: ActionContext
endpoint: Endpoint<Empty>
events: EventEmitter & Omit<ClusterEvents<ModeSelect.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ModeSelectInterface>>,
    | "supportedModes$Changing"
    | "currentMode$Changing"
    | "startUpMode$Changing"
    | "supportedModes$Changed"
    | "currentMode$Changed"
    | "startUpMode$Changed"
    | "description$Changing"
    | "standardNamespace$Changing"
    | "description$Changed"
    | "standardNamespace$Changed"> & {
    currentMode$Changing: ClusterEvents.AttributeObservable<Attribute<number, any>>;
    description$Changing: ClusterEvents.AttributeObservable<FixedAttribute<string, any>>;
    onMode$Changing: ClusterEvents.AttributeObservable<WritableAttribute<null | number, any>>;
    standardNamespace$Changing: ClusterEvents.AttributeObservable<FixedAttribute<null | number, any>>;
    supportedModes$Changing: ClusterEvents.AttributeObservable<FixedAttribute<TypeFromFields<{
        label: FieldType<string>;
        mode: FieldType<number>;
        semanticTags: FieldType<TypeFromFields<{
            mfgCode: ...;
            value: ...;
        }>[]>;
    }>[], any>>;
} & {
    startUpMode$Changing: undefined | ClusterEvents.AttributeObservable<OptionalWritableAttribute<null | number, any>>;
} & {
    currentMode$Changed: ClusterEvents.AttributeObservable<Attribute<number, any>>;
    description$Changed: ClusterEvents.AttributeObservable<FixedAttribute<string, any>>;
    onMode$Changed: ClusterEvents.AttributeObservable<WritableAttribute<null | number, any>>;
    standardNamespace$Changed: ClusterEvents.AttributeObservable<FixedAttribute<null | number, any>>;
    supportedModes$Changed: ClusterEvents.AttributeObservable<FixedAttribute<TypeFromFields<{
        label: FieldType<string>;
        mode: FieldType<number>;
        semanticTags: FieldType<TypeFromFields<{
            mfgCode: ...;
            value: ...;
        }>[]>;
    }>[], any>>;
} & {
    startUpMode$Changed: undefined | ClusterEvents.AttributeObservable<OptionalWritableAttribute<null | number, any>>;
} & {} & {}

Access the behavior's events.

features: TypeFromBitSchema<{}> & TypeFromBitSchema<{
    onOff: BitFlag;
}>

Supported features as a flag object.

session: SecureSession
state: Omit<ClusterState.Type<ModeSelect.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ModeSelectInterface>>,
    | "description"
    | "supportedModes"
    | "currentMode"
    | "startUpMode"
    | "standardNamespace"> & {
    currentMode: number;
    onMode: null | number;
} & {
    startUpMode?: null | number;
} & {
    description: string;
    standardNamespace: null | number;
    supportedModes: TypeFromFields<{
        label: FieldType<string>;
        mode: FieldType<number>;
        semanticTags: FieldType<TypeFromFields<{
            mfgCode: FieldType<VendorId>;
            value: FieldType<number>;
        }>[]>;
    }>[];
} & {}

Access the behavior's state.

Type declaration

  • ReadonlycurrentMode: number

    This attribute represents the current mode of the server.

    The value of this field must match the Mode field of one of the entries in the SupportedModes

    attribute.

    MatterSpecification.v13.Cluster § 1.9.6.5

  • ReadonlyonMode: null | number

    Indicates the value of CurrentMode that depends on the state of the On/Off cluster on the same endpoint. If this attribute is not present or is set to null, it shall NOT have an effect, otherwise the CurrentMode attribute shall depend on the OnOff attribute of the On/Off cluster

    The value of this field shall match the Mode field of one of the entries in the SupportedModes attribute.

    MatterSpecification.v13.Cluster § 1.9.6.7

Type declaration

  • Optional ReadonlystartUpMode?: null | number

    The StartUpMode attribute value indicates the desired startup mode for the server when it is supplied with power.

    If this attribute is not null, the CurrentMode attribute shall be set to the StartUpMode value, when the server is powered up, except in the case when the OnMode attribute overrides the StartUpMode attribute (see OnModeWithPowerUp).

    This behavior does not apply to reboots associated with OTA. After an OTA restart, the CurrentMode attribute shall return to its value prior to the restart.

    The value of this field shall match the Mode field of one of the entries in the SupportedModes

    attribute.

    If this attribute is not implemented, or is set to the null value, it shall have no effect.

    MatterSpecification.v13.Cluster § 1.9.6.6

Type declaration

  • Readonlydescription: string

    This attribute describes the purpose of the server, in readable text.

    For example, a coffee machine may have a Mode Select cluster for the amount of milk to add, and another Mode Select cluster for the amount of sugar to add. In this case, the first instance can have the description Milk and the second instance can have the description Sugar. This allows the user to tell the purpose of each of the instances.

    MatterSpecification.v13.Cluster § 1.9.6.2

  • ReadonlystandardNamespace: null | number

    This attribute, when not null, shall indicate a single standard namespace for any standard semantic tag value supported in this or any other cluster instance with the same value of this attribute. A

    null value indicates no standard namespace, and therefore, no standard semantic tags are provided in this cluster instance. Each standard namespace and corresponding values and value meanings shall be defined in another document.

    MatterSpecification.v13.Cluster § 1.9.6.3

  • ReadonlysupportedModes: TypeFromFields<{
        label: FieldType<string>;
        mode: FieldType<number>;
        semanticTags: FieldType<TypeFromFields<{
            mfgCode: FieldType<VendorId>;
            value: FieldType<number>;
        }>[]>;
    }>[]

    This attribute is the list of supported modes that may be selected for the CurrentMode attribute. Each item in this list represents a unique mode as indicated by the Mode field of the ModeOptionStruct. Each entry in this list shall have a unique value for the Mode field.

    MatterSpecification.v13.Cluster § 1.9.6.4

cluster: WithFeatures<ModeSelect.Cluster, readonly [OnOff]>

Base cluster state include all attribute values but may be extended by subclasses.

defaults: ClusterState.Type<WithFeatures<ModeSelect.Cluster, readonly [OnOff]>, Type<ModeSelect.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ModeSelectInterface>, ModeSelectInterface>>
dependencies?: Iterable<Type, any, any>
early: boolean
Events: ClusterEvents.Type<WithFeatures<ModeSelect.Cluster, readonly [OnOff]>, Type<ModeSelect.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ModeSelectInterface>, ModeSelectInterface>>
ExtensionInterface: {}
id

The behavior ID for ClusterBehaviors is the name of the cluster.

Internal: (new () => {})
name: string
schema?: Schema
State: (new () => ClusterState.Type<WithFeatures<ModeSelect.Cluster, readonly [OnOff]>, Type<ModeSelect.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ModeSelectInterface>, ModeSelectInterface>>)
supervisor: RootSupervisor
supports: ((other: Type) => boolean)

Type declaration

    • (other): boolean
    • Does this behavior support functionality of a specific implementation?

      Parameters

      Returns boolean

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

  • On receipt of this command, if the NewMode field indicates a valid mode transition within the supported list, the server shall set the CurrentMode attribute to the NewMode value, otherwise, the server shall respond with an INVALID_COMMAND status response.

    Parameters

    Returns void

    MatterSpecification.v13.Cluster § 1.9.7.1

  • 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.

    Returns void

  • Install a Reactor.

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

    Type Parameters

    Parameters

    Returns void