struct ActionsTraitThis trait provides a standardized way for a node to expose information about logical grouping of endpoints on the node, expose information about named actions that can be performed on a group of endpoints, expose commands to trigger such actions, and expose events to receive feedback on the state of such actions.
-
List of the event types that are supported by
ActionsTrait.Declaration
Swift
static let supportedEventTypes: [any Event.Type] -
List of the commands that are supported by
ActionsTrait.Declaration
Swift
static let supportedCommandTypes: [any Command.Type] -
The trait identifier.
Declaration
Swift
static let identifier: String -
Metadata about this
Trait.Declaration
Swift
let metadata: TraitMetadata -
List of attributes for the
ActionsTrait.Declaration
Swift
let attributes: Matter.ActionsTrait.Attributes -
Creates a new Trait instance using data read from the given
TraitDecoder.Throws
HomeError.parseErrorwhen parsing fails.Declaration
Swift
init(decoder: TraitDecoder, interactionProxy: (any InteractionProxy)?, metadata: TraitMetadata) throwsParameters
decoderThe raw data representing this Trait.
interactionProxyProxy to the Interaction Client.
metadataMetadata about this Trait.
-
Writes this object to the given
TraitEncoder. ThrowsHomeError.encodingFailedif the data could not be encoded.Declaration
Swift
func encode(with encoder: TraitEncoder) throws -
This API provides the ability to invalidate state retrieved through subscriptions to the target device in the cases where state is not being reported correctly, either intentionally (e.g attributes in Matter traits with the “C” quality) or unintentionally due to poor implementations.
When successful, this API will result in a forced read of the convening scope as specified by the sub-class and return the result through existing Trait subscriptions if present and active.
This API is to be used sparingly as it can impact the performance and battery life of the target device. As such, this API may be throttled by the platform. Callers SHALL be prepared to deal with
HomeErrors thrown by this call.Declaration
Swift
func forceRead() async throws -
Attributes for the
ActionsTrait.Declaration
Swift
struct Attributes -
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
aandb,a == bimplies thata != bisfalse.Parameters
lhsA value to compare.
rhsAnother value to compare.
-
Hashes the essential components of this value by feeding them into the given hasher.
Implement this method to conform to the
Hashableprotocol. The components used for hashing must be the same as the components compared in your type’s==operator implementation. Callhasher.combine(_:)with each of these components.Important
In your implementation of
hash(into:), don’t callfinalize()on thehasherinstance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.Declaration
Swift
func hash(into hasher: inout Hasher) -
The details of a single action.
Declaration
Swift
struct ActionStruct -
The details of a single endpoint list, a set of endpoints that have some logical relation.
Declaration
Swift
struct EndpointListStruct -
The state of an action changed during execution of a command, and the most recent command using the
actionIdpopulated theinvokeIdattribute.Declaration
Swift
struct StateChangedEvent -
Indicates that the action failed to complete as intended.
Declaration
Swift
struct ActionFailedEvent -
Whether the device supports the
instantActioncommand for this trait.Declaration
Swift
var supportsInstantActionCommand: Bool { get } -
Trigger an action (state change) on endpoints in an asynchronous manner.
Declaration
Swift
func instantAction(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.InstantActionCommand.OptionalArgs) -> Void)? = nil) async throws -
The batchable version of instantAction command above.
See also
instantActionDeclaration
Swift
func instantActionBatchable(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.InstantActionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
instantActionWithTransitioncommand for this trait.Declaration
Swift
var supportsInstantActionWithTransitionCommand: Bool { get } -
Trigger an action (state change) on endpoints, specifying how long the state change should take.
Declaration
Swift
func instantActionWithTransition(actionID: UInt16, transitionTime: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.InstantActionWithTransitionCommand.OptionalArgs) -> Void)? = nil) async throwsParameters
transitionTimeThe transition time (in 0.1 seconds).
-
The batchable version of instantActionWithTransition command above.
See also
instantActionWithTransitionDeclaration
Swift
func instantActionWithTransitionBatchable(actionID: UInt16, transitionTime: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.InstantActionWithTransitionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
startActioncommand for this trait.Declaration
Swift
var supportsStartActionCommand: Bool { get } -
Start an action.
Declaration
Swift
func startAction(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.StartActionCommand.OptionalArgs) -> Void)? = nil) async throws -
The batchable version of startAction command above.
See also
startActionDeclaration
Swift
func startActionBatchable(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.StartActionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
startActionWithDurationcommand for this trait.Declaration
Swift
var supportsStartActionWithDurationCommand: Bool { get } -
Start an action, allow it to run for a specified amount of time, after which it stops.
Declaration
Swift
func startActionWithDuration(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.StartActionWithDurationCommand.OptionalArgs) -> Void)? = nil) async throwsParameters
durationThe requested duration in seconds.
-
The batchable version of startActionWithDuration command above.
See also
startActionWithDurationDeclaration
Swift
func startActionWithDurationBatchable(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.StartActionWithDurationCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
stopActioncommand for this trait.Declaration
Swift
var supportsStopActionCommand: Bool { get } -
Stop the ongoing action.
Declaration
Swift
func stopAction(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.StopActionCommand.OptionalArgs) -> Void)? = nil) async throws -
The batchable version of stopAction command above.
See also
stopActionDeclaration
Swift
func stopActionBatchable(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.StopActionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
pauseActioncommand for this trait.Declaration
Swift
var supportsPauseActionCommand: Bool { get } -
Pause an ongoing action.
Declaration
Swift
func pauseAction(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.PauseActionCommand.OptionalArgs) -> Void)? = nil) async throws -
The batchable version of pauseAction command above.
See also
pauseActionDeclaration
Swift
func pauseActionBatchable(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.PauseActionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
pauseActionWithDurationcommand for this trait.Declaration
Swift
var supportsPauseActionWithDurationCommand: Bool { get } -
Pause an ongoing action for a specified amount of time, after which it resumes.
Declaration
Swift
func pauseActionWithDuration(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.PauseActionWithDurationCommand.OptionalArgs) -> Void)? = nil) async throwsParameters
durationThe requested duration in seconds.
-
The batchable version of pauseActionWithDuration command above.
See also
pauseActionWithDurationDeclaration
Swift
func pauseActionWithDurationBatchable(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.PauseActionWithDurationCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
resumeActioncommand for this trait.Declaration
Swift
var supportsResumeActionCommand: Bool { get } -
Resume a paused action.
Declaration
Swift
func resumeAction(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.ResumeActionCommand.OptionalArgs) -> Void)? = nil) async throws -
The batchable version of resumeAction command above.
See also
resumeActionDeclaration
Swift
func resumeActionBatchable(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.ResumeActionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
enableActioncommand for this trait.Declaration
Swift
var supportsEnableActionCommand: Bool { get } -
Enable an action.
Declaration
Swift
func enableAction(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.EnableActionCommand.OptionalArgs) -> Void)? = nil) async throws -
The batchable version of enableAction command above.
See also
enableActionDeclaration
Swift
func enableActionBatchable(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.EnableActionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
enableActionWithDurationcommand for this trait.Declaration
Swift
var supportsEnableActionWithDurationCommand: Bool { get } -
Enable an action for a specified amount of time, then disable it.
Declaration
Swift
func enableActionWithDuration(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.EnableActionWithDurationCommand.OptionalArgs) -> Void)? = nil) async throwsParameters
durationThe requested duration in seconds.
-
The batchable version of enableActionWithDuration command above.
See also
enableActionWithDurationDeclaration
Swift
func enableActionWithDurationBatchable(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.EnableActionWithDurationCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
disableActioncommand for this trait.Declaration
Swift
var supportsDisableActionCommand: Bool { get } -
Disable an action.
Declaration
Swift
func disableAction(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.DisableActionCommand.OptionalArgs) -> Void)? = nil) async throws -
The batchable version of disableAction command above.
See also
disableActionDeclaration
Swift
func disableActionBatchable(actionID: UInt16, optionalArgsProvider: ((Matter.ActionsTrait.DisableActionCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Whether the device supports the
disableActionWithDurationcommand for this trait.Declaration
Swift
var supportsDisableActionWithDurationCommand: Bool { get } -
Disable an action for a specified amount of time, then enable it.
Declaration
Swift
func disableActionWithDuration(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.DisableActionWithDurationCommand.OptionalArgs) -> Void)? = nil) async throwsParameters
durationThe requested duration in seconds.
-
The batchable version of disableActionWithDuration command above.
See also
disableActionWithDurationDeclaration
Swift
func disableActionWithDurationBatchable(actionID: UInt16, duration: UInt32, optionalArgsProvider: ((Matter.ActionsTrait.DisableActionWithDurationCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void> -
Error types.
Declaration
Swift
enum ActionErrorEnum -
Action state.
Declaration
Swift
enum ActionStateEnum -
Action types.
Declaration
Swift
enum ActionTypeEnum -
Type of endpoint list.
Declaration
Swift
enum EndpointListTypeEnum -
Bitmap indicating which commands are supported.
Declaration
Swift
struct CommandBits