Smart Home (Clothes) Washer Guide

Device TYPE

action.devices.types.WASHER This type indicates that the device gets the washer icon and some washer-type synonyms/aliases.

Washers can have start and stop functionality independent from being on or off (some washers have separate power buttons, and some do not). Some can be paused and resumed while washing.

Washers also have various modes and each mode has its own related settings. These are specific to the washer and are interpreted in a generalized form.

The Assistant is currently not capable of folding laundry.

To see an example on how to control a washing machine with Google smart home, see the smart home washer codelab.

These are our recommendations for traits on this type of device, however you are free to mix and match from all available traits to best match your existing product functionality.

Please see each individual trait document for implementation details like required attributes, EXECUTE and QUERY.

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.WASHER',
        traits: [
          'action.devices.traits.StartStop',
          'action.devices.traits.Modes',
          'action.devices.traits.RunCycle'
        ],
        name: {
          defaultNames: ['AAA Cybernetics Corporation Washer 3421'],
          name: 'Washer',
          nicknames: ['clothes washer']
        },
        willReportState: false,
        attributes: {
          pausable: true,
          availableModes: [{
            name: 'load',
            name_values: [{
              name_synonym: ['load', 'size', 'load size'],
              lang: 'en'
            }],
            settings: [{
              setting_name: 'small',
              setting_values: [{
                setting_synonym: ['small', 'half'],
                lang: 'en'
              }]
            }, {
              setting_name: 'large',
              setting_values: [{
                setting_synonym: ['large', 'full'],
                lang: 'en'
              }]
            }],
            ordered: true
          }],
          availableToggles: [{
            name: 'Child Lock',
            name_values: [{
              name_synonym: ['child lock'],
              lang: 'en'
            }]
          }, {
            name: 'Turbo',
            name_values: [{
              name_synonym: ['Turbo', 'turbo'],
              lang: 'en'
            }]
          }]
        },
        deviceInfo: {
          manufacturer: 'AAA Cybernetics Corporation',
          model: '233451',
          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.WASHER")
          .addTrait("action.devices.traits.StartStop")
          .addTrait("action.devices.traits.Modes")
          .addTrait("action.devices.traits.Toggles")
          .addTrait("action.devices.traits.RunCycle")
          .setName(
              Collections.singletonList("AAA Cybernetics Corp Washer 3421"),
              "Washer",
              Collections.singletonList("clothes washer")
          )
          .setWillReportState(true)
          .setAttributes(new JSONObject()
              .put("pausable", true)
              .put("availableModes", new JSONObject[] {
                  new JSONObject()
                      .put("name", "load")
                      .put("name_values", new JSONObject[] {
                          new JSONObject()
                              .put("name_synonym", new String[] {"load", "size", "load size"})
                              .put("lang", "en")
                      })
                      .put("settings", new JSONObject[] {
                          new JSONObject()
                              .put("setting_name", "small")
                              .put("setting_values", new JSONObject[] {
                                  new JSONObject()
                                      .put("setting_synonym", new String[] {"small", "half"})
                                      .put("lang", "en")
                              }),
                          new JSONObject()
                              .put("setting_name", "large")
                              .put("setting_values", new JSONObject[] {
                                  new JSONObject()
                                      .put("setting_synonym", new String[] {"large", "full"})
                                      .put("lang", "en")
                              })
                      })
                      .put("ordered", true)
              })
              .put("availableToggles", new JSONObject[] {
                  new JSONObject()
                      .put("name", "Child Lock")
                      .put("name_values", new JSONObject[] {
                      new JSONObject()
                          .put("name_synonym", new String[] {"child lock"})
                          .put("lang", "en"),
                  }),
                  new JSONObject()
                      .put("name", "Turbo")
                      .put("name_values", new JSONObject[] {
                      new JSONObject()
                          .put("name_synonym", new String[] {"Turbo", "turbo"})
                          .put("lang", "en"),
                  })
              })
          )
          .setDeviceInfo("AAA Cybernetics Corporation", "233451", "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.WASHER",
        "traits": [
          "action.devices.traits.StartStop",
          "action.devices.traits.Modes",
          "action.devices.traits.RunCycle"
        ],
        "name": {
          "defaultNames": [
            "AAA Cybernetics Corporation Washer 3421"
          ],
          "name": "Washer",
          "nicknames": [
            "clothes washer"
          ]
        },
        "willReportState": false,
        "attributes": {
          "pausable": true,
          "availableModes": [
            {
              "name": "load",
              "name_values": [
                {
                  "name_synonym": [
                    "load",
                    "size",
                    "load size"
                  ],
                  "lang": "en"
                }
              ],
              "settings": [
                {
                  "setting_name": "small",
                  "setting_values": [
                    {
                      "setting_synonym": [
                        "small",
                        "half"
                      ],
                      "lang": "en"
                    }
                  ]
                },
                {
                  "setting_name": "large",
                  "setting_values": [
                    {
                      "setting_synonym": [
                        "large",
                        "full"
                      ],
                      "lang": "en"
                    }
                  ]
                }
              ],
              "ordered": true
            }
          ],
          "availableToggles": [
            {
              "name": "Child Lock",
              "name_values": [
                {
                  "name_synonym": [
                    "child lock"
                  ],
                  "lang": "en"
                }
              ]
            },
            {
              "name": "Turbo",
              "name_values": [
                {
                  "name_synonym": [
                    "Turbo",
                    "turbo"
                  ],
                  "lang": "en"
                }
              ]
            }
          ]
        },
        "deviceInfo": {
          "manufacturer": "AAA Cybernetics Corporation",
          "model": "233451",
          "hwVersion": "3.2",
          "swVersion": "11.4"
        },
        "customData": {
          "fooValue": 74,
          "barValue": true,
          "bazValue": "lambtwirl"
        }
      }
    ]
  }
}
Validator

Device ERRORS

See the full list of errors and exceptions.