# Smart Home ColorTemperature Trait Schema

> [!NOTE]
> This trait has been deprecated. Use [ColorSetting](https://developers.home.google.com/cloud-to-cloud/traits/colorsetting) instead.

`action.devices.traits.ColorTemperature` - This trait belongs to any
devices that is able to set color temperature.
This applies to "warmth" bulbs that take a color point in Kelvin. This is generally a separate modality from [ColorSpectrum](https://developers.home.google.com/cloud-to-cloud/traits/colorspectrum), and there may be white points available via Temperature that cannot be reached by Spectrum. Based on available traits, Google may pick the appropriate mode to use based on request and light type (for example, *Make the living room lights white* might send Temperature commands to some bulbs and Spectrum commands to LED strips).

## Device ATTRIBUTES

| Attribute | Definition |
|---|---|
| `temperatureMinK` | Optional. Required if `temperatureMaxK` is set. Minimum color temperature supported by the light, in Kelvin. |
| `temperatureMaxK` | Optional. Required if `temperatureMinK` is set. Maximum color temperature supported by the light, in Kelvin. |

## Sample SYNC Request and Response

Request

```
{
    "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
    "inputs": [{
      "intent": "action.devices.SYNC"
    }]
}
```

##### Node.js

```
'use strict';

const {smarthome} = require('actions-on-google');
const functions = require('firebase-functions');

const app = smarthome();

app.onSync((body, headers) => {
  return {
    requestId: body.requestId,
    payload: {
      agentUserId: '1836.15267389',
      devices: [{
        id: '123',
        type: 'action.devices.types.LIGHT',
        traits: [
          'action.devices.traits.ColorTemperature'
        ],
        name: {
          defaultNames: ['AAA bulb A19 color hyperglow'],
          name: 'lamp1',
          nicknames: ['reading lamp']
        },
        willReportState: true,
        attributes: {
          temperatureMinK: 2000,
          temperatureMaxK: 6500
        },
        deviceInfo: {
          manufacturer: 'AAA',
          model: 'hg11',
          hwVersion: '1.2',
          swVersion: '5.4'
        },
        customData: {
          fooValue: 12,
          barValue: false,
          bazValue: 'dancing alpaca'
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
```

##### JSON

```
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "agentUserId": "1836.15267389",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.LIGHT",
        "traits": [
          "action.devices.traits.ColorTemperature"
        ],
        "name": {
          "defaultNames": [
            "AAA bulb A19 color hyperglow"
          ],
          "name": "lamp1",
          "nicknames": [
            "reading lamp"
          ]
        },
        "willReportState": true,
        "attributes": {
          "temperatureMinK": 2000,
          "temperatureMaxK": 6500
        },
        "deviceInfo": {
          "manufacturer": "AAA",
          "model": "hg11",
          "hwVersion": "1.2",
          "swVersion": "5.4"
        },
        "customData": {
          "fooValue": 12,
          "barValue": false,
          "bazValue": "dancing alpaca"
        }
      }
    ]
  }
}
```
Validator Paste the SYNC JSON in the text area below. <button id="runbutton" class="gc-analytics-event" data-category="sh-traits" data-action="validate" data-label="action.devices.traits.ColorTemperature">Validate</button>

{ "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "agentUserId": "1836.15267389", "devices": \[ { "id": "123", "type": "action.devices.types.LIGHT", "traits": \[ "action.devices.traits.ColorTemperature" \], "name": { "defaultNames": \[ "AAA bulb A19 color hyperglow" \], "name": "lamp1", "nicknames": \[ "reading lamp" \] }, "willReportState": true, "attributes": { "temperatureMinK": 2000, "temperatureMaxK": 6500 }, "deviceInfo": { "manufacturer": "AAA", "model": "hg11", "hwVersion": "1.2", "swVersion": "5.4" }, "customData": { "fooValue": 12, "barValue": false, "bazValue": "dancing alpaca" } } \] } }

## Device STATES

| State | Definition |
|---|---|
| `color` | Object. Current color setting. Since a given light is in spectrum OR temperature mode, this object includes the current color settings in the relevant mode. - `name` String. If the color point (Spectrum or Temperature) matches a preset name on the partner's color list, return the name. - `temperature` Integer. Color temperature in Kelvin. |

### Sample QUERY Request and Response

*What is my current light color temperature?* Request

```
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "inputs": [{
    "intent": 'action.devices.QUERY',
    "payload": {
      "devices": [{
        "id": "123",
        "customData": {
          "fooValue": 74,
          "barValue": true,
          "bazValue": "foo"
        }
      }]
    }
  }]
}
```

##### Node.js

```
'use strict';

const {smarthome} = require('actions-on-google');
const functions = require('firebase-functions');

const app = smarthome();

app.onQuery((body, headers) => {
  return {
    requestId: body.requestId,
    payload: {
      devices: {
        123: {
          online: true,
          color: {
            name: 'warm white',
            temperature: 25000
          },
          status: 'SUCCESS'
        }
      }
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
```

##### JSON

```
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "devices": {
      "123": {
        "online": true,
        "color": {
          "name": "warm white",
          "temperature": 25000
        },
        "status": "SUCCESS"
      }
    }
  }
}
```

## Device COMMANDS

| Command | Parameters/Definition |
|---|---|
| `action.devices.commands.ColorAbsolute` | `color` Object. Required. Will include RGB or Temperature and optionally, a name. - `name` String. Color name (in English) as provided in the user's command. Not always available (for relative commands). - `temperature` Integer. Color temperature in Kelvin. |

### Sample EXECUTE Request and Response

*Adjust my light to soft white.* Request

```
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "inputs": [{
    "intent": "action.devices.EXECUTE",
    "payload": {
      "commands": [{
        "devices": [{
          "id": "123",
          "customData": {
            "fooValue": 74,
            "barValue": true,
            "bazValue": "sheepdip"
          }
        }],
        "execution": [{
          "command": "action.devices.commands.ColorAbsolute",
          "params": {
              "color": {
                "name": "soft white",
                "temperature": 2700
              }
          }
        }]
      }]
    }
  }]
}
```

##### Node.js

```
'use strict';

const {smarthome} = require('actions-on-google');
const functions = require('firebase-functions');

const app = smarthome();

app.onExecute((body, headers) => {
  return {
    requestId: body.requestId,
    payload: {
      commands: [{
        ids: ['123'],
        status: 'SUCCESS',
        states: {
          color: {
            name: 'soft white',
            temperature: 2700
          }
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
```

##### JSON

```
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "color": {
            "name": "soft white",
            "temperature": 2700
          }
        }
      }
    ]
  }
}
```