# DeviceEnergyManagementTrait.CostStruct

# DeviceEnergyManagementTrait.CostStruct


```
class DeviceEnergyManagementTrait.CostStruct : ClusterStruct
```

<br />

*** ** * ** ***

Indicates a generic mechanism for expressing the cost to run an appliance.

## Summary

| ### Nested types |
|---|
| `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalGenericApi enum https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct.StructFields : https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html, https://developers.home.google.com/reference/kotlin/com/google/home/Field` Descriptor enum for this struct's fields. |

| ### Public constructors |
|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct#CostStruct(com.google.home.matter.standard.DeviceEnergyManagementTrait.CostTypeEnum,kotlin.Int,kotlin.UByte,com.google.home.matter.serialization.OptionalValue)( costType: https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostTypeEnum, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, decimalPoints: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/index.html, currency: https://developers.home.google.com/reference/kotlin/com/google/home/matter/serialization/OptionalValue<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html> )` Creates the CostStruct class. |

| ### Public functions |
|---|---|
| `open https://developers.home.google.com/reference/kotlin/com/google/home/StructDescriptor` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalGenericApi https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct#getDescriptor()()` Returns the descriptor for the struct. |
| `open https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalGenericApi https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct#getFieldValueById(kotlin.UInt)(tagId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-int/index.html)` Returns the value of the field for the given tag ID. |

| ### Public properties |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostTypeEnum` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct#costType()` The type of cost being represented. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/matter/serialization/OptionalValue<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-short/index.html>` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct#currency()` Indicates the currency for the value in the Value field. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-u-byte/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct#decimalPoints()` The number of digits to the right of the decimal point in the Value field. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/DeviceEnergyManagementTrait.CostStruct#value()` The value of the cost. |

## Public constructors

### CostStruct

```
CostStruct(
    costType: DeviceEnergyManagementTrait.CostTypeEnum = CostTypeEnum.Financial,
    value: Int = 0,
    decimalPoints: UByte,
    currency: OptionalValue<UShort> = OptionalValue.absent()
)
```

Creates the CostStruct class.

## Public functions

### getDescriptor

```
@HomeExperimentalGenericApi
open fun getDescriptor(): StructDescriptor
```

Returns the descriptor for the struct.

### getFieldValueById

```
@HomeExperimentalGenericApi
open fun getFieldValueById(tagId: UInt): Any?
```

Returns the value of the field for the given tag ID.

## Public properties

### costType

```
val costType: DeviceEnergyManagementTrait.CostTypeEnum
```

The type of cost being represented.

### currency

```
val currency: OptionalValue<UShort>
```

Indicates the currency for the value in the Value field. The value of the `currency` field must match the values defined by ISO 4217.

### decimalPoints

```
val decimalPoints: UByte
```

The number of digits to the right of the decimal point in the Value field. For example, if the value is `102` and `DecimalPoints`is `2`, this would represent a cost of `1.02`.

### value

```
val value: Int
```

The value of the cost. A positive number indicates a cost, and a negative number indicates a free benefit.