Join us online for the "Hey Google" Smart Home Summit on July 8th! Register here to learn what's new, and what's coming up for Google Smart Home.

Smart Home Thermostat Guide

Device TYPE

action.devices.types.THERMOSTAT Thermostats are temperature-managing devices, with set points and modes. This separates them from heaters and AC units which may only have modes and settings (for example, high/low) vs a temperature target.

Home Automation commands are frequently chained in EXECUTION intents. A user who says Set the heat to 72 will generate a mode command followed by a temperature set.

This type indicates that the device gets the thermostat icon and some thermostat-type synonyms/aliases. Unlike the light/outlet/switch types, it's largely 1:1 with the TRAIT (since a plug might really be a light, etc, but thermostats are their own thing). Devices of type Thermostat control temperature, whereas some heating/cooling room units have different controls and high/low modes, but not temperature controls.

These traits are recommended, if applicable to your device. However, you are free to mix and match from all available traits to best match your existing product functionality.

Sample SYNC Request and Response

This is an example using the device type and traits above. It is intended to give an idea of how to build a SYNC response. If you add or remove traits, this will need to be modified to reflect those changes.

Initialize thermostat setup.

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.THERMOSTAT',
        traits: [
          'action.devices.traits.TemperatureSetting'
        ],
        name: {
          defaultNames: ['Honeywell Thermostat T-1000'],
          name: 'Homer Simpson Thermostat',
          nicknames: ['living room thermostat']
        },
        willReportState: true,
        attributes: {
          availableThermostatModes: 'off,heat,cool,on',
          thermostatTemperatureUnit: 'F'
        },
        deviceInfo: {
          manufacturer: 'AAA',
          model: 't-1000',
          hwVersion: '3.2',
          swVersion: '11.4'
        },
        customData: {
          fooValue: 74,
          barValue: true,
          bazValue: 'lambtwirl'
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
Java
@NotNull
@Override
public SyncResponse onSync(@NotNull SyncRequest syncRequest, @Nullable Map<?, ?> headers) {
  SyncResponse.Payload payload = new SyncResponse.Payload();
  payload.setAgentUserId("1836.15267389");
  payload.setDevices(
      new SyncResponse.Payload.Device[] {
        new SyncResponse.Payload.Device.Builder()
            .setId("123")
            .setType("action.devices.types.THERMOSTAT")
            .addTrait("action.devices.traits.TemperatureSetting")
            .setName(
                Collections.singletonList("Smart Thermostat"),
                "Thermostat",
                Collections.singletonList("Living Room Thermostat"))
            .setWillReportState(true)
            .setAttributes(
                new JSONObject()
                    .put("availableThermostatModes", "off,heat,cool,on")
                    .put("thermostatTemperatureUnit", "F"))
            .setDeviceInfo("Sirius Cybernetics Corporation", "t-1000", "3.2", "11.4")
            .setCustomData(
                new JSONObject()
                    .put("fooValue", 74)
                    .put("barValue", true)
                    .put("bazValue", "lambtwirl")
                    .toString())
            .build()
      });
  return new SyncResponse(syncRequest.getRequestId(), payload);
}
JSON
{
  "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": true,
        "attributes": {
          "availableThermostatModes": "off,heat,cool,on",
          "thermostatTemperatureUnit": "F"
        },
        "deviceInfo": {
          "manufacturer": "AAA",
          "model": "t-1000",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        },
        "customData": {
          "fooValue": 74,
          "barValue": true,
          "bazValue": "lambtwirl"
        }
      }
    ]
  }
}
Validator

Device ERRORS

See the full list of errors and exceptions. Not all thermostats may evince all errors.

  • inHeatOrCool - Heat/Cool/Range commands failed because device is in explicit heat or cool.
  • inHeatCool - Heat or Cool commands failed because device is in heat or cool.
  • lockedToRange - Device is locked to a temperature range or mode, and the requested change can't be made.
  • rangeTooClose - Temperature points on a heatcool range are too close to each other.