Smart Home Reboot Trait Schema

action.devices.traits.Reboot - This trait belongs to devices that support rebooting, such as routers. The device needs to support rebooting as a single action.

Device ATTRIBUTES

None.

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.LIGHT',
        traits: [
          'action.devices.traits.OnOff',
          'action.devices.traits.Reboot',
        ],
        name: {
          defaultNames: ['Sirius Cybernetics Light 2331'],
          name: 'Light',
          nicknames: ['Upstairs Light']
        },
        willReportState: true,
        deviceInfo: {
          manufacturer: 'Sirius Cybernetics',
          model: '2331B',
          hwVersion: '11.2',
          swVersion: '11.4'
        },
        customData: {
          fooValue: 2019,
          barValue: true,
          bazValue: 'goatjive'
        }
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
Java
@NotNull
@Override
public SyncResponse onSync(@NotNull SyncRequest syncRequest, @Nullable Map<?, ?> headers) {
  Payload payload = new Payload();
  payload.setAgentUserId("1836.15267389");
  payload.setDevices(new SyncResponse.Payload.Device[] {
      new SyncResponse.Payload.Device.Builder()
          .setId("123")
          .setType("action.devices.types.LIGHT")
          .addTrait("action.devices.traits.OnOff")
          .addTrait("action.devices.traits.Reboot")
          .setName(
              Collections.singletonList("Sirius Cybernetics Light 2331"),
              "Light",
              Collections.singletonList("Upstairs Light")
          )
          .setWillReportState(true)
          .setCustomData(new JSONObject()
              .put("fooValue", 2019)
              .put("barValue", true)
              .put("bazValue", "goattwirl")
              .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.LIGHT",
        "traits": [
          "action.devices.traits.OnOff",
          "action.devices.traits.Reboot"
        ],
        "name": {
          "defaultNames": [
            "Sirius Cybernetics Light 2331"
          ],
          "name": "Light",
          "nicknames": [
            "Upstairs Light"
          ]
        },
        "willReportState": true,
        "deviceInfo": {
          "manufacturer": "Sirius Cybernetics",
          "model": "2331B",
          "hwVersion": "11.2",
          "swVersion": "11.4"
        },
        "customData": {
          "fooValue": 2019,
          "barValue": true,
          "bazValue": "goatjive"
        }
      }
    ]
  }
}
Validator

Device STATES

None.

Device COMMANDS

Command Parameters/Definition
action.devices.commands.Reboot Reboots the device.

Sample EXECUTE Request and Response

User Reboot my router.
Google Assistant Rebooting the upstairs router.
Request
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "inputs": [{
    "intent": "action.devices.EXECUTE",
    "payload": {
      "commands": [{
        "devices": [{
          "id": "123",
          "customData": {
            "fooValue": 74,
            "barValue": true,
            "bazValue": "lambtwirl"
          }
        }],
        "execution": [{
          "command": "action.devices.commands.Reboot",
          "params": {
          }
        }]
      }]
    }
  }]
}
Node.js
'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: {}
      }]
    }
  };
});

// ...

exports.smarthome = functions.https.onRequest(app);
Java
@NotNull
@Override
public ExecuteResponse onExecute(@NotNull ExecuteRequest executeRequest, @Nullable Map<?, ?> map) {
  ExecuteResponse.Payload payload = new ExecuteResponse.Payload();

  payload.setCommands(new Commands[] {
      new Commands(
          new String[] {"123"},
          "SUCCESS",
          new HashMap<>(),
          null
      )
  });
  return new ExecuteResponse(executeRequest.getRequestId(), payload);
}
JSON
{
  "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
  "payload": {
    "commands": [
      {
        "ids": [
          "123"
        ],
        "status": "SUCCESS",
        "states": {}
      }
    ]
  }
}

Device ERRORS

See the full list of errors and exceptions.