MrBink
MrBink

Reputation: 740

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.

How do I write state updates to the Real Time Feed? I can't find any documentation on it.

Upvotes: 4

Views: 890

Answers (1)

Nick Felker
Nick Felker

Reputation: 11978

The documentation to do it is available.

First you'll need to enable the HomeGraph API and obtain an API key. Then you should send a POST request to https://homegraph.googleapis.com/v1/devices:reportStateAndNotification with a JWT and the following payload:

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

Upvotes: 3

Related Questions