DeviceEnergyManagementTrait

struct DeviceEnergyManagementTrait

This 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.parseError when parsing fails.

    Declaration

    Swift

    init(decoder: TraitDecoder, interactionProxy: (any InteractionProxy)?, metadata: TraitMetadata) throws

    Parameters

    decoder

    The raw data representing this Trait.

    interactionProxy

    Proxy to the Interaction Client.

    metadata

    Metadata about this Trait.

  • Writes this object to the given TraitEncoder. Throws HomeError.encodingFailed if 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 a and b, a == b implies that a != b is false.

    Declaration

    Swift

    static func == (lhs: Matter.DeviceEnergyManagementTrait, rhs: Matter.DeviceEnergyManagementTrait) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Hashes the essential components of this value by feeding them into the given hasher.

    Implement this method to conform to the Hashable protocol. The components used for hashing must be the same as the components compared in your type’s == operator implementation. Call hasher.combine(_:) with each of these components.

    Important

    In your implementation of hash(into:), don’t call finalize() on the hasher instance 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 slots to 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 powerAdjustRequest command 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 throws

    Parameters

    power

    The power, in milliwatts, that the ESA can use during the adjustment period. This value must be within the range of MinPower and MaxPower in the PowerAdjustStruct.

    duration

    The duration, in seconds, for which the ESA can adjust its power consumption. This value must be within the range of MinDuration and MaxDuration in the PowerAdjustStruct.

    cause

    The cause of the request from the EMS.

  • The batchable version of powerAdjustRequest command above.

    See also

    powerAdjustRequest

    Declaration

    Swift

    func powerAdjustRequestBatchable(power: Int64, duration: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void>
  • Whether the device supports the cancelPowerAdjustRequest command 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

    cancelPowerAdjustRequest

    Declaration

    Swift

    func cancelPowerAdjustRequestBatchable() throws -> BatchableCommand<Void>
  • Whether the device supports the startTimeAdjustRequest command 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 throws

    Parameters

    requestedStartTime

    The start time, in UTC, that the EMS requests the ESA to change its forecast sequence to. This value must be in the future.

    cause

    The cause of the request from the EMS.

  • The batchable version of startTimeAdjustRequest command above.

    See also

    startTimeAdjustRequest

    Declaration

    Swift

    func startTimeAdjustRequestBatchable(requestedStartTime: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void>
  • Whether the device supports the pauseRequest command 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 throws

    Parameters

    duration

    The duration, in seconds, for which the ESA should pause its operation.

    cause

    The cause of the request from the EMS.

  • The batchable version of pauseRequest command above.

    See also

    pauseRequest

    Declaration

    Swift

    func pauseRequestBatchable(duration: UInt32, cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void>
  • Whether the device supports the resumeRequest command for this trait.

    Declaration

    Swift

    var supportsResumeRequestCommand: Bool { get }
  • Allows a client to cancel the PauseRequest command and enable the resumption of the previous operation.

    Declaration

    Swift

    func resumeRequest() async throws
  • The batchable version of resumeRequest command above.

    See also

    resumeRequest

    Declaration

    Swift

    func resumeRequestBatchable() throws -> BatchableCommand<Void>
  • Whether the device supports the modifyForecastRequest command 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 throws

    Parameters

    slotAdjustments

    A list of slotAdjustment parameters that should be modified in the corresponding forecast.

    cause

    The cause of the request from the EMS.

  • The batchable version of modifyForecastRequest command above.

    See also

    modifyForecastRequest

    Declaration

    Swift

    func modifyForecastRequestBatchable(forecastID: UInt32, slotAdjustments: [Matter.DeviceEnergyManagementTrait.SlotAdjustmentStruct], cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void>
  • Whether the device supports the requestConstraintBasedForecast command 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 throws

    Parameters

    constraints

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

    cause

    The cause of the request from the EMS.

  • The batchable version of requestConstraintBasedForecast command above.

    See also

    requestConstraintBasedForecast

    Declaration

    Swift

    func requestConstraintBasedForecastBatchable(constraints: [Matter.DeviceEnergyManagementTrait.ConstraintsStruct], cause: Matter.DeviceEnergyManagementTrait.AdjustmentCauseEnum) throws -> BatchableCommand<Void>
  • Whether the device supports the cancelRequest command 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, or RequestConstraintBasedForecast command.

    Declaration

    Swift

    func cancelRequest() async throws
  • The batchable version of cancelRequest command above.

    See also

    cancelRequest

    Declaration

    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