We want to hear your thoughts on the Google Smart Home platform. Join a user study and receive a gift for your input. Click here to sign up.

Smart Home Air Cooler Guide

Device TYPE

action.devices.types.AIRCOOLER - Air coolers are devices that allow temperature cooling and humidity control. These devices are typically more lightweight and portable than air conditioners, and have a water tank attached. Air coolers may not support heating or setting exact temperatures. Interactions with air coolers may include changing the fan speed and humidity setting.

This type indicates that the device gets the air cooler icon and some synonyms/aliases.

Device capabilities

Refer to the corresponding trait documentation for implementation details, such as attributes and states that your service should support, and how to build EXECUTE and QUERY responses.

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.

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.AIRCOOLER',
        traits: [
          'action.devices.traits.TemperatureSetting',
          'action.devices.traits.OnOff',
          'action.devices.traits.FanSpeed',
          'action.devices.traits.HumiditySetting',
          'action.devices.traits.Toggles'
        ],
        name: {
          defaultNames: ['Sirius Cybernetics Corporation Air Cooler'],
          name: 'Air Cooler',
          nicknames: ['Bedroom Air Cooler']
        },
        willReportState: true,
        attributes: {
          humiditySetpointRange: {
            minPercent: 0,
            maxPercent: 50
          },
          availableFanSpeeds: {
            speeds: [{
              speed_name: '0',
              speed_values: [{
                speed_synonym: ['off', '0'],
                lang: 'en',
              }],
            }, {
              speed_name: '1',
              speed_values: [{
                speed_synonym: ['low', '1'],
                lang: 'en',
              }],
            }, {
              speed_name: '2',
              speed_values: [{
                speed_synonym: ['medium', '2'],
                lang: 'en',
              }],
            }, {
              speed_name: '3',
              speed_values: [{
                speed_synonym: ['high', '3'],
                lang: 'en',
              }],
            }],
            ordered: true,
          },
          reversible: true,
          availableToggles: [{
            name: 'rotate',
            name_values: [{
              name_synonym: ['rotate', 'rotating', 'rotation'],
              lang: 'en',
            }],
          }],
          availableThermostatModes: ['off', 'cool', 'on', 'fan-only', 'eco'],
          thermostatTemperatureUnit: 'C',
        },
        deviceInfo: {
          manufacturer: 'Sirius Cybernetics Corporation',
          model: '492134',
          hwVersion: '3.2',
          swVersion: '11.4'
        },
        customData: {
          fooValue: 74,
          barValue: true,
          bazValue: 'lambtwirl'
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
Java
@NotNull
@Override
@SmartHomeSnippetJson("smart-home-types-aircooler_sync.json")
public SyncResponse onSync(@NotNull SyncRequest syncRequest, @Nullable Map<?, ?> headers) {
  Payload payload = new Payload();
  payload.setAgentUserId("1836.15267389");

  payload.setDevices(
      new Device[] {
        new Device.Builder()
            .setId("123")
            .setType("action.devices.types.AIRCOOLER")
            .addTrait("action.devices.traits.TemperatureSetting")
            .addTrait("action.devices.traits.OnOff")
            .addTrait("action.devices.traits.FanSpeed")
            .addTrait("action.devices.traits.HumiditySetting")
            .addTrait("action.devices.traits.Toggles")
            .setName(
                Collections.singletonList("Sirius Cybernetics Corporation Air Cooler"),
                "Air Cooler",
                Collections.singletonList("Bedroom Air Cooler"))
            .setWillReportState(true)
            .setAttributes(
                new JSONObject()
                    .put(
                        "humiditySetpointRange",
                        new JSONObject().put("minPercent", 0).put("maxPercent", 50))
                    .put(
                        "availableFanSpeeds",
                        new JSONObject()
                            .put(
                                "speeds",
                                new JSONObject[] {
                                  new JSONObject()
                                      .put("speed_name", "0")
                                      .put(
                                          "speed_values",
                                          new JSONObject[] {
                                            new JSONObject()
                                                .put("speed_synonym", new String[] {"off", "0"})
                                                .put("lang", "en")
                                          }),
                                  new JSONObject()
                                      .put("speed_name", "1")
                                      .put(
                                          "speed_values",
                                          new JSONObject[] {
                                            new JSONObject()
                                                .put("speed_synonym", new String[] {"low", "1"})
                                                .put("lang", "en")
                                          }),
                                  new JSONObject()
                                      .put("speed_name", "2")
                                      .put(
                                          "speed_values",
                                          new JSONObject[] {
                                            new JSONObject()
                                                .put(
                                                    "speed_synonym", new String[] {"medium", "2"})
                                                .put("lang", "en")
                                          }),
                                  new JSONObject()
                                      .put("speed_name", "3")
                                      .put(
                                          "speed_values",
                                          new JSONObject[] {
                                            new JSONObject()
                                                .put("speed_synonym", new String[] {"high", "3"})
                                                .put("lang", "en")
                                          })
                                })
                            .put("ordered", true))
                    .put("reversible", true)
                    .put(
                        "availableToggles",
                        new JSONObject[] {
                          new JSONObject()
                              .put("name", "rotate")
                              .put(
                                  "name_values",
                                  new JSONObject[] {
                                    new JSONObject()
                                        .put(
                                            "name_synonym",
                                            new String[] {"rotate", "rotating", "rotation"})
                                        .put("lang", "en")
                                  })
                        })
                    .put(
                        "availableThermostatModes",
                        new String[] {"off", "cool", "on", "fan-only", "eco"})
                    .put("thermostatTemperatureUnit", "C"))
            .setDeviceInfo("Sirius Cybernetics Corporation", "492134", "3.2", "11.4")
            .setCustomData(
                new JSONObject()
                    .put("fooValue", 74)
                    .put("barValue", true)
                    .put("bazValue", "lambtwirl"))
            .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.AIRCOOLER",
        "traits": [
          "action.devices.traits.TemperatureSetting",
          "action.devices.traits.OnOff",
          "action.devices.traits.FanSpeed",
          "action.devices.traits.HumiditySetting",
          "action.devices.traits.Toggles"
        ],
        "name": {
          "defaultNames": [
            "Sirius Cybernetics Corporation Air Cooler"
          ],
          "name": "Air Cooler",
          "nicknames": [
            "Bedroom Air Cooler"
          ]
        },
        "willReportState": true,
        "attributes": {
          "humiditySetpointRange": {
            "minPercent": 0,
            "maxPercent": 50
          },
          "availableFanSpeeds": {
            "speeds": [
              {
                "speed_name": "0",
                "speed_values": [
                  {
                    "speed_synonym": [
                      "off",
                      "0"
                    ],
                    "lang": "en"
                  }
                ]
              },
              {
                "speed_name": "1",
                "speed_values": [
                  {
                    "speed_synonym": [
                      "low",
                      "1"
                    ],
                    "lang": "en"
                  }
                ]
              },
              {
                "speed_name": "2",
                "speed_values": [
                  {
                    "speed_synonym": [
                      "medium",
                      "2"
                    ],
                    "lang": "en"
                  }
                ]
              },
              {
                "speed_name": "3",
                "speed_values": [
                  {
                    "speed_synonym": [
                      "high",
                      "3"
                    ],
                    "lang": "en"
                  }
                ]
              }
            ],
            "ordered": true
          },
          "reversible": true,
          "availableToggles": [
            {
              "name": "rotate",
              "name_values": [
                {
                  "name_synonym": [
                    "rotate",
                    "rotating",
                    "rotation"
                  ],
                  "lang": "en"
                }
              ]
            }
          ],
          "availableThermostatModes": [
            "off",
            "cool",
            "on",
            "fan-only",
            "eco"
          ],
          "thermostatTemperatureUnit": "C"
        },
        "deviceInfo": {
          "manufacturer": "Sirius Cybernetics Corporation",
          "model": "492134",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        },
        "customData": {
          "fooValue": 74,
          "barValue": true,
          "bazValue": "lambtwirl"
        }
      }
    ]
  }
}
Validator

Device ERRORS

See the full list of errors and exceptions.