1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="homegraph_v1.html">HomeGraph API</a> . <a href="homegraph_v1.devices.html">devices</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#close">close()</a></code></p> 79<p class="firstline">Close httplib2 connections.</p> 80<p class="toc_element"> 81 <code><a href="#query">query(body=None, x__xgafv=None)</a></code></p> 82<p class="firstline">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.</p> 83<p class="toc_element"> 84 <code><a href="#reportStateAndNotification">reportStateAndNotification(body=None, x__xgafv=None)</a></code></p> 85<p class="firstline">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.</p> 86<p class="toc_element"> 87 <code><a href="#requestSync">requestSync(body=None, x__xgafv=None)</a></code></p> 88<p class="firstline">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.</p> 89<p class="toc_element"> 90 <code><a href="#sync">sync(body=None, x__xgafv=None)</a></code></p> 91<p class="firstline">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.</p> 92<h3>Method Details</h3> 93<div class="method"> 94 <code class="details" id="close">close()</code> 95 <pre>Close httplib2 connections.</pre> 96</div> 97 98<div class="method"> 99 <code class="details" id="query">query(body=None, x__xgafv=None)</code> 100 <pre>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. 101 102Args: 103 body: object, The request body. 104 The object takes the form of: 105 106{ # Request type for the [`Query`](#google.home.graph.v1.HomeGraphApiService.Query) call. 107 "agentUserId": "A String", # Required. Third-party user ID. 108 "inputs": [ # Required. Inputs containing third-party device IDs for which to get the device states. 109 { # Device ID inputs to QueryRequest. 110 "payload": { # Payload containing device IDs. # Payload containing third-party device IDs. 111 "devices": [ # Third-party device IDs for which to get the device states. 112 { # Third-party device ID for one device. 113 "id": "A String", # Third-party device ID. 114 }, 115 ], 116 }, 117 }, 118 ], 119 "requestId": "A String", # Request ID used for debugging. 120} 121 122 x__xgafv: string, V1 error format. 123 Allowed values 124 1 - v1 error format 125 2 - v2 error format 126 127Returns: 128 An object of the form: 129 130 { # 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 } } } } } ``` 131 "payload": { # Payload containing device states information. # Device states for the devices given in the request. 132 "devices": { # States of the devices. Map of third-party device ID to struct of device states. 133 "a_key": { 134 "a_key": "", # Properties of the object. 135 }, 136 }, 137 }, 138 "requestId": "A String", # Request ID used for debugging. Copied from the request. 139}</pre> 140</div> 141 142<div class="method"> 143 <code class="details" id="reportStateAndNotification">reportStateAndNotification(body=None, x__xgafv=None)</code> 144 <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'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. 145 146Args: 147 body: object, The request body. 148 The object takes the form of: 149 150{ # 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 } }, } } } ``` 151 "agentUserId": "A String", # Required. Third-party user ID. 152 "eventId": "A String", # Unique identifier per event (for example, a doorbell press). 153 "followUpToken": "A String", # Deprecated. 154 "payload": { # Payload containing the state and notification information for devices. # Required. State of devices to update and notification metadata for devices. 155 "devices": { # The states and notifications specific to a device. # The devices for updating state and sending notifications. 156 "notifications": { # Notifications metadata for devices. See the **Device NOTIFICATIONS** section of the individual trait [reference guides](https://developers.google.com/assistant/smarthome/traits). 157 "a_key": "", # Properties of the object. 158 }, 159 "states": { # States of devices to update. See the **Device STATES** section of the individual trait [reference guides](https://developers.google.com/assistant/smarthome/traits). 160 "a_key": "", # Properties of the object. 161 }, 162 }, 163 }, 164 "requestId": "A String", # Request ID used for debugging. 165} 166 167 x__xgafv: string, V1 error format. 168 Allowed values 169 1 - v1 error format 170 2 - v2 error format 171 172Returns: 173 An object of the form: 174 175 { # Response type for the [`ReportStateAndNotification`](#google.home.graph.v1.HomeGraphApiService.ReportStateAndNotification) call. 176 "requestId": "A String", # Request ID copied from ReportStateAndNotificationRequest. 177}</pre> 178</div> 179 180<div class="method"> 181 <code class="details" id="requestSync">requestSync(body=None, x__xgafv=None)</code> 182 <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'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. 183 184Args: 185 body: object, The request body. 186 The object takes the form of: 187 188{ # Request type for the [`RequestSyncDevices`](#google.home.graph.v1.HomeGraphApiService.RequestSyncDevices) call. 189 "agentUserId": "A String", # Required. Third-party user ID. 190 "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. 191} 192 193 x__xgafv: string, V1 error format. 194 Allowed values 195 1 - v1 error format 196 2 - v2 error format 197 198Returns: 199 An object of the form: 200 201 { # 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. 202}</pre> 203</div> 204 205<div class="method"> 206 <code class="details" id="sync">sync(body=None, x__xgafv=None)</code> 207 <pre>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. 208 209Args: 210 body: object, The request body. 211 The object takes the form of: 212 213{ # Request type for the [`Sync`](#google.home.graph.v1.HomeGraphApiService.Sync) call. 214 "agentUserId": "A String", # Required. Third-party user ID. 215 "requestId": "A String", # Request ID used for debugging. 216} 217 218 x__xgafv: string, V1 error format. 219 Allowed values 220 1 - v1 error format 221 2 - v2 error format 222 223Returns: 224 An object of the form: 225 226 { # 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" } }] } } ``` 227 "payload": { # Payload containing device information. # Devices associated with the third-party user. 228 "agentUserId": "A String", # Third-party user ID 229 "devices": [ # Devices associated with the third-party user. 230 { # Third-party device definition. Next ID = 14 231 "attributes": { # Attributes for the traits supported by the device. 232 "a_key": "", # Properties of the object. 233 }, 234 "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. 235 "a_key": "", # Properties of the object. 236 }, 237 "deviceInfo": { # Device information. # Device manufacturer, model, hardware version, and software version. 238 "hwVersion": "A String", # Device hardware version. 239 "manufacturer": "A String", # Device manufacturer. 240 "model": "A String", # Device model. 241 "swVersion": "A String", # Device software version. 242 }, 243 "id": "A String", # Third-party device ID. 244 "name": { # Identifiers used to describe the device. # Names given to this device by your smart home Action. 245 "defaultNames": [ # List of names provided by the manufacturer rather than the user, such as serial numbers, SKUs, etc. 246 "A String", 247 ], 248 "name": "A String", # Primary name of the device, generally provided by the user. 249 "nicknames": [ # Additional names provided by the user for the device. 250 "A String", 251 ], 252 }, 253 "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. 254 "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). 255 { # Alternate third-party device ID. 256 "agentId": "A String", # Project ID for your smart home Action. 257 "deviceId": "A String", # Unique third-party device ID. 258 }, 259 ], 260 "roomHint": "A String", # Suggested name for the room where this device is installed. Google attempts to use this value during user setup. 261 "structureHint": "A String", # Suggested name for the structure where this device is installed. Google attempts to use this value during user setup. 262 "traits": [ # Traits supported by the device. See [device traits](https://developers.google.com/assistant/smarthome/traits). 263 "A String", 264 ], 265 "type": "A String", # Hardware type of the device. See [device types](https://developers.google.com/assistant/smarthome/guides). 266 "willReportState": True or False, # Indicates whether your smart home Action will report state of this device to Google via ReportStateAndNotification. 267 }, 268 ], 269 }, 270 "requestId": "A String", # Request ID used for debugging. Copied from the request. 271}</pre> 272</div> 273 274</body></html>