struct LevelControlTraitThis trait provides an interface for controlling a characteristic of a device that can be set to a level.
-
No supported events for
LevelControlTrait.Declaration
Swift
static let supportedEventTypes: [any Event.Type] -
List of the commands that are supported by
LevelControlTrait.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
LevelControlTrait.Declaration
Swift
let attributes: Matter.LevelControlTrait.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
LevelControlTrait.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.Declaration
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) -
Whether the device supports the
moveToLevelcommand for this trait.Declaration
Swift
var supportsMoveToLevelCommand: Bool { get } -
Move a device from its current level to the provided level.
Declaration
Swift
func moveToLevel(level: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throwsParameters
levelThe level to move the device to.
transitionTimeThe time (in 0.1 seconds) taken to move the device to the new level.
optionsMaskDetermines which bits in the
optionsattribute should be overridden byoptionsOverride.optionsOverrideIf the corresponding bit in
optionsMaskis set to1, the bit set here overrides the corresponding bit inoptionsattribute. -
The batchable version of moveToLevel command above.
See also
moveToLevelDeclaration
Swift
func moveToLevelBatchable(level: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
movecommand for this trait.Declaration
Swift
var supportsMoveCommand: Bool { get } -
Change a device’s level based on a rate of movement.
Declaration
Swift
func move(moveMode: Matter.LevelControlTrait.MoveModeEnum, rate: UInt8?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throwsParameters
moveModeThe direction in which to move the level. This must be one of the values in [LevelControlTrait.MoveModeEnum].
rateoptionsMaskDetermines which bits in the
optionsattribute should be overridden byoptionsOverride.optionsOverrideIf the corresponding bit in
optionsMaskis set to1, the bit set here overrides the corresponding bit inoptionsattribute. -
The batchable version of move command above.
See also
moveDeclaration
Swift
func moveBatchable(moveMode: Matter.LevelControlTrait.MoveModeEnum, rate: UInt8?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
stepcommand for this trait.Declaration
Swift
var supportsStepCommand: Bool { get } -
Move a device’s level a specific amount over a period of time. If the
stepSizeused results in acurrentLevelthat is greater than themaxLevelor less than theminLevel, then the command stops when thecurrentLevelreaches themaxLevelorminLevel, respectively. The command may complete in a shorter time than specified fortransitionTimeif themaxLevelorminLevelis reached before the transition time is over.Declaration
Swift
func step(stepMode: Matter.LevelControlTrait.StepModeEnum, stepSize: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throwsParameters
stepModeThe direction in which to move the level. This must be one of the values in [LevelControlTrait.StepModeEnum].
stepSizeThe amount of units to move the device’s
currentLevelto.transitionTimeThe time (in 0.1 seconds) taken to move the device to the new level.
optionsMaskDetermines which bits in the
optionsattribute should be overridden byoptionsOverride.optionsOverrideIf the corresponding bit in
optionsMaskis set to1, the bit set here overrides the corresponding bit inoptionsattribute. -
The batchable version of step command above.
See also
stepDeclaration
Swift
func stepBatchable(stepMode: Matter.LevelControlTrait.StepModeEnum, stepSize: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
stopcommand for this trait.Declaration
Swift
var supportsStopCommand: Bool { get } -
Terminate a Move, MoveToLevel, or Step command (including their OnOff variants) currently in progress, and sets the
remainingTimeattribute to0. This command andStopWithOnOffare identical.Declaration
Swift
func stop(optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throws -
The batchable version of stop command above.
See also
stopDeclaration
Swift
func stopBatchable(optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
moveToLevelWithOnOffcommand for this trait.Declaration
Swift
var supportsMoveToLevelWithOnOffCommand: Bool { get } -
Move a device from its current level to the provided level and toggle the
onOffattribute of theOnOffcluster depending on the end value ofcurrentLevel. If this command sets thecurrentLevelabove theminLevel, theonOffattribute is set to true. If this command sets thecurrentLevelto theminLevel, theonOffattribute is set to false.Declaration
Swift
func moveToLevelWithOnOff(level: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throwsParameters
levelThe level to move the device to.
transitionTimeThe time (in 0.1 seconds) taken to move the device to the new level.
optionsMaskDetermines which bits in the
optionsattribute should be overridden byoptionsOverride.optionsOverrideIf the corresponding bit in
optionsMaskis set to1, the bit set here overrides the corresponding bit inoptionsattribute. -
The batchable version of moveToLevelWithOnOff command above.
See also
moveToLevelWithOnOffDeclaration
Swift
func moveToLevelWithOnOffBatchable(level: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
moveWithOnOffcommand for this trait.Declaration
Swift
var supportsMoveWithOnOffCommand: Bool { get } -
Move a device’s level based on a rate of movement and toggle the
onOffattribute of theOnOffcluster depending on the end value ofcurrentLevel. If this command sets thecurrentLevelabove theminLevel, theonOffattribute is set to true. If this command sets thecurrentLevelto theminLevel, theonOffattribute is set to false.Declaration
Swift
func moveWithOnOff(moveMode: Matter.LevelControlTrait.MoveModeEnum, rate: UInt8?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throwsParameters
moveModeThe direction in which to move the level. This must be one of the values in [LevelControlTrait.MoveModeEnum].
rateoptionsMaskDetermines which bits in the
optionsattribute should be overridden byoptionsOverride.optionsOverrideIf the corresponding bit in
optionsMaskis set to1, the bit set here overrides the corresponding bit inoptionsattribute. -
The batchable version of moveWithOnOff command above.
See also
moveWithOnOffDeclaration
Swift
func moveWithOnOffBatchable(moveMode: Matter.LevelControlTrait.MoveModeEnum, rate: UInt8?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
stepWithOnOffcommand for this trait.Declaration
Swift
var supportsStepWithOnOffCommand: Bool { get } -
Move a device’s level a specific amount over a period of time and toggle the
onOffattribute of theOnOffcluster depending on the end value ofcurrentLevel. If thestepSizeused results in acurrentLevelthat is greater than themaxLevelor less than theminLevel, then the command stops when thecurrentLevelreaches themaxLevelorminLevel, respectively. The command may complete in a shorter time than specified fortransitionTimeif themaxLevelorminLevelis reached before the transition time is over. If this command sets thecurrentLevelabove theminLevel, theonOffattribute is set to true. If this command sets thecurrentLevelto theminLevel, theonOffattribute is set to false.Declaration
Swift
func stepWithOnOff(stepMode: Matter.LevelControlTrait.StepModeEnum, stepSize: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throwsParameters
stepModeThe direction in which to move the level. This must be one of the values in [LevelControlTrait.StepModeEnum].
stepSizeThe amount of units to move the device’s
currentLevelto.transitionTimeThe time (in 0.1 seconds) taken to move the device to the new level.
optionsMaskDetermines which bits in the
optionsattribute should be overridden byoptionsOverride.optionsOverrideIf the corresponding bit in
optionsMaskis set to1, the bit set here overrides the corresponding bit inoptionsattribute. -
The batchable version of stepWithOnOff command above.
See also
stepWithOnOffDeclaration
Swift
func stepWithOnOffBatchable(stepMode: Matter.LevelControlTrait.StepModeEnum, stepSize: UInt8, transitionTime: UInt16?, optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
stopWithOnOffcommand for this trait.Declaration
Swift
var supportsStopWithOnOffCommand: Bool { get } -
Terminate a Move, MoveToLevel, or Step command (including their OnOff variants) currently in progress, and sets the
remainingTimeattribute to0. This command andStopare identical.Declaration
Swift
func stopWithOnOff(optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) async throws -
The batchable version of stopWithOnOff command above.
See also
stopWithOnOffDeclaration
Swift
func stopWithOnOffBatchable(optionsMask: Matter.LevelControlTrait.OptionsBitmap, optionsOverride: Matter.LevelControlTrait.OptionsBitmap) throws -> BatchableCommand<Void> -
Whether the device supports the
moveToClosestFrequencycommand for this trait.Declaration
Swift
var supportsMoveToClosestFrequencyCommand: Bool { get } -
Change a device’s current frequency.
Declaration
Swift
func moveToClosestFrequency(frequency: UInt16) async throwsParameters
frequencyThe frequency to change the
currentFrequencyto. -
The batchable version of moveToClosestFrequency command above.
See also
moveToClosestFrequencyDeclaration
Swift
func moveToClosestFrequencyBatchable(frequency: UInt16) throws -> BatchableCommand<Void> -
The direction in which to move a device’s level.
Declaration
Swift
enum MoveModeEnum -
The direction in which to step a device’s level.
Declaration
Swift
enum StepModeEnum -
LevelControl cluster FeatureMap. Some behaviors of these features are described in the cluster attributes and commands. For complete details of these features, see the Matter Specification.
Declaration
Swift
struct Feature -
Flags for LevelControl options.
Declaration
Swift
struct OptionsBitmap