BalanceStruct

struct BalanceStruct

Represents a step along a scale of preferences.

  • The relative value, in percentage, along a scale of preferences. Supported values:

    • 0: The device entirely favors the priority specified by the first element in the energyPriorities attribute.
    • 50: The device splits its energy consumption between the two priorities in the energyPriorities attribute.
    • 100: The device entirely favors the priority specified by the second element in the energyPriorities attribute.

    Declaration

    Swift

    let step: UInt8
  • An optional string explaining which actions a device might take at the given step value.

    Declaration

    Swift

    let label: String?
  • Creates a new Struct instance using data read from the given TraitDecoder.

    Throws

    HomeError.parseError when parsing fails.

    Declaration

    Swift

    init(decoder: TraitDecoder) throws

    Parameters

    decoder

    The raw data representing this Struct.

  • Writes this Struct to the given TraitEncoder. Throws HomeError.parseError if 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)?