3

I'm implementing a media remote device with OnOff and Volume traits. Report state payload looks like this:

{
    "requestId": "947aa603-1bfe-4bff-bac0-a50101da419d",
    "agentUserId": "13",
    "payload": {
        "devices": {
            "states": {
                "71dbbc93-73c6-46d1-80b0-d988dd8b0835_1": {
                    "on": true,
                    "online": true,
                    "currentVolume": 25,
                    "isMuted": false
                }
            }
        }
    }
}

and the response is 200 OK with this data: {"requestId": "947aa603-1bfe-4bff-bac0-a50101da419d"}

willReportState is also set to true in SYNC response. requestSync works correctly.

I'm having the following issues:

  • The report state dashboard has an empty statescache for my device.
  • The test suite returns the following errors indicating there is no states: "AssertionError: Expected state to include: {"currentVolume":5}, actual state: {}: expected false to be true"

Does anyone know what is going wrong here?

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • The payload looks correct, so you should be able to see the contents in Home Graph if you are getting a successful response. Can you confirm that the service account credentials being used in each scenario (report state call, report state dashboard, test suite) is the same? – devunwired Jul 10 '20 at 15:02
  • @Devunwired Yes the service account credentials and the agentUserId are the same. I wasn't fully clear on that test suite and the dashboard both find the device correctly, just that the states are missing. – Anders Constantin Jul 10 '20 at 20:21
  • Turns out we only experience this issue when the development account is a G Suite account. With a standard Gmail account state reporting works correctly. Is there a set of permissions that needs to be set for a G Suite account? – Anders Constantin Jul 15 '20 at 20:20
  • Can you clarify what you mean? Do you mean that the user account you are linking to the agentUserId is a Gmail account, or that the Gmail account is used to create the HomeGraph API credentials? – devunwired Jul 16 '20 at 15:25
  • The account used to create the HomeGraph API credentials is a GSuite account. – Anders Constantin Jul 17 '20 at 16:06
  • Thank you, will look into how this might affect the behavior. Note, however, that we recommend the credentials come from a Service Account on your project rather than a user's OAuth credentials: https://developers.google.com/assistant/smarthome/develop/report-state#service-account-key – devunwired Jul 21 '20 at 16:59
  • I have the same issue but I use Service Account as suggested in this guide https://developers.google.com/assistant/smarthome/develop/report-state#service-account-key. I call report-state with Node.js action-on-google library onQuery and onExecute fulfillment. – ims Jul 24 '20 at 15:08
  • Report-state is also called on demand, by an other Lambda function. It always respond with success, but my devices states are empty in local Report State Dashboard and in the Test Suite. What am i missing? – ims Jul 24 '20 at 15:17

2 Answers2

0

Following up on the discussion in the comments, Home Graph API credentials should be created using a Service Account that has the appropriate Service Account Token Creator permissions on your Actions project. These credentials should not come from a project user's OAuth credentials.

devunwired
  • 62,780
  • 12
  • 127
  • 139
0

I solved setting "commandOnlyOnOff" to false in SYNC response:

"attributes": {
   "commandOnlyOnOff": false
}
ims
  • 135
  • 3
  • 10