简体   繁体   English

如何通过智能家居应用的实时Feed报告设备上的状态更改?

[英]How to report state changes on devices over real-time feed for Smart Home apps?

Documentation for SYNC intent mentions that if willReportState property of a device is true , the device will report its state through Real Time Feed. SYNC意图的文档提到如果设备的willReportState属性为true ,则设备将通过Real Time Feed报告其状态。

How do I write state updates to the Real Time Feed? 如何将状态更新写入实时源? I can't find any documentation on it. 我找不到任何文件。

The documentation to do it is available. 可以使用相关文档

First you'll need to enable the HomeGraph API and obtain an API key. 首先,您需要启用HomeGraph API并获取API密钥。 Then you should send a POST request to https://homegraph.googleapis.com/v1/devices:reportStateAndNotification with a JWT and the following payload: 然后,您应该使用JWT和以下有效负载向https://homegraph.googleapis.com/v1/devices:reportStateAndNotification发送POST请求:

{
 "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
 "agent_user_id": "1234",
 "payload": {
    "devices": {
      "states": {
        "1458765": {
          "on": true
        },
        "4578964": {
          "on": true,
          "isLocked": true
        }
      }
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM