Smart Home Freezer Guide

Device TYPE

action.devices.types.FREEZER - Freezers are temperature-managing devices which may be adjusted to various mode settings, and may allow temperature monitoring.

This type indicates that the device gets the freezer 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.FREEZER',
        traits: [
          'action.devices.traits.OnOff',
          'action.devices.traits.Modes',
          'action.devices.traits.Toggles',
          'action.devices.traits.TemperatureControl'
        ],
        name: {
          defaultNames: ['Sirius Cybernetics Corporation Freezer'],
          name: 'Freezer',
          nicknames: ['Kitchen Freezer']
        },
        willReportState: true,
        attributes: {
          availableToggles: [{
            name: 'powerfreeze',
            name_values: [{
              name_synonym: ['power freeze', 'power'],
              lang: 'en',
            }],
          }],
          availableModes: [{
            name: 'currentmode',
            name_values: [{
              name_synonym: ['current mode', 'current', 'mode'],
              lang: 'en',
            }],
            settings: [{
              setting_name: 'freeze',
              setting_values: [{
                setting_synonym: ['Freeze'],
                lang: 'en'
              }]
            }, {
              setting_name: 'cool',
              setting_values: [{
                setting_synonym: ['Cool'],
                lang: 'en'
              }]
            }, {
              setting_name: 'wine',
              setting_values: [{
                setting_synonym: ['Wine'],
                lang: 'en'
              }]
            }, {
              setting_name: 'sabbath',
              setting_values: [{
                setting_synonym: ['Sabbath'],
                lang: 'en'
              }]
            }],
            ordered: false
          }],
          queryOnlyTemperatureControl: true,
          temperatureUnitForUX: 'C'
        },
        deviceInfo: {
          manufacturer: 'Sirius Cybernetics Corporation',
          model: '233451',
          hwVersion: '3.2',
          swVersion: '11.4'
        },
        customData: {
          fooValue: 74,
          barValue: true,
          bazValue: 'goatjive'
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
Java
@NotNull
@Override
@SmartHomeSnippetJson("smart-home-types-freezer_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.FREEZER")
            .addTrait("action.devices.traits.OnOff")
            .addTrait("action.devices.traits.Modes")
            .addTrait("action.devices.traits.Toggles")
            .addTrait("action.devices.traits.TemperatureControl")
            .setName(
                Collections.singletonList("Sirius Cybernetics Corporation Freezer"),
                "Freezer",
                Collections.singletonList("Kitchen Freezer"))
            .setWillReportState(true)
            .setAttributes(
                new JSONObject()
                    .put(
                        "availableToggles",
                        new JSONObject[] {
                          new JSONObject()
                              .put("name", "powerfreeze")
                              .put(
                                  "name_values",
                                  new JSONObject[] {
                                    new JSONObject()
                                        .put(
                                            "name_synonym",
                                            new String[] {"power freeze", "power"})
                                        .put("lang", "en")
                                  })
                        })
                    .put(
                        "availableModes",
                        new JSONObject[] {
                          new JSONObject()
                              .put("name", "currentmode")
                              .put(
                                  "name_values",
                                  new JSONObject[] {
                                    new JSONObject()
                                        .put(
                                            "name_synonym",
                                            new String[] {"current mode", "current", "mode"})
                                        .put("lang", "en")
                                  })
                              .put(
                                  "settings",
                                  new JSONObject[] {
                                    new JSONObject()
                                        .put("setting_name", "freeze")
                                        .put(
                                            "setting_values",
                                            new JSONObject[] {
                                              new JSONObject()
                                                  .put("setting_synonym", new String[] {"Freeze"})
                                                  .put("lang", "en")
                                            }),
                                    new JSONObject()
                                        .put("setting_name", "cool")
                                        .put(
                                            "setting_values",
                                            new JSONObject[] {
                                              new JSONObject()
                                                  .put("setting_synonym", new String[] {"Cool"})
                                                  .put("lang", "en")
                                            }),
                                    new JSONObject()
                                        .put("setting_name", "wine")
                                        .put(
                                            "setting_values",
                                            new JSONObject[] {
                                              new JSONObject()
                                                  .put("setting_synonym", new String[] {"Wine"})
                                                  .put("lang", "en")
                                            }),
                                    new JSONObject()
                                        .put("setting_name", "sabbath")
                                        .put(
                                            "setting_values",
                                            new JSONObject[] {
                                              new JSONObject()
                                                  .put(
                                                      "setting_synonym", new String[] {"Sabbath"})
                                                  .put("lang", "en")
                                            })
                                  })
                              .put("ordered", false)
                        })
                    .put("queryOnlyTemperatureControl", true)
                    .put("temperatureUnitForUX", "C"))
            .setDeviceInfo("Sirius Cybernetics Corporation", "233451", "3.2", "11.4")
            .setCustomData(
                new JSONObject()
                    .put("fooValue", 74)
                    .put("barValue", true)
                    .put("bazValue", "goatjive"))
            .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.FREEZER",
        "traits": [
          "action.devices.traits.OnOff",
          "action.devices.traits.Modes",
          "action.devices.traits.Toggles",
          "action.devices.traits.TemperatureControl"
        ],
        "name": {
          "defaultNames": [
            "Sirius Cybernetics Corporation Freezer"
          ],
          "name": "Freezer",
          "nicknames": [
            "Kitchen Freezer"
          ]
        },
        "willReportState": true,
        "attributes": {
          "availableToggles": [
            {
              "name": "powerfreeze",
              "name_values": [
                {
                  "name_synonym": [
                    "power freeze",
                    "power"
                  ],
                  "lang": "en"
                }
              ]
            }
          ],
          "availableModes": [
            {
              "name": "currentmode",
              "name_values": [
                {
                  "name_synonym": [
                    "current mode",
                    "current",
                    "mode"
                  ],
                  "lang": "en"
                }
              ],
              "settings": [
                {
                  "setting_name": "freeze",
                  "setting_values": [
                    {
                      "setting_synonym": [
                        "Freeze"
                      ],
                      "lang": "en"
                    }
                  ]
                },
                {
                  "setting_name": "cool",
                  "setting_values": [
                    {
                      "setting_synonym": [
                        "Cool"
                      ],
                      "lang": "en"
                    }
                  ]
                },
                {
                  "setting_name": "wine",
                  "setting_values": [
                    {
                      "setting_synonym": [
                        "Wine"
                      ],
                      "lang": "en"
                    }
                  ]
                },
                {
                  "setting_name": "sabbath",
                  "setting_values": [
                    {
                      "setting_synonym": [
                        "Sabbath"
                      ],
                      "lang": "en"
                    }
                  ]
                }
              ],
              "ordered": false
            }
          ],
          "queryOnlyTemperatureControl": true,
          "temperatureUnitForUX": "C"
        },
        "deviceInfo": {
          "manufacturer": "Sirius Cybernetics Corporation",
          "model": "233451",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        },
        "customData": {
          "fooValue": 74,
          "barValue": true,
          "bazValue": "goatjive"
        }
      }
    ]
  }
}
Validator

Device ERRORS

See the full list of errors and exceptions.