[英]Error Response with Google Smart Home (Thermostat)
对于尝试过的错误,我无法理解Json的语法
return {
"requestId": self.request_id,
"payload": {
"commands": [{
"ids": [self.device_id],
"status": "OFFLINE",
"errorCode": "deviceTurnedOff"
}]
}
}
和
return {
"requestId": self.request_id,
"payload": {
"errorCode": "authFailure",
"commands": [{
"devices": [{
"ids": [self.device_id],
"status": "ERROR",
"errorCode": "deviceTurnedOff"
}]
}]
}
}
和
return {
"requestId": self.request_id,
"payload": {
"errorCode": self.error_code
}
}
上面的语法都不起作用,大部分时间Google主页说您的操作已执行,但我在这里返回错误Json。
我已经阅读了Google动作文档,但听不懂。
我提出了一些有效载荷,并在查阅文档后使用AoG模拟器设法使其成功触发错误。
Node.js代码段:
let resBody = {
requestId: request.requestId,
payload: {
"errorCode": "notSupported"
}
}
response.status(200).json(resBody);
您确定requestId
与智能家居请求中的相同吗? 您如何测试这些错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.