Smart Home TemperatureSetting Trait Schema

action.devices.traits.TemperatureSetting - This trait covers handling both temperature point and modes.

Device ATTRIBUTES

Attribute Definition
availableThermostatModes Comma-separated list of modes supported by this specific device. Currently supports specific known modes from the following list; more and custom ones will be added as needed. These modes all have local expansion aliases (off == "standby", etc).
  • off Heating/Cooling activity disabled.
  • heat If the device supports heating.
  • cool If the device supports cooling.
  • on If off, on restores the previous mode of the device.
  • heatcool If the device supports maintaining heating/cooling to target a range.
  • auto If the device supports an "automatic" mode where the temperature is set based on a schedule, learned behavior, AI, or some other related mechanism.
  • fan-only If the device supports a mode where only the fan is on (not fan and another mode like cool.)
  • purifier If the device supports a purifying mode.
  • eco If the device supports an "eco" (that is, energy-saving) mode.
  • dry If the device supports a dry mode
thermostatTemperatureUnit C or F. The unit the device is set to by default. The device "speaks" using its display unit.

Sample SYNC Request and Response

Initialize Thermostat setting.
Request
{
    "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
    "inputs": [{
      "intent": "action.devices.SYNC"
    }]
}
Node.jsResponse
'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.THERMOSTAT',
        traits: [
          'action.devices.traits.TemperatureSetting'
        ],
        name: {
          defaultNames: ['Honeywell Thermostat T-1000'],
          name: 'Homer Simpson Thermostat',
          nicknames: ['living room thermostat']
        },
        willReportState: false,
        attributes: {
          availableThermostatModes: 'off,heat,cool,on',
          thermostatTemperatureUnit: 'F'
        },
        deviceInfo: {
          manufacturer: 'honeywell',
          model: 't-1000',
          hwVersion: '3.2',
          swVersion: '11.4'
        },
        customData: {
          fooValue: 74,
          barValue: true,
          bazValue: 'lambtwirl'
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
JSONResponse
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "agentUserId": "1836.15267389",
    "devices": [
      {
        "id": "123",
        "type": "action.devices.types.THERMOSTAT",
        "traits": [
          "action.devices.traits.TemperatureSetting"
        ],
        "name": {
          "defaultNames": [
            "Honeywell Thermostat T-1000"
          ],
          "name": "Homer Simpson Thermostat",
          "nicknames": [
            "living room thermostat"
          ]
        },
        "willReportState": false,
        "attributes": {
          "availableThermostatModes": "off,heat,cool,on",
          "thermostatTemperatureUnit": "F"
        },
        "deviceInfo": {
          "manufacturer": "honeywell",
          "model": "t-1000",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        },
        "customData": {
          "fooValue": 74,
          "barValue": true,
          "bazValue": "lambtwirl"
        }
      }
    ]
  }
}
Validator

Device STATES

State Definition
thermostatMode Current mode of the device, with the same values as the attribute
thermostatTemperatureSetpoint Current temperature set point (single target), in C
thermostatTemperatureAmbient Current observe temperature, in C
thermostatTemperatureSetpointHigh Current high point if in heatcool mode, for a range
thermostatTemperatureSetpointLow Current low point if in heatcool mode, for a range
thermostatHumidityAmbient Float. 0-100. If available from the device.

Sample QUERY Request and Response

Request
{
    "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
    "inputs": [{
      "intent": "action.devices.QUERY",
      "payload": {
        "devices": [{
          "id": "123",
          "customData": {
            "fooValue": 74,
            "barValue": true,
            "bazValue": "foo"
          }
        }, {
          "id": "456",
          "customData": {
            "fooValue": 12,
            "barValue": false,
            "bazValue": "bar"
          }
        }]
      }
    }]
}
Node.jsResponse
'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,
          thermostatMode: 'cool',
          thermostatTemperatureSetpoint: 23.0,
          thermostatTemperatureAmbient: 25.1,
          thermostatHumidityAmbient: 45.3
        }
      }
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
JSONResponse
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "devices": {
      "123": {
        "online": true,
        "thermostatMode": "cool",
        "thermostatTemperatureSetpoint": 23,
        "thermostatTemperatureAmbient": 25.1,
        "thermostatHumidityAmbient": 45.3
      }
    }
  }
}

Device COMMANDS

Command Parameters/Definition
action.devices.commands.ThermostatTemperatureSetpoint thermostatTemperatureSetpoint Float (in speech we generally take 1 decimal point, for Celsius users).
action.devices.commands.ThermostatTemperatureSetRange thermostatTemperatureSetpointHigh
thermostatTemperatureSetpointLow
Floats. The high and low set points for a range. This works if and only if the device supports heatcool mode, and we will set that mode if a range is requested.
action.devices.commands.ThermostatSetMode thermostatMode One of the supported modes on the device.

Sample EXECUTE Request and Response

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.ThermostatTemperatureSetpoint",
          "params": {
            "thermostatTemperatureSetpoint": 22.0
          }
        }]
      }]
    }
  }]
}
Node.jsResponse
'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: {
          thermostatMode: 'cool',
          thermostatTemperatureSetpoint: 22.0,
          thermostatTemperatureAmbient: 25.1,
          thermostatHumidityAmbient: 43.2
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
JSONResponse
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {
          "thermostatMode": "cool",
          "thermostatTemperatureSetpoint": 22,
          "thermostatTemperatureAmbient": 25.1,
          "thermostatHumidityAmbient": 43.2
        }
      }
    ]
  }
}