This is the default server implementation of ActionsBehavior.

Hierarchy (view full)

Constructors

Properties

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

The implemented cluster.

context: ActionContext
endpoint: Endpoint<Empty>
events: EventEmitter & Omit<ClusterEvents<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior>, never> & {
    actionList$Changing: ClusterEvents.AttributeObservable<Attribute<TypeFromFields<{
        actionId: FieldType<number>;
        endpointListId: FieldType<number>;
        name: FieldType<string>;
        state: FieldType<Actions.ActionState>;
        supportedCommands: FieldType<TypeFromPartialBitSchema<{
            disableAction: BitFlag;
            disableActionWithDuration: BitFlag;
            enableAction: BitFlag;
            enableActionWithDuration: BitFlag;
            instantAction: BitFlag;
            instantActionWithTransition: BitFlag;
            pauseAction: BitFlag;
            pauseActionWithDuration: BitFlag;
            resumeAction: BitFlag;
            startAction: BitFlag;
            startActionWithDuration: BitFlag;
            stopAction: BitFlag;
        }>>;
        type: FieldType<Actions.ActionType>;
    }>[], any>>;
    endpointLists$Changing: ClusterEvents.AttributeObservable<Attribute<TypeFromFields<{
        endpointListId: FieldType<number>;
        endpoints: FieldType<EndpointNumber[]>;
        name: FieldType<string>;
        type: FieldType<Actions.EndpointListType>;
    }>[], any>>;
} & {
    setupUrl$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<string, any>>;
} & {
    actionList$Changed: ClusterEvents.AttributeObservable<Attribute<TypeFromFields<{
        actionId: FieldType<number>;
        endpointListId: FieldType<number>;
        name: FieldType<string>;
        state: FieldType<Actions.ActionState>;
        supportedCommands: FieldType<TypeFromPartialBitSchema<{
            disableAction: BitFlag;
            disableActionWithDuration: BitFlag;
            enableAction: BitFlag;
            enableActionWithDuration: BitFlag;
            instantAction: BitFlag;
            instantActionWithTransition: BitFlag;
            pauseAction: BitFlag;
            pauseActionWithDuration: BitFlag;
            resumeAction: BitFlag;
            startAction: BitFlag;
            startActionWithDuration: BitFlag;
            stopAction: BitFlag;
        }>>;
        type: FieldType<Actions.ActionType>;
    }>[], any>>;
    endpointLists$Changed: ClusterEvents.AttributeObservable<Attribute<TypeFromFields<{
        endpointListId: FieldType<number>;
        endpoints: FieldType<EndpointNumber[]>;
        name: FieldType<string>;
        type: FieldType<Actions.EndpointListType>;
    }>[], any>>;
} & {
    setupUrl$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<string, any>>;
} & {
    actionFailed: ClusterEvents.EventObservable<Event<TypeFromFields<{
        actionId: FieldType<number>;
        error: FieldType<Actions.ActionError>;
        invokeId: FieldType<number>;
        newState: FieldType<Actions.ActionState>;
    }>, any>>;
    stateChanged: ClusterEvents.EventObservable<Event<TypeFromFields<{
        actionId: FieldType<number>;
        invokeId: FieldType<number>;
        newState: FieldType<Actions.ActionState>;
    }>, any>>;
} & {}

Access the behavior's events.

Type declaration

  • ReadonlyactionFailed: ClusterEvents.EventObservable<Event<TypeFromFields<{
        actionId: FieldType<number>;
        error: FieldType<Actions.ActionError>;
        invokeId: FieldType<number>;
        newState: FieldType<Actions.ActionState>;
    }>, any>>

    This event shall be generated when there is some error which prevents the action from its normal planned execution and the most recent command using that ActionID used an InvokeID data field.

    It provides feedback to the client about the non-successful progress of the action.

    Example: When InstantActionWithTransition is invoked (with an InvokeID data field), and another controller changes the state of one or more of the involved endpoints during the transition, thus interrupting the transition triggered by the action, two events would be generated:

    • StateChanged when the transition starts (NewState=Active)

    • ActionFailed when the interrupting command occurs (NewState=Inactive, Error=interrupted)

    Example: When InstantActionWithTransition is invoked (with an InvokeID data field = 1), and the same client invokes an InstantAction with (the same or another ActionId and) InvokeID = 2, and this second command interrupts the transition triggered by the first command, these events would be generated:

    • StateChanged (InvokeID=1, NewState=Active) when the transition starts

    • ActionFailed (InvokeID=2, NewState=Inactive, Error=interrupted) when the second command interrupts the transition

    • StateChanged (InvokeID=2, NewState=Inactive) upon the execution of the action for the second command

    MatterSpecification.v13.Core § 9.14.7.2

  • ReadonlystateChanged: ClusterEvents.EventObservable<Event<TypeFromFields<{
        actionId: FieldType<number>;
        invokeId: FieldType<number>;
        newState: FieldType<Actions.ActionState>;
    }>, any>>

    This event shall be generated when there is a change in the State of an ActionID during the execution of an action and the most recent command using that ActionID used an InvokeID data field.

    It provides feedback to the client about the progress of the action.

    Example: When InstantActionWithTransition is invoked (with an InvokeID data field), two StateChanged events will be generated:

    • one when the transition starts (NewState=Active)

    • one when the transition completed (NewState=Inactive)

    MatterSpecification.v13.Core § 9.14.7.1

features: TypeFromBitSchema<{}>

Supported features as a flag object.

session: SecureSession
state: Omit<ClusterState.Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior>, never> & {
    actionList: TypeFromFields<{
        actionId: FieldType<number>;
        endpointListId: FieldType<number>;
        name: FieldType<string>;
        state: FieldType<Actions.ActionState>;
        supportedCommands: FieldType<TypeFromPartialBitSchema<{
            disableAction: BitFlag;
            disableActionWithDuration: BitFlag;
            enableAction: BitFlag;
            enableActionWithDuration: BitFlag;
            instantAction: BitFlag;
            instantActionWithTransition: BitFlag;
            pauseAction: BitFlag;
            pauseActionWithDuration: BitFlag;
            resumeAction: BitFlag;
            startAction: BitFlag;
            startActionWithDuration: BitFlag;
            stopAction: BitFlag;
        }>>;
        type: FieldType<Actions.ActionType>;
    }>[];
    endpointLists: TypeFromFields<{
        endpointListId: FieldType<number>;
        endpoints: FieldType<EndpointNumber[]>;
        name: FieldType<string>;
        type: FieldType<Actions.EndpointListType>;
    }>[];
} & {
    setupUrl?: string;
} & {} & {}

Access the behavior's state.

Type declaration

Type declaration

  • Optional ReadonlysetupUrl?: string

    The SetupURL attribute (when provided) shall indicate a URL; its syntax shall follow the syntax as specified in RFC 3986, max. 512 ASCII characters. The location referenced by this URL shall provide additional information for the actions provided:

    • When used without suffix, it shall provide information about the various actions which the cluster provides.

    ◦ Example: SetupURL could take the value of example://Actions or https://domain.example/
      Matter/bridgev1/Actions for this generic case (access generic info how to use actions provided by
      this cluster).
    

    • When used with a suffix of "/?a=" and the decimal value of ActionID for one of the actions, it may provide information about that particular action. This could be a deeplink to manufacturer-app/website (associated somehow to the server node) with the information/edit-screen for this action so that the user can view and update details of the action, e.g. edit the scene, or change the wake-up experience time period.

    ◦ Example of SetupURL with suffix added: example://Actions/?a=12345 or
      https://domain.example/Matter/bridgev1/Actions/?a=12345 for linking to specific info/editing of
      the action with ActionID 0x3039.
    

    MatterSpecification.v13.Core § 9.14.5.3

cluster: Actions.Cluster

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

defaults: ClusterState.Type<Actions.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ActionsInterface>>
dependencies?: Iterable<Type, any, any>
early: boolean
Events: ClusterEvents.Type<Actions.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ActionsInterface>>
ExtensionInterface: {}
id

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

Interface: ActionsInterface
Internal: (new () => {})
name: string
schema?: Schema
State: (new () => ClusterState.Type<Actions.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, ActionsInterface>>)
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

  • This command disables a certain action or automation, and shall change the action’s state to Disabled. After the specified Duration, the action or automation will re-start, and the action’s state shall change to either Inactive or Active, depending on the actions (see examples 4 and 6).

    Example: disable a "wakeup" experience for a period of 1 week when going on holiday (to prevent them from turning on in the morning while you’re not at home). After this period, the wakeup experience will control the lights as before.

    Returns MaybePromise

    MatterSpecification.v13.Core § 9.14.6.12

  • It is recommended that, where possible (e.g., it is not possible for attributes with Boolean data type), a gradual transition SHOULD take place from the old to the new state over this time period. However, the exact transition is manufacturer dependent.

    This command triggers an action (state change) on the involved endpoints, with a specified time to transition from the current state to the new state. During the transition, the action’s state shall be Active. Afterwards, the action’s state shall be Inactive.

    Example: recall a scene on a number of lights, with a specified transition time.

    Returns MaybePromise

    MatterSpecification.v13.Core § 9.14.6.2

  • This command pauses an ongoing action, and shall change the action’s state to Paused. After the specified Duration, the ongoing action will be automatically resumed. which shall change the action’s state to Active.

    Example: pause a dynamic lighting effect (the lights stay at their current color) for 10 minutes (Duration=600).

    The difference between Pause/Resume and Disable/Enable is on the one hand semantic (the former is more of a transitionary nature while the latter is more permanent) and on the other hand these can be implemented slightly differently in the implementation of the action (e.g. a Pause would be automatically resumed after some hours or during a nightly reset, while an Disable would remain in effect until explicitly enabled again).

    Returns MaybePromise

    MatterSpecification.v13.Core § 9.14.6.7

  • This command resumes a previously paused action, and shall change the action’s state to Active.

    The difference between ResumeAction and StartAction is that ResumeAction will continue the action from the state where it was paused, while StartAction will start the action from the beginning.

    Example: resume a dynamic lighting effect (the lights' colors will change gradually, continuing from the point they were paused).

    Parameters

    Returns MaybePromise

    MatterSpecification.v13.Core § 9.14.6.8

  • This command triggers the commencement of an action on the involved endpoints. Afterwards, the action’s state shall be Active.

    Example: start a dynamic lighting pattern (such as gradually rotating the colors around the setpoints of the scene) on a set of lights.

    Example: start a sequence of events such as a wake-up experience involving lights moving through several brightness/color combinations and the window covering gradually opening.

    Parameters

    Returns MaybePromise

    MatterSpecification.v13.Core § 9.14.6.3