blob: 7f9f6a64cc7053cec1d06dd6706a2441f261c306 [file] [log] [blame]
<html><body>
<style>
body, h1, h2, h3, div, span, p, pre, a {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
font-size: 13px;
padding: 1em;
}
h1 {
font-size: 26px;
margin-bottom: 1em;
}
h2 {
font-size: 24px;
margin-bottom: 1em;
}
h3 {
font-size: 20px;
margin-bottom: 1em;
margin-top: 1em;
}
pre, code {
line-height: 1.5;
font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}
pre {
margin-top: 0.5em;
}
h1, h2, h3, p {
font-family: Arial, sans serif;
}
h1, h2, h3 {
border-bottom: solid #CCC 1px;
}
.toc_element {
margin-top: 0.5em;
}
.firstline {
margin-left: 2 em;
}
.method {
margin-top: 1em;
border: solid 1px #CCC;
padding: 1em;
background: #EEE;
}
.details {
font-weight: bold;
font-size: 14px;
}
</style>
<h1><a href="homegraph_v1.html">HomeGraph API</a> . <a href="homegraph_v1.devices.html">devices</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
<code><a href="#query">query(body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Gets the current states in Home Graph for the given set of the third-party</p>
<p class="toc_element">
<code><a href="#reportStateAndNotification">reportStateAndNotification(body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Reports device state and optionally sends device notifications.</p>
<p class="toc_element">
<code><a href="#requestSync">requestSync(body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Requests Google to send an `action.devices.SYNC`</p>
<p class="toc_element">
<code><a href="#sync">sync(body=None, x__xgafv=None)</a></code></p>
<p class="firstline">Gets all the devices associated with the given third-party user.</p>
<h3>Method Details</h3>
<div class="method">
<code class="details" id="query">query(body=None, x__xgafv=None)</code>
<pre>Gets the current states in Home Graph for the given set of the third-party
user&#x27;s devices.
The third-party user&#x27;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.
&quot;requestId&quot;: &quot;A String&quot;, # Request ID used for debugging.
&quot;agentUserId&quot;: &quot;A String&quot;, # Required. Third-party user ID.
&quot;inputs&quot;: [ # Required. Inputs containing third-party device IDs for which to
# get the device states.
{ # Device ID inputs to QueryRequest.
&quot;payload&quot;: { # Payload containing device IDs. # Payload containing third-party device IDs.
&quot;devices&quot;: [ # Third-party device IDs for which to get the device states.
{ # Third-party device ID for one device.
&quot;id&quot;: &quot;A String&quot;, # Third-party device ID.
},
],
},
},
],
}
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
# {
# &quot;requestId&quot;: &quot;ff36a3cc-ec34-11e6-b1a0-64510650abcf&quot;,
# &quot;payload&quot;: {
# &quot;devices&quot;: {
# &quot;123&quot;: {
# &quot;on&quot;: true,
# &quot;online&quot;: true
# },
# &quot;456&quot;: {
# &quot;on&quot;: true,
# &quot;online&quot;: true,
# &quot;brightness&quot;: 80,
# &quot;color&quot;: {
# &quot;name&quot;: &quot;cerulean&quot;,
# &quot;spectrumRGB&quot;: 31655
# }
# }
# }
# }
# }
# ```
&quot;requestId&quot;: &quot;A String&quot;, # Request ID used for debugging. Copied from the request.
&quot;payload&quot;: { # Payload containing device states information. # Device states for the devices given in the request.
&quot;devices&quot;: { # States of the devices. Map of third-party device ID to struct of device
# states.
&quot;a_key&quot;: {
&quot;a_key&quot;: &quot;&quot;, # Properties of the object.
},
},
},
}</pre>
</div>
<div class="method">
<code class="details" id="reportStateAndNotification">reportStateAndNotification(body=None, x__xgafv=None)</code>
<pre>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&#x27;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, &quot;123&quot; and &quot;456&quot; in the following
# example).
# # Example
#
# ```json
# {
# &quot;requestId&quot;: &quot;ff36a3cc-ec34-11e6-b1a0-64510650abcf&quot;,
# &quot;agentUserId&quot;: &quot;1234&quot;,
# &quot;payload&quot;: {
# &quot;devices&quot;: {
# &quot;states&quot;: {
# &quot;123&quot;: {
# &quot;on&quot;: true
# },
# &quot;456&quot;: {
# &quot;on&quot;: true,
# &quot;brightness&quot;: 10
# }
# },
# }
# }
# }
# ```
&quot;agentUserId&quot;: &quot;A String&quot;, # Required. Third-party user ID.
&quot;payload&quot;: { # Payload containing the state and notification information for devices. # Required. State of devices to update and notification metadata for devices.
&quot;devices&quot;: { # The states and notifications specific to a device. # The devices for updating state and sending notifications.
&quot;states&quot;: { # States of devices to update. See the **Device STATES** section
# of the individual trait [reference
# guides](https://developers.google.com/assistant/smarthome/traits).
&quot;a_key&quot;: &quot;&quot;, # Properties of the object.
},
&quot;notifications&quot;: { # Notifications metadata for devices. See the **Device NOTIFICATIONS**
# section of the individual trait [reference
# guides](https://developers.google.com/assistant/smarthome/traits).
&quot;a_key&quot;: &quot;&quot;, # Properties of the object.
},
},
},
&quot;requestId&quot;: &quot;A String&quot;, # Request ID used for debugging.
&quot;followUpToken&quot;: &quot;A String&quot;, # Token to maintain state in the follow up notification response.
# Deprecated. See the [notifications
# guide](https://developers.google.com/assistant/smarthome/develop/notifications)
# for details on implementing follow up notifications.
&quot;eventId&quot;: &quot;A String&quot;, # Unique identifier per event (for example, a doorbell press).
}
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.
&quot;requestId&quot;: &quot;A String&quot;, # Request ID copied from ReportStateAndNotificationRequest.
}</pre>
</div>
<div class="method">
<code class="details" id="requestSync">requestSync(body=None, x__xgafv=None)</code>
<pre>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&#x27;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.
&quot;async&quot;: 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.
&quot;agentUserId&quot;: &quot;A String&quot;, # Required. Third-party user ID.
}
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.
}</pre>
</div>
<div class="method">
<code class="details" id="sync">sync(body=None, x__xgafv=None)</code>
<pre>Gets all the devices associated with the given third-party user.
The third-party user&#x27;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.
&quot;agentUserId&quot;: &quot;A String&quot;, # Required. Third-party user ID.
&quot;requestId&quot;: &quot;A String&quot;, # 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
# {
# &quot;requestId&quot;: &quot;ff36a3cc-ec34-11e6-b1a0-64510650abcf&quot;,
# &quot;payload&quot;: {
# &quot;agentUserId&quot;: &quot;1836.15267389&quot;,
# &quot;devices&quot;: [{
# &quot;id&quot;: &quot;123&quot;,
# &quot;type&quot;: &quot;action.devices.types.OUTLET&quot;,
# &quot;traits&quot;: [
# &quot;action.devices.traits.OnOff&quot;
# ],
# &quot;name&quot;: {
# &quot;defaultNames&quot;: [&quot;My Outlet 1234&quot;],
# &quot;name&quot;: &quot;Night light&quot;,
# &quot;nicknames&quot;: [&quot;wall plug&quot;]
# },
# &quot;willReportState&quot;: false,
# &quot;deviceInfo&quot;: {
# &quot;manufacturer&quot;: &quot;lights-out-inc&quot;,
# &quot;model&quot;: &quot;hs1234&quot;,
# &quot;hwVersion&quot;: &quot;3.2&quot;,
# &quot;swVersion&quot;: &quot;11.4&quot;
# },
# &quot;customData&quot;: {
# &quot;fooValue&quot;: 74,
# &quot;barValue&quot;: true,
# &quot;bazValue&quot;: &quot;foo&quot;
# }
# }]
# }
# }
# ```
&quot;payload&quot;: { # Payload containing device information. # Devices associated with the third-party user.
&quot;devices&quot;: [ # Devices associated with the third-party user.
{ # Third-party device definition.
&quot;structureHint&quot;: &quot;A String&quot;, # Suggested name for the structure where this device is installed.
# Google attempts to use this value during user setup.
&quot;name&quot;: { # Identifiers used to describe the device. # Names given to this device by your smart home Action.
&quot;defaultNames&quot;: [ # List of names provided by the manufacturer rather than the user, such as
# serial numbers, SKUs, etc.
&quot;A String&quot;,
],
&quot;nicknames&quot;: [ # Additional names provided by the user for the device.
&quot;A String&quot;,
],
&quot;name&quot;: &quot;A String&quot;, # Primary name of the device, generally provided by the user.
},
&quot;notificationSupportedByAgent&quot;: 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.
&quot;otherDeviceIds&quot;: [ # 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.
&quot;agentId&quot;: &quot;A String&quot;, # Project ID for your smart home Action.
&quot;deviceId&quot;: &quot;A String&quot;, # Unique third-party device ID.
},
],
&quot;type&quot;: &quot;A String&quot;, # Hardware type of the device.
# See [device
# types](https://developers.google.com/assistant/smarthome/guides).
&quot;attributes&quot;: { # Attributes for the traits supported by the device.
&quot;a_key&quot;: &quot;&quot;, # Properties of the object.
},
&quot;roomHint&quot;: &quot;A String&quot;, # Suggested name for the room where this device is installed.
# Google attempts to use this value during user setup.
&quot;id&quot;: &quot;A String&quot;, # Third-party device ID.
&quot;deviceInfo&quot;: { # Device information. # Device manufacturer, model, hardware version, and software version.
&quot;hwVersion&quot;: &quot;A String&quot;, # Device hardware version.
&quot;swVersion&quot;: &quot;A String&quot;, # Device software version.
&quot;manufacturer&quot;: &quot;A String&quot;, # Device manufacturer.
&quot;model&quot;: &quot;A String&quot;, # Device model.
},
&quot;willReportState&quot;: True or False, # Indicates whether your smart home Action will report state of this device
# to Google via
# ReportStateAndNotification.
&quot;customData&quot;: { # 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.
&quot;a_key&quot;: &quot;&quot;, # Properties of the object.
},
&quot;traits&quot;: [ # Traits supported by the device.
# See [device
# traits](https://developers.google.com/assistant/smarthome/traits).
&quot;A String&quot;,
],
},
],
&quot;agentUserId&quot;: &quot;A String&quot;, # Third-party user ID
},
&quot;requestId&quot;: &quot;A String&quot;, # Request ID used for debugging. Copied from the request.
}</pre>
</div>
</body></html>