HomeGraph API . devices

Instance Methods

close()

Close httplib2 connections.

query(body=None, x__xgafv=None)

Gets the current states in Home Graph for the given set of the third-party user's devices. The third-party user's identity is passed in via the `agent_user_id` (see QueryRequest). This request must be authorized using service account credentials from your Actions console project.

reportStateAndNotification(body=None, x__xgafv=None)

Reports device state and optionally sends device notifications. Called by your smart home Action when the state of a third-party device changes or you need to send a notification about the device. See [Implement Report State](https://developers.google.com/assistant/smarthome/develop/report-state) for more information. This method updates the device state according to its declared [traits](https://developers.google.com/assistant/smarthome/concepts/devices-traits). Publishing a new state value outside of these traits will result in an `INVALID_ARGUMENT` error response. The third-party user's identity is passed in via the `agent_user_id` (see ReportStateAndNotificationRequest). This request must be authorized using service account credentials from your Actions console project.

requestSync(body=None, x__xgafv=None)

Requests Google to send an `action.devices.SYNC` [intent](https://developers.google.com/assistant/smarthome/reference/intent/sync) to your smart home Action to update device metadata for the given user. The third-party user's identity is passed via the `agent_user_id` (see RequestSyncDevicesRequest). This request must be authorized using service account credentials from your Actions console project.

sync(body=None, x__xgafv=None)

Gets all the devices associated with the given third-party user. The third-party user's identity is passed in via the `agent_user_id` (see SyncRequest). This request must be authorized using service account credentials from your Actions console project.

Method Details

close()
Close httplib2 connections.
query(body=None, x__xgafv=None)
Gets the current states in Home Graph for the given set of the third-party user's devices. The third-party user's identity is passed in via the `agent_user_id` (see QueryRequest). This request must be authorized using service account credentials from your Actions console project.

Args:
  body: object, The request body.
    The object takes the form of:

{ # Request type for the [`Query`](#google.home.graph.v1.HomeGraphApiService.Query) call.
  "agentUserId": "A String", # Required. Third-party user ID.
  "inputs": [ # Required. Inputs containing third-party device IDs for which to get the device states.
    { # Device ID inputs to QueryRequest.
      "payload": { # Payload containing device IDs. # Payload containing third-party device IDs.
        "devices": [ # Third-party device IDs for which to get the device states.
          { # Third-party device ID for one device.
            "id": "A String", # Third-party device ID.
          },
        ],
      },
    },
  ],
  "requestId": "A String", # Request ID used for debugging.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response type for the [`Query`](#google.home.graph.v1.HomeGraphApiService.Query) call. This should follow the same format as the Google smart home `action.devices.QUERY` [response](https://developers.google.com/assistant/smarthome/reference/intent/query). # Example ```json { "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "devices": { "123": { "on": true, "online": true }, "456": { "on": true, "online": true, "brightness": 80, "color": { "name": "cerulean", "spectrumRGB": 31655 } } } } } ```
  "payload": { # Payload containing device states information. # Device states for the devices given in the request.
    "devices": { # States of the devices. Map of third-party device ID to struct of device states.
      "a_key": {
        "a_key": "", # Properties of the object.
      },
    },
  },
  "requestId": "A String", # Request ID used for debugging. Copied from the request.
}
reportStateAndNotification(body=None, x__xgafv=None)
Reports device state and optionally sends device notifications. Called by your smart home Action when the state of a third-party device changes or you need to send a notification about the device. See [Implement Report State](https://developers.google.com/assistant/smarthome/develop/report-state) for more information. This method updates the device state according to its declared [traits](https://developers.google.com/assistant/smarthome/concepts/devices-traits). Publishing a new state value outside of these traits will result in an `INVALID_ARGUMENT` error response. The third-party user's identity is passed in via the `agent_user_id` (see ReportStateAndNotificationRequest). This request must be authorized using service account credentials from your Actions console project.

Args:
  body: object, The request body.
    The object takes the form of:

{ # Request type for the [`ReportStateAndNotification`](#google.home.graph.v1.HomeGraphApiService.ReportStateAndNotification) call. It may include states, notifications, or both. States and notifications are defined per `device_id` (for example, "123" and "456" in the following example). # Example ```json { "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "agentUserId": "1234", "payload": { "devices": { "states": { "123": { "on": true }, "456": { "on": true, "brightness": 10 } }, } } } ```
  "agentUserId": "A String", # Required. Third-party user ID.
  "eventId": "A String", # Unique identifier per event (for example, a doorbell press).
  "followUpToken": "A String", # Deprecated.
  "payload": { # Payload containing the state and notification information for devices. # Required. State of devices to update and notification metadata for devices.
    "devices": { # The states and notifications specific to a device. # The devices for updating state and sending notifications.
      "notifications": { # Notifications metadata for devices. See the **Device NOTIFICATIONS** section of the individual trait [reference guides](https://developers.google.com/assistant/smarthome/traits).
        "a_key": "", # Properties of the object.
      },
      "states": { # States of devices to update. See the **Device STATES** section of the individual trait [reference guides](https://developers.google.com/assistant/smarthome/traits).
        "a_key": "", # Properties of the object.
      },
    },
  },
  "requestId": "A String", # Request ID used for debugging.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response type for the [`ReportStateAndNotification`](#google.home.graph.v1.HomeGraphApiService.ReportStateAndNotification) call.
  "requestId": "A String", # Request ID copied from ReportStateAndNotificationRequest.
}
requestSync(body=None, x__xgafv=None)
Requests Google to send an `action.devices.SYNC` [intent](https://developers.google.com/assistant/smarthome/reference/intent/sync) to your smart home Action to update device metadata for the given user. The third-party user's identity is passed via the `agent_user_id` (see RequestSyncDevicesRequest). This request must be authorized using service account credentials from your Actions console project.

Args:
  body: object, The request body.
    The object takes the form of:

{ # Request type for the [`RequestSyncDevices`](#google.home.graph.v1.HomeGraphApiService.RequestSyncDevices) call.
  "agentUserId": "A String", # Required. Third-party user ID.
  "async": True or False, # Optional. If set, the request will be added to a queue and a response will be returned immediately. This enables concurrent requests for the given `agent_user_id`, but the caller will not receive any error responses.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response type for the [`RequestSyncDevices`](#google.home.graph.v1.HomeGraphApiService.RequestSyncDevices) call. Intentionally empty upon success. An HTTP response code is returned with more details upon failure.
}
sync(body=None, x__xgafv=None)
Gets all the devices associated with the given third-party user. The third-party user's identity is passed in via the `agent_user_id` (see SyncRequest). This request must be authorized using service account credentials from your Actions console project.

Args:
  body: object, The request body.
    The object takes the form of:

{ # Request type for the [`Sync`](#google.home.graph.v1.HomeGraphApiService.Sync) call.
  "agentUserId": "A String", # Required. Third-party user ID.
  "requestId": "A String", # Request ID used for debugging.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response type for the [`Sync`](#google.home.graph.v1.HomeGraphApiService.Sync) call. This should follow the same format as the Google smart home `action.devices.SYNC` [response](https://developers.google.com/assistant/smarthome/reference/intent/sync). # Example ```json { "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "agentUserId": "1836.15267389", "devices": [{ "id": "123", "type": "action.devices.types.OUTLET", "traits": [ "action.devices.traits.OnOff" ], "name": { "defaultNames": ["My Outlet 1234"], "name": "Night light", "nicknames": ["wall plug"] }, "willReportState": false, "deviceInfo": { "manufacturer": "lights-out-inc", "model": "hs1234", "hwVersion": "3.2", "swVersion": "11.4" }, "customData": { "fooValue": 74, "barValue": true, "bazValue": "foo" } }] } } ```
  "payload": { # Payload containing device information. # Devices associated with the third-party user.
    "agentUserId": "A String", # Third-party user ID
    "devices": [ # Devices associated with the third-party user.
      { # Third-party device definition. Next ID = 14
        "attributes": { # Attributes for the traits supported by the device.
          "a_key": "", # Properties of the object.
        },
        "customData": { # Custom device attributes stored in Home Graph and provided to your smart home Action in each [QUERY](https://developers.google.com/assistant/smarthome/reference/intent/query) and [EXECUTE](https://developers.google.com/assistant/smarthome/reference/intent/execute) intent. Data in this object has a few constraints: No sensitive information, including but not limited to Personally Identifiable Information.
          "a_key": "", # Properties of the object.
        },
        "deviceInfo": { # Device information. # Device manufacturer, model, hardware version, and software version.
          "hwVersion": "A String", # Device hardware version.
          "manufacturer": "A String", # Device manufacturer.
          "model": "A String", # Device model.
          "swVersion": "A String", # Device software version.
        },
        "id": "A String", # Third-party device ID.
        "name": { # Identifiers used to describe the device. # Names given to this device by your smart home Action.
          "defaultNames": [ # List of names provided by the manufacturer rather than the user, such as serial numbers, SKUs, etc.
            "A String",
          ],
          "name": "A String", # Primary name of the device, generally provided by the user.
          "nicknames": [ # Additional names provided by the user for the device.
            "A String",
          ],
        },
        "notificationSupportedByAgent": True or False, # Indicates whether your smart home Action will report notifications to Google for this device via ReportStateAndNotification. If your smart home Action enables users to control device notifications, you should update this field and call RequestSyncDevices.
        "otherDeviceIds": [ # Alternate IDs associated with this device. This is used to identify cloud synced devices enabled for [local fulfillment](https://developers.google.com/assistant/smarthome/concepts/local).
          { # Alternate third-party device ID.
            "agentId": "A String", # Project ID for your smart home Action.
            "deviceId": "A String", # Unique third-party device ID.
          },
        ],
        "roomHint": "A String", # Suggested name for the room where this device is installed. Google attempts to use this value during user setup.
        "structureHint": "A String", # Suggested name for the structure where this device is installed. Google attempts to use this value during user setup.
        "traits": [ # Traits supported by the device. See [device traits](https://developers.google.com/assistant/smarthome/traits).
          "A String",
        ],
        "type": "A String", # Hardware type of the device. See [device types](https://developers.google.com/assistant/smarthome/guides).
        "willReportState": True or False, # Indicates whether your smart home Action will report state of this device to Google via ReportStateAndNotification.
      },
    ],
  },
  "requestId": "A String", # Request ID used for debugging. Copied from the request.
}