struct DeviceEnergyManagementTraitThis trait provides an interface for managing the energy consumption of an energy smart appliance (ESA).
-
List of the event types that are supported by
DeviceEnergyManagementTrait.Declaration
Swift
static let supportedEventTypes: [any Event.Type] -
List of the commands that are supported by
DeviceEnergyManagementTrait.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
DeviceEnergyManagementTrait.Declaration
Swift
let attributes: Matter.DeviceEnergyManagementTrait.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
DeviceEnergyManagementTrait.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) -
Indicates a generic mechanism for expressing the cost to run an appliance.
Declaration
Swift
struct CostStruct -
The amount and duration of a power adjustment.
Declaration
Swift
struct PowerAdjustStruct -
Indicates a specific stage of an ESA’s operation.
Declaration
Swift
struct SlotStruct -
Indicates a list of
slotsto describe the overall timing of the ESA’s planned energy and power usage, with different power and energy demands for each slot. For example, slots might be used to describe the distinct stages of a washing machine cycle.Declaration
Swift
struct ForecastStruct -
Allows a client such as an EMS to inform an ESA about a constraint period.
Declaration
Swift
struct ConstraintsStruct -
Indicates requested power and duration adjustments for a specific slot.
Declaration
Swift
struct SlotAdjustmentStruct -
Indicates that the ESA has started the power adjustment session.
Declaration
Swift
struct PowerAdjustStartEvent -
Indicates that the ESA has ended the power adjustment session.
Declaration
Swift
struct PowerAdjustEndEvent -
Indicates that the ESA has paused its operation.
Declaration
Swift
struct PausedEvent -
Indicates that the ESA has resumed its operation.
Declaration
Swift
struct ResumedEvent -
Whether the device supports the
powerAdjustRequestcommand for this trait.Declaration
Swift
var supportsPowerAdjustRequestCommand: Bool { get } -
Allows a client, such as an EMS, to request an adjustment in the power consumption of an ESA for a specified duration.
Declaration
Swift
func powerAdjustRequest(power: Int64, duration: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) async throwsParameters
powerThe power, in milliwatts, that the ESA can use during the adjustment period. This value must be within the range of
MinPowerandMaxPowerin thePowerAdjustStruct.durationThe duration, in seconds, for which the ESA can adjust its power consumption. This value must be within the range of
MinDurationandMaxDurationin thePowerAdjustStruct.causeThe cause of the request from the EMS.
-
The batchable version of powerAdjustRequest command above.
See also
powerAdjustRequestDeclaration
Swift
func powerAdjustRequestBatchable(power: Int64, duration: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void> -
Whether the device supports the
cancelPowerAdjustRequestcommand for this trait.Declaration
Swift
var supportsCancelPowerAdjustRequestCommand: Bool { get } -
Allows a client, such as an EMS, to cancel an ongoing power adjustment request. The ESA should return to its normal power consumption state after the request is canceled.
Declaration
Swift
func cancelPowerAdjustRequest() async throws -
The batchable version of cancelPowerAdjustRequest command above.
See also
cancelPowerAdjustRequestDeclaration
Swift
func cancelPowerAdjustRequestBatchable() throws -> BatchableCommand<Void> -
Whether the device supports the
startTimeAdjustRequestcommand for this trait.Declaration
Swift
var supportsStartTimeAdjustRequestCommand: Bool { get } -
Allows a client to adjust the start time of a forecast sequence that has not yet started operation.
Declaration
Swift
func startTimeAdjustRequest(requestedStartTime: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) async throwsParameters
requestedStartTimeThe start time, in UTC, that the EMS requests the ESA to change its forecast sequence to. This value must be in the future.
causeThe cause of the request from the EMS.
-
The batchable version of startTimeAdjustRequest command above.
See also
startTimeAdjustRequestDeclaration
Swift
func startTimeAdjustRequestBatchable(requestedStartTime: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void> -
Whether the device supports the
pauseRequestcommand for this trait.Declaration
Swift
var supportsPauseRequestCommand: Bool { get } -
Allows a client to temporarily pause an operation and reduce the energy demand on the ESA.
Declaration
Swift
func pauseRequest(duration: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) async throwsParameters
durationThe duration, in seconds, for which the ESA should pause its operation.
causeThe cause of the request from the EMS.
-
The batchable version of pauseRequest command above.
See also
pauseRequestDeclaration
Swift
func pauseRequestBatchable(duration: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void> -
Whether the device supports the
resumeRequestcommand for this trait.Declaration
Swift
var supportsResumeRequestCommand: Bool { get } -
Allows a client to cancel the
PauseRequestcommand and enable the resumption of the previous operation.Declaration
Swift
func resumeRequest() async throws -
The batchable version of resumeRequest command above.
See also
resumeRequestDeclaration
Swift
func resumeRequestBatchable() throws -> BatchableCommand<Void> -
Whether the device supports the
modifyForecastRequestcommand for this trait.Declaration
Swift
var supportsModifyForecastRequestCommand: Bool { get } -
Allows an EMS to modify a forecast within the limits allowed by the ESA.
Declaration
Swift
func modifyForecastRequest(forecastID: UInt32, slotAdjustments: [Matter.DeviceEnergyManagementTrait.SlotAdjustmentStruct], cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) async throwsParameters
slotAdjustmentsA list of
slotAdjustmentparameters that should be modified in the corresponding forecast.causeThe cause of the request from the EMS.
-
The batchable version of modifyForecastRequest command above.
See also
modifyForecastRequestDeclaration
Swift
func modifyForecastRequestBatchable(forecastID: UInt32, slotAdjustments: [Matter.DeviceEnergyManagementTrait.SlotAdjustmentStruct], cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void> -
Whether the device supports the
requestConstraintBasedForecastcommand for this trait.Declaration
Swift
var supportsRequestConstraintBasedForecastCommand: Bool { get } -
Allows an EMS to request the ESA to recompute its forecast based on power and time constraints.
Declaration
Swift
func requestConstraintBasedForecast(constraints: [Matter.DeviceEnergyManagementTrait.ConstraintsStruct], cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) async throwsParameters
constraintsA series of turn-up or turn-down power constraints that the EMS is asking the ESA to adhere to in its forecast. For example, if a grid event requires devices to reduce power (turn down) between 4 p.m. and 6 p.m., and there is excess power on the grid overnight, this may cause an EMS to request that an ESA increase its power demand (turn up) between midnight and 6 a.m.
causeThe cause of the request from the EMS.
-
The batchable version of requestConstraintBasedForecast command above.
See also
requestConstraintBasedForecastDeclaration
Swift
func requestConstraintBasedForecastBatchable(constraints: [Matter.DeviceEnergyManagementTrait.ConstraintsStruct], cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void> -
Whether the device supports the
cancelRequestcommand for this trait.Declaration
Swift
var supportsCancelRequestCommand: Bool { get } -
Allows an EMS to request cancellation of a previous adjustment request made in a
StartTimeAdjustRequest,ModifyForecastRequest, orRequestConstraintBasedForecastcommand.Declaration
Swift
func cancelRequest() async throws -
The batchable version of cancelRequest command above.
See also
cancelRequestDeclaration
Swift
func cancelRequestBatchable() throws -> BatchableCommand<Void> -
The cause of the adjustment request from the EMS.
Declaration
Swift
enum AdjustmentCauseEnum -
The cause of the request from the EMS.
Declaration
Swift
enum CauseEnum -
The different types of costs.
Declaration
Swift
enum CostTypeEnum -
The state of the ESA.
Declaration
Swift
enum ESAStateEnum -
The type of the ESA.
Declaration
Swift
enum ESATypeEnum -
The reason for updating the forecast.
Declaration
Swift
enum ForecastUpdateReasonEnum -
The opt-out state of the ESA.
Declaration
Swift
enum OptOutStateEnum -
DeviceEnergyManagement trait FeatureMap.
Declaration
Swift
struct Feature