我无法理解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
}
}
以上语法都没有工作,大部分时间谷歌主页说你的行为已经执行但我在那里返回错误Json。
我已阅读谷歌行动文档,但未能理解。
我提出了一些有效载荷,并在咨询了the docs之后设法使用AoG模拟器成功触发了错误。
Node.js片段:
let resBody = {
requestId: request.requestId,
payload: {
"errorCode": "notSupported"
}
}
response.status(200).json(resBody);
您确定智能家居请求中的requestId
是否相同?你是如何测试这些错误的?