ThermostatTrait

struct ThermostatTrait

This trait provides an interface to the functionality of a thermostat.

  • No supported events for ThermostatTrait.

    Declaration

    Swift

    static let supportedEventTypes: [any Event.Type]
  • List of the commands that are supported by ThermostatTrait.

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

    Declaration

    Swift

    let attributes: Matter.ThermostatTrait.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 ThermostatTrait.

    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.ThermostatTrait, rhs: Matter.ThermostatTrait) -> 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)
  • A schedule transition.

    Declaration

    Swift

    struct ScheduleTransitionStruct
  • A schedule.

    Declaration

    Swift

    struct ScheduleStruct
  • A preset.

    Declaration

    Swift

    struct PresetStruct
  • A preset type.

    Declaration

    Swift

    struct PresetTypeStruct
  • A schedule type.

    Declaration

    Swift

    struct ScheduleTypeStruct
  • A single transition in a thermostat schedule.

    Declaration

    Swift

    struct WeeklyScheduleTransitionStruct
  • Whether the device supports the setpointRaiseLower command for this trait.

    Declaration

    Swift

    var supportsSetpointRaiseLowerCommand: Bool { get }
  • Change the setpoint for the current thermostat mode.

    Declaration

    Swift

    func setpointRaiseLower(mode: Matter.ThermostatTrait.SetpointRaiseLowerModeEnum, amount: Int8) async throws

    Parameters

    mode

    The setpoint(s) to be adjusted. Valid values are defined by SetpointRaiseLowerModeEnum.

    amount

    The amount (possibly negative) that should be added to the setpoint(s), in steps of 0.1°C.

  • The batchable version of setpointRaiseLower command above.

    See also

    setpointRaiseLower

    Declaration

    Swift

    func setpointRaiseLowerBatchable(mode: Matter.ThermostatTrait.SetpointRaiseLowerModeEnum, amount: Int8) throws -> BatchableCommand<Void>
  • Whether the device supports the setWeeklySchedule command for this trait.

    Declaration

    Swift

    var supportsSetWeeklyScheduleCommand: Bool { get }
  • Set the weekly schedule.

    Declaration

    Swift

    func setWeeklySchedule(numberOfTransitionsForSequence: UInt8, dayOfWeekForSequence: Matter.ThermostatTrait.ScheduleDayOfWeekBitmap, modeForSequence: Matter.ThermostatTrait.ScheduleModeBitmap, transitions: [Matter.ThermostatTrait.WeeklyScheduleTransitionStruct]) async throws

    Parameters

    numberOfTransitionsForSequence

    The number of individual transitions to expect for this sequence of commands.

    dayOfWeekForSequence

    The day(s) of the week to which all the transitions within the payload of the command should be associated. The bitmap values conform to those defined in ScheduleDayOfWeekBitmap.

    modeForSequence

    How the app decodes the coolSetpoint and heatSetpoint fields of each transition. The bitmap values confirm to those defined in ScheduleModeBitmap.

    transitions

    The list of setpoint transitions used to update the specified daily schedules. Each setpoint transition is represented by a WeeklyScheduleTransitionStruct.

  • The batchable version of setWeeklySchedule command above.

    See also

    setWeeklySchedule

    Declaration

    Swift

    func setWeeklyScheduleBatchable(numberOfTransitionsForSequence: UInt8, dayOfWeekForSequence: Matter.ThermostatTrait.ScheduleDayOfWeekBitmap, modeForSequence: Matter.ThermostatTrait.ScheduleModeBitmap, transitions: [Matter.ThermostatTrait.WeeklyScheduleTransitionStruct]) throws -> BatchableCommand<Void>
  • Whether the device supports the getWeeklySchedule command for this trait.

    Declaration

    Swift

    var supportsGetWeeklyScheduleCommand: Bool { get }
  • Get the weekly schedule for the device.

    Declaration

    Swift

    func getWeeklySchedule(daysToReturn: Matter.ThermostatTrait.ScheduleDayOfWeekBitmap, modeToReturn: Matter.ThermostatTrait.ScheduleModeBitmap) async throws -> Matter.ThermostatTrait.GetWeeklyScheduleCommandResponse

    Parameters

    daysToReturn

    The number of days the client would like to return the set point values for. It can be any combination of single days or the entire week.

    modeToReturn

    Indicates the mode the client would like to return the set point values for. It can be any combination of modes.

    Return Value

    The weekly schedule, with the same payload as setWeeklySchedule.

  • The batchable version of getWeeklySchedule command above.

    See also

    getWeeklySchedule

    Declaration

    Swift

    func getWeeklyScheduleBatchable(daysToReturn: Matter.ThermostatTrait.ScheduleDayOfWeekBitmap, modeToReturn: Matter.ThermostatTrait.ScheduleModeBitmap) throws -> BatchableCommand<Matter.ThermostatTrait.GetWeeklyScheduleCommandResponse>
  • Whether the device supports the clearWeeklySchedule command for this trait.

    Declaration

    Swift

    var supportsClearWeeklyScheduleCommand: Bool { get }
  • Clear the weekly schedule.

    Declaration

    Swift

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

    See also

    clearWeeklySchedule

    Declaration

    Swift

    func clearWeeklyScheduleBatchable() throws -> BatchableCommand<Void>
  • Whether the device supports the setActiveScheduleRequest command for this trait.

    Declaration

    Swift

    var supportsSetActiveScheduleRequestCommand: Bool { get }
  • The batchable version of setActiveScheduleRequest command above.

    See also

    setActiveScheduleRequest

    Declaration

    Swift

    func setActiveScheduleRequestBatchable(scheduleHandle: Data) throws -> BatchableCommand<Void>
  • Whether the device supports the setActivePresetRequest command for this trait.

    Declaration

    Swift

    var supportsSetActivePresetRequestCommand: Bool { get }
  • The batchable version of setActivePresetRequest command above.

    See also

    setActivePresetRequest

    Declaration

    Swift

    func setActivePresetRequestBatchable(presetHandle: Data?) throws -> BatchableCommand<Void>
  • Whether the device supports the atomicRequest command for this trait.

    Declaration

    Swift

    var supportsAtomicRequestCommand: Bool { get }
  • Begin, commit, or cancel an atomic write.

    Declaration

    Swift

    func atomicRequest(requestType: Matter.ThermostatTrait.AtomicRequestTypeEnum, attributeRequests: [UInt32], optionalArgsProvider: ((Matter.ThermostatTrait.AtomicRequestCommand.OptionalArgs) -> Void)? = nil) async throws -> Matter.ThermostatTrait.AtomicRequestCommandResponse
  • The batchable version of atomicRequest command above.

    See also

    atomicRequest

    Declaration

    Swift

    func atomicRequestBatchable(requestType: Matter.ThermostatTrait.AtomicRequestTypeEnum, attributeRequests: [UInt32], optionalArgsProvider: ((Matter.ThermostatTrait.AtomicRequestCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Matter.ThermostatTrait.AtomicRequestCommandResponse>
  • Unit of measurement used for the AC capacity.

    Declaration

    Swift

    enum ACCapacityFormatEnum
  • Types of compressor.

    Declaration

    Swift

    enum ACCompressorTypeEnum
  • The positions a louver may be in.

    Declaration

    Swift

    enum ACLouverPositionEnum
  • Types of refrigerant.

    Declaration

    Swift

    enum ACRefrigerantTypeEnum
  • Types of Air Conditioner features.

    Declaration

    Swift

    enum ACTypeEnum
  • The system modes that the thermostat can operate in.

    Declaration

    Swift

    enum ControlSequenceOfOperationEnum
  • Preset Scenarios.

    Declaration

    Swift

    enum PresetScenarioEnum
  • Possible sources of a given setpoint.

    Declaration

    Swift

    enum SetpointChangeSourceEnum
  • Specifies which setpoint is to be adjusted.

    Declaration

    Swift

    enum SetpointRaiseLowerModeEnum
  • Days of the week that may be designated the first day of the week.

    Declaration

    Swift

    enum StartOfWeekEnum
  • The current operating mode of the thermostat.

    Declaration

    Swift

    enum SystemModeEnum
  • Temperature setpoint hold statuses.

    Declaration

    Swift

    enum TemperatureSetpointHoldEnum
  • The running mode of the thermostat. Intended to provide additional information when the thermostat is in auto mode.

    Declaration

    Swift

    enum ThermostatRunningModeEnum
  • Types of atomic requests.

    Declaration

    Swift

    enum AtomicRequestTypeEnum
  • Thermostat cluster FeatureMap.

    Declaration

    Swift

    struct Feature
  • Describes the characteristics of the HVAC system.

    Declaration

    Swift

    struct HvacSystemTypeBitmap
  • Indicates the sensed occupancy state.

    Declaration

    Swift

    struct OccupancyBitmap
  • Preset type features.

    Declaration

    Swift

    struct PresetTypeFeaturesBitmap
  • Thermostat programming operational states.

    Declaration

    Swift

    struct ProgrammingOperationModeBitmap
  • Thermostate running states.

    Declaration

    Swift

    struct RelayStateBitmap
  • Remote sensing configurations.

    Declaration

    Swift

    struct RemoteSensingBitmap
  • Days of the week for scheduling.

    Declaration

    Swift

    struct ScheduleDayOfWeekBitmap
  • How the app decodes the setpoint fields of each transition.

    Declaration

    Swift

    struct ScheduleModeBitmap
  • Features that may be supported by a Thermostat schedule.

    Declaration

    Swift

    struct ScheduleTypeFeaturesBitmap