Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame^] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, 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 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, 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="#query">query(body=None, x__xgafv=None)</a></code></p> |
| 79 | <p class="firstline">Gets the current states in Home Graph for the given set of the third-party</p> |
| 80 | <p class="toc_element"> |
| 81 | <code><a href="#reportStateAndNotification">reportStateAndNotification(body=None, x__xgafv=None)</a></code></p> |
| 82 | <p class="firstline">Reports device state and optionally sends device notifications.</p> |
| 83 | <p class="toc_element"> |
| 84 | <code><a href="#requestSync">requestSync(body=None, x__xgafv=None)</a></code></p> |
| 85 | <p class="firstline">Requests Google to send an `action.devices.SYNC`</p> |
| 86 | <p class="toc_element"> |
| 87 | <code><a href="#sync">sync(body=None, x__xgafv=None)</a></code></p> |
| 88 | <p class="firstline">Gets all the devices associated with the given third-party user.</p> |
| 89 | <h3>Method Details</h3> |
| 90 | <div class="method"> |
| 91 | <code class="details" id="query">query(body=None, x__xgafv=None)</code> |
| 92 | <pre>Gets the current states in Home Graph for the given set of the third-party |
| 93 | user's devices. |
| 94 | |
| 95 | The third-party user's identity is passed in via the `agent_user_id` |
| 96 | (see QueryRequest). |
| 97 | This request must be authorized using service account credentials from your |
| 98 | Actions console project. |
| 99 | |
| 100 | Args: |
| 101 | body: object, The request body. |
| 102 | The object takes the form of: |
| 103 | |
| 104 | { # Request type for the |
| 105 | # [`Query`](#google.home.graph.v1.HomeGraphApiService.Query) call. |
| 106 | "inputs": [ # Required. Inputs containing third-party device IDs for which to |
| 107 | # get the device states. |
| 108 | { # Device ID inputs to QueryRequest. |
| 109 | "payload": { # Payload containing device IDs. # Payload containing third-party device IDs. |
| 110 | "devices": [ # Third-party device IDs for which to get the device states. |
| 111 | { # Third-party device ID for one device. |
| 112 | "id": "A String", # Third-party device ID. |
| 113 | }, |
| 114 | ], |
| 115 | }, |
| 116 | }, |
| 117 | ], |
| 118 | "agentUserId": "A String", # Required. Third-party user ID. |
| 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 | |
| 127 | Returns: |
| 128 | An object of the form: |
| 129 | |
| 130 | { # Response type for the |
| 131 | # [`Query`](#google.home.graph.v1.HomeGraphApiService.Query) call. |
| 132 | # This should follow the same format as the Google smart home |
| 133 | # `action.devices.QUERY` |
| 134 | # [response](https://developers.google.com/assistant/smarthome/reference/intent/query). |
| 135 | # # Example |
| 136 | # |
| 137 | # ```json |
| 138 | # { |
| 139 | # "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", |
| 140 | # "payload": { |
| 141 | # "devices": { |
| 142 | # "123": { |
| 143 | # "on": true, |
| 144 | # "online": true |
| 145 | # }, |
| 146 | # "456": { |
| 147 | # "on": true, |
| 148 | # "online": true, |
| 149 | # "brightness": 80, |
| 150 | # "color": { |
| 151 | # "name": "cerulean", |
| 152 | # "spectrumRGB": 31655 |
| 153 | # } |
| 154 | # } |
| 155 | # } |
| 156 | # } |
| 157 | # } |
| 158 | # ``` |
| 159 | "payload": { # Payload containing device states information. # Device states for the devices given in the request. |
| 160 | "devices": { # States of the devices. Map of third-party device ID to struct of device |
| 161 | # states. |
| 162 | "a_key": { |
| 163 | "a_key": "", # Properties of the object. |
| 164 | }, |
| 165 | }, |
| 166 | }, |
| 167 | "requestId": "A String", # Request ID used for debugging. Copied from the request. |
| 168 | }</pre> |
| 169 | </div> |
| 170 | |
| 171 | <div class="method"> |
| 172 | <code class="details" id="reportStateAndNotification">reportStateAndNotification(body=None, x__xgafv=None)</code> |
| 173 | <pre>Reports device state and optionally sends device notifications. |
| 174 | Called by your smart home Action when the state of a third-party device |
| 175 | changes or you need to send a notification about the device. |
| 176 | See [Implement Report |
| 177 | State](https://developers.google.com/assistant/smarthome/develop/report-state) |
| 178 | for more information. |
| 179 | |
| 180 | This method updates the device state according to its declared |
| 181 | [traits](https://developers.google.com/assistant/smarthome/concepts/devices-traits). |
| 182 | Publishing a new state value outside of these traits will result in an |
| 183 | `INVALID_ARGUMENT` error response. |
| 184 | |
| 185 | The third-party user's identity is passed in via the `agent_user_id` |
| 186 | (see ReportStateAndNotificationRequest). |
| 187 | This request must be authorized using service account credentials from your |
| 188 | Actions console project. |
| 189 | |
| 190 | Args: |
| 191 | body: object, The request body. |
| 192 | The object takes the form of: |
| 193 | |
| 194 | { # Request type for the |
| 195 | # [`ReportStateAndNotification`](#google.home.graph.v1.HomeGraphApiService.ReportStateAndNotification) |
| 196 | # call. It may include states, notifications, or both. States and notifications |
| 197 | # are defined per `device_id` (for example, "123" and "456" in the following |
| 198 | # example). |
| 199 | # # Example |
| 200 | # |
| 201 | # ```json |
| 202 | # { |
| 203 | # "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", |
| 204 | # "agentUserId": "1234", |
| 205 | # "payload": { |
| 206 | # "devices": { |
| 207 | # "states": { |
| 208 | # "123": { |
| 209 | # "on": true |
| 210 | # }, |
| 211 | # "456": { |
| 212 | # "on": true, |
| 213 | # "brightness": 10 |
| 214 | # } |
| 215 | # }, |
| 216 | # } |
| 217 | # } |
| 218 | # } |
| 219 | # ``` |
| 220 | "requestId": "A String", # Request ID used for debugging. |
| 221 | "eventId": "A String", # Unique identifier per event (for example, a doorbell press). |
| 222 | "payload": { # Payload containing the state and notification information for devices. # Required. State of devices to update and notification metadata for devices. |
| 223 | "devices": { # The states and notifications specific to a device. # The devices for updating state and sending notifications. |
| 224 | "notifications": { # Notifications metadata for devices. See the **Device NOTIFICATIONS** |
| 225 | # section of the individual trait [reference |
| 226 | # guides](https://developers.google.com/assistant/smarthome/traits). |
| 227 | "a_key": "", # Properties of the object. |
| 228 | }, |
| 229 | "states": { # States of devices to update. See the **Device STATES** section |
| 230 | # of the individual trait [reference |
| 231 | # guides](https://developers.google.com/assistant/smarthome/traits). |
| 232 | "a_key": "", # Properties of the object. |
| 233 | }, |
| 234 | }, |
| 235 | }, |
| 236 | "agentUserId": "A String", # Required. Third-party user ID. |
| 237 | "followUpToken": "A String", # Token to maintain state in the follow up notification response. |
| 238 | } |
| 239 | |
| 240 | x__xgafv: string, V1 error format. |
| 241 | Allowed values |
| 242 | 1 - v1 error format |
| 243 | 2 - v2 error format |
| 244 | |
| 245 | Returns: |
| 246 | An object of the form: |
| 247 | |
| 248 | { # Response type for the |
| 249 | # [`ReportStateAndNotification`](#google.home.graph.v1.HomeGraphApiService.ReportStateAndNotification) |
| 250 | # call. |
| 251 | "requestId": "A String", # Request ID copied from ReportStateAndNotificationRequest. |
| 252 | }</pre> |
| 253 | </div> |
| 254 | |
| 255 | <div class="method"> |
| 256 | <code class="details" id="requestSync">requestSync(body=None, x__xgafv=None)</code> |
| 257 | <pre>Requests Google to send an `action.devices.SYNC` |
| 258 | [intent](https://developers.google.com/assistant/smarthome/reference/intent/sync) |
| 259 | to your smart home Action to update device metadata for the given user. |
| 260 | |
| 261 | |
| 262 | The third-party user's identity is passed via the `agent_user_id` |
| 263 | (see RequestSyncDevicesRequest). |
| 264 | This request must be authorized using service account credentials from your |
| 265 | Actions console project. |
| 266 | |
| 267 | Args: |
| 268 | body: object, The request body. |
| 269 | The object takes the form of: |
| 270 | |
| 271 | { # Request type for the |
| 272 | # [`RequestSyncDevices`](#google.home.graph.v1.HomeGraphApiService.RequestSyncDevices) |
| 273 | # call. |
| 274 | "agentUserId": "A String", # Required. Third-party user ID. |
| 275 | "async": True or False, # Optional. If set, the request will be added to a queue and a response will |
| 276 | # be returned immediately. This enables concurrent requests for the given |
| 277 | # `agent_user_id`, but the caller will not receive any error responses. |
| 278 | } |
| 279 | |
| 280 | x__xgafv: string, V1 error format. |
| 281 | Allowed values |
| 282 | 1 - v1 error format |
| 283 | 2 - v2 error format |
| 284 | |
| 285 | Returns: |
| 286 | An object of the form: |
| 287 | |
| 288 | { # Response type for the |
| 289 | # [`RequestSyncDevices`](#google.home.graph.v1.HomeGraphApiService.RequestSyncDevices) |
| 290 | # call. |
| 291 | # |
| 292 | # Intentionally empty upon success. An HTTP response code is returned |
| 293 | # with more details upon failure. |
| 294 | }</pre> |
| 295 | </div> |
| 296 | |
| 297 | <div class="method"> |
| 298 | <code class="details" id="sync">sync(body=None, x__xgafv=None)</code> |
| 299 | <pre>Gets all the devices associated with the given third-party user. |
| 300 | |
| 301 | The third-party user's identity is passed in via the `agent_user_id` |
| 302 | (see SyncRequest). |
| 303 | This request must be authorized using service account credentials from your |
| 304 | Actions console project. |
| 305 | |
| 306 | Args: |
| 307 | body: object, The request body. |
| 308 | The object takes the form of: |
| 309 | |
| 310 | { # Request type for the [`Sync`](#google.home.graph.v1.HomeGraphApiService.Sync) |
| 311 | # call. |
| 312 | "requestId": "A String", # Request ID used for debugging. |
| 313 | "agentUserId": "A String", # Required. Third-party user ID. |
| 314 | } |
| 315 | |
| 316 | x__xgafv: string, V1 error format. |
| 317 | Allowed values |
| 318 | 1 - v1 error format |
| 319 | 2 - v2 error format |
| 320 | |
| 321 | Returns: |
| 322 | An object of the form: |
| 323 | |
| 324 | { # Response type for the |
| 325 | # [`Sync`](#google.home.graph.v1.HomeGraphApiService.Sync) call. |
| 326 | # This should follow the same format as the Google smart home |
| 327 | # `action.devices.SYNC` |
| 328 | # [response](https://developers.google.com/assistant/smarthome/reference/intent/sync). |
| 329 | # # Example |
| 330 | # |
| 331 | # ```json |
| 332 | # { |
| 333 | # "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", |
| 334 | # "payload": { |
| 335 | # "agentUserId": "1836.15267389", |
| 336 | # "devices": [{ |
| 337 | # "id": "123", |
| 338 | # "type": "action.devices.types.OUTLET", |
| 339 | # "traits": [ |
| 340 | # "action.devices.traits.OnOff" |
| 341 | # ], |
| 342 | # "name": { |
| 343 | # "defaultNames": ["My Outlet 1234"], |
| 344 | # "name": "Night light", |
| 345 | # "nicknames": ["wall plug"] |
| 346 | # }, |
| 347 | # "willReportState": false, |
| 348 | # "deviceInfo": { |
| 349 | # "manufacturer": "lights-out-inc", |
| 350 | # "model": "hs1234", |
| 351 | # "hwVersion": "3.2", |
| 352 | # "swVersion": "11.4" |
| 353 | # }, |
| 354 | # "customData": { |
| 355 | # "fooValue": 74, |
| 356 | # "barValue": true, |
| 357 | # "bazValue": "foo" |
| 358 | # } |
| 359 | # }] |
| 360 | # } |
| 361 | # } |
| 362 | # ``` |
| 363 | "payload": { # Payload containing device information. # Devices associated with the third-party user. |
| 364 | "devices": [ # Devices associated with the third-party user. |
| 365 | { # Third-party device definition. |
| 366 | "deviceInfo": { # Device information. # Device manufacturer, model, hardware version, and software version. |
| 367 | "hwVersion": "A String", # Device hardware version. |
| 368 | "swVersion": "A String", # Device software version. |
| 369 | "model": "A String", # Device model. |
| 370 | "manufacturer": "A String", # Device manufacturer. |
| 371 | }, |
| 372 | "roomHint": "A String", # Suggested name for the room where this device is installed. |
| 373 | # Google attempts to use this value during user setup. |
| 374 | "customData": { # Custom device attributes stored in Home Graph and provided to your |
| 375 | # smart home Action in each |
| 376 | # [QUERY](https://developers.google.com/assistant/smarthome/reference/intent/query) |
| 377 | # and |
| 378 | # [EXECUTE](https://developers.google.com/assistant/smarthome/reference/intent/execute) |
| 379 | # intent. |
| 380 | "a_key": "", # Properties of the object. |
| 381 | }, |
| 382 | "traits": [ # Traits supported by the device. |
| 383 | # See [device |
| 384 | # traits](https://developers.google.com/assistant/smarthome/traits). |
| 385 | "A String", |
| 386 | ], |
| 387 | "structureHint": "A String", # Suggested name for the structure where this device is installed. |
| 388 | # Google attempts to use this value during user setup. |
| 389 | "willReportState": True or False, # Indicates whether your smart home Action will report state of this device |
| 390 | # to Google via |
| 391 | # ReportStateAndNotification. |
| 392 | "id": "A String", # Third-party device ID. |
| 393 | "otherDeviceIds": [ # Alternate IDs associated with this device. |
| 394 | # This is used to identify cloud synced devices enabled for [local |
| 395 | # fulfillment](https://developers.google.com/assistant/smarthome/concepts/local). |
| 396 | { # Alternate third-party device ID. |
| 397 | "deviceId": "A String", # Unique third-party device ID. |
| 398 | "agentId": "A String", # Project ID for your smart home Action. |
| 399 | }, |
| 400 | ], |
| 401 | "name": { # Identifiers used to describe the device. # Names given to this device by your smart home Action. |
| 402 | "name": "A String", # Primary name of the device, generally provided by the user. |
| 403 | "nicknames": [ # Additional names provided by the user for the device. |
| 404 | "A String", |
| 405 | ], |
| 406 | "defaultNames": [ # List of names provided by the manufacturer rather than the user, such as |
| 407 | # serial numbers, SKUs, etc. |
| 408 | "A String", |
| 409 | ], |
| 410 | }, |
| 411 | "type": "A String", # Hardware type of the device. |
| 412 | # See [device |
| 413 | # types](https://developers.google.com/assistant/smarthome/guides). |
| 414 | "attributes": { # Attributes for the traits supported by the device. |
| 415 | "a_key": "", # Properties of the object. |
| 416 | }, |
| 417 | "notificationSupportedByAgent": True or False, # Indicates whether your smart home Action will report notifications |
| 418 | # to Google for this device via |
| 419 | # ReportStateAndNotification. |
| 420 | # |
| 421 | # If your smart home Action enables users to control device notifications, |
| 422 | # you should update this field and call |
| 423 | # RequestSyncDevices. |
| 424 | }, |
| 425 | ], |
| 426 | "agentUserId": "A String", # Third-party user ID |
| 427 | }, |
| 428 | "requestId": "A String", # Request ID used for debugging. Copied from the request. |
| 429 | }</pre> |
| 430 | </div> |
| 431 | |
| 432 | </body></html> |