# ConstraintsStruct

    struct ConstraintsStruct

Allows a client such as an EMS to inform an ESA about a constraint period.
- `


  ### [startTime](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV9startTimes6UInt32Vvp)


  ` The start time, in UTC, of the constraint period.

  #### Declaration

  Swift

      let startTime: UInt32

- `


  ### [duration](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV8durations6UInt32Vvp)


  ` The duration, in seconds, of the constraint period.

  #### Declaration

  Swift

      let duration: UInt32

- `


  ### [nominalPower](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV12nominalPowers5Int64VSgvp)


  ` The nominal power, in milliwatts, at which the EMS requests the ESA to operate during the
  constrained period.

  #### Declaration

  Swift

      let nominalPower: Int64?

- `


  ### [maximumEnergy](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV07maximumF0s5Int64VSgvp)


  ` The maximum amount of energy, in megawatt hours, that the ESA can use during the
  constraint period. This is a signed value and can be used to indicate charging or
  discharging.

  #### Declaration

  Swift

      let maximumEnergy: Int64?

- `


  ### [loadControl](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV11loadControls4Int8VSgvp)


  ` Indicates the turn-up or turn-down value for the ESA during the constraint period. This is
  expressed as a signed value between -100 and +100. A negative value indicates a request to
  use less energy, and a positive value indicates a request to use more energy. A value of 0
  is neutral.

  #### Declaration

  Swift

      let loadControl: Int8?

- `


  ### [init(decoder:)](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV7decoderAG0aB3SDK0H7DecoderV_tKcfc)


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

- `


  ### [encode(with:)](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV6encode4withy0aB3SDK0H7EncoderC_tKF)


  ` 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

- `


  ### [structField(id:)](https://developers.home.google.com/reference/swift/GoogleHomeTypes/Enums/Matter/DeviceEnergyManagementTrait/ConstraintsStruct#/s:15GoogleHomeTypes6MatterO27DeviceEnergyManagementTraitV17ConstraintsStructV11structField2id0aB3SDK0L0_pSgs6UInt32V_tFZ)


  ` Returns the field corresponding to the given field ID.

  #### Declaration

  Swift

      static func structField(id: UInt32) -> (any Field)?