1

When i try to execute a command and that the device is offline, Assistant still tell me that the command as been successfully be done.

I don't have this problem when it's a QUERY request, but with EXECUTE...

This is my returned JSON:

{
  "requestId": "XXXXXX",
  "payload": {
    "commands": [
      {
        "ids": [123],
        "status": "ERROR",
        "errorCode": "deviceTurnedOff",
        "online": false
      }
    ]
  }
}

I have also try this:

{
  "requestId": "XXXXXX",
  "payload": {
    "commands": [
      {
        "ids": [123],
        "status": "OFFLINE",
        "errorCode": "deviceTurnedOff",
        "online": false
      }
    ]
  }
}

I expect that when i try to do a command on an offline device, google assistant tell me that the device is not available, but i have a Ok, i turn the light on instead.

So if you have any idea, because i have checked my JSON response 1 million times and read the documentation many times but i can't find my mistake.

  • Voting to close as I am really not sure what you are asking... If those are your response messages, they clearly state that the device is offline... What do you (expect) to see here? – Matt Clark May 09 '19 at 19:20
  • @MattClark, I expect the google assistant tell my that the action can't be done, in documentation they say, if the device is offline assistant will tell you that the device is unavailable: _Return the offline state for offline devices. We return 'not available right now' as TTS for this error._ – Sébastien Clément May 09 '19 at 19:28
  • Try returning your device ids as strings instead of numbers. – Nick Felker May 13 '19 at 16:46

1 Answers1

1

The documentation here is a bit confusing because the example shows the response payload for the QUERY intent.

The response payload for an EXECUTE intent is slightly different and is documented here.

The JSON using the correct reference the EXECUTE response payload will look like:

{
  "requestId": "XXXXXX",
  "payload": {
    "commands": [{
      "ids": ["123"],
      "status": "OFFLINE",
      "errorCode": "deviceTurnedOff"
    }]
  }
}

Note: deviceId should be a string, as noted in the EXECUTE Response payload details.

Quoting from the doc:

ids: Array. Required. Partner device IDs of the response

Vibgy
  • 577
  • 6
  • 15