简体   繁体   中英

Error Response with Google Smart Home (Thermostat)

I am unable to understand the syntax of Json for errors I have tried

return {
        "requestId": self.request_id,
        "payload": {
            "commands": [{
                "ids": [self.device_id],
                "status": "OFFLINE",
                "errorCode": "deviceTurnedOff"
            }]
        }
    }

and

return {
        "requestId": self.request_id,
        "payload": {
            "errorCode": "authFailure",
            "commands": [{
                "devices":  [{
                    "ids": [self.device_id],
                    "status": "ERROR",
                    "errorCode": "deviceTurnedOff"
                }]
            }]
        }
    }

and

return {
      "requestId": self.request_id,
      "payload": {
        "errorCode": self.error_code
      }
    }

none of above syntax are working, most of the time google home says that your actions is performed but I am returning error Json there.

I have read google actions documentation but failed to understand.

I have come up with a few payloads and have managed to get them successfully triggering errors using the AoG simulator after consulting the docs .

Node.js snippet:

let resBody = {
    requestId: request.requestId,
    payload: {
        "errorCode": "notSupported"
    }
}
response.status(200).json(resBody);

Are you sure that the requestId is the same from the smart home request? How are you testing these errors?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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