struct CostStructIndicates a generic mechanism for expressing the cost to run an appliance.
-
The type of cost being represented.
Declaration
Swift
let costType: Matter.DeviceEnergyManagementTrait.CostTypeEnum -
The value of the cost. A positive number indicates a cost, and a negative number indicates a free benefit.
Declaration
Swift
let value: Int32 -
The number of digits to the right of the decimal point in the
Valuefield. For example, if the value is102andDecimalPointsis2, this would represent a cost of1.02.Declaration
Swift
let decimalPoints: UInt8 -
Indicates the currency for the value in the
Valuefield. The value of thecurrencyfield must match the values defined by ISO 4217.Declaration
Swift
let currency: UInt16? -
Creates a new Struct instance using data read from the given
TraitDecoder.Throws
HomeError.parseErrorwhen parsing fails.Declaration
Swift
init(decoder: TraitDecoder) throwsParameters
decoderThe raw data representing this Struct.
-
Writes this Struct to the given
TraitEncoder. ThrowsHomeError.parseErrorif the data could not be encoded.Declaration
Swift
func encode(with encoder: TraitEncoder) throws -
Returns the field corresponding to the given field ID.
Declaration
Swift
static func structField(id: UInt32) -> (any Field)?