<br />

# ThermostatMode Schema

[Nest Thermostat](https://developers.google.com/nest/device-access/api/thermostat)

`sdm.devices.traits.ThermostatMode`

This trait belongs to device types of THERMOSTAT that support different thermostat modes.

<br />

## Fields


| Field | Description | Data Type |
|---|---|---|
| `availableModes` | List of supported thermostat modes. | `array(string)` Value: \["HEAT", "COOL", "HEATCOOL", "OFF"\] |
| `mode` | The current thermostat mode. | `string` Values: "HEAT", "COOL", "HEATCOOL", "OFF" |

<br />

<br />

#### Sample GET request and response

### Request

```
GET /enterprises/project-id/devices/device-id
```

### Response

    {
      "name" : "enterprises/project-id/devices/device-id",
      "traits" : {
        "sdm.devices.traits.ThermostatMode" : {
          "availableModes" : ["HEAT", "COOL", "HEATCOOL", "OFF"],
          "mode" : "COOL"
        }
      }
    }

<br />

## Commands

<br />

### SetMode

Change the thermostat mode.

<br />

> [!NOTE]
> This trait does not work with Eco modes. See the [ThermostatEco](https://developers.google.com/nest/device-access/traits/device/thermostat-eco) trait for more information.

<br />

#### SetMode request and response

### Request

    POST /enterprises/project-id/devices/device-id:executeCommand
    {
      "command" : "sdm.devices.commands.ThermostatMode.SetMode",
      "params" : {
        "mode" : "HEAT"
      }
    }

### Response

```
{}
```

#### SetMode request fields

| Field | Description | Data Type |
|---|---|---|
| `mode` | The mode to change the thermostat to. | `string` Values: "HEAT", "COOL", "HEATCOOL", "OFF" |

<br />


## Errors

The following error code(s) may be returned in relation to this trait:

| Error Message | RPC | Troubleshooting |
|---|---|---|
| Command not allowed in current thermostat mode. | `FAILED_PRECONDITION` | Some thermostat models do not support changing the Eco mode when the thermostat mode is OFF, according to the ThermostatMode trait. The thermostat mode must be changed to HEAT, COOL, or HEATCOOL prior to changing the Eco mode. |

See the [API Error Code Reference](https://developers.google.com/nest/device-access/reference/errors/api) for
the full list of API error codes.

<br />