[英]Empty request from Google Smart Home SDK
I'm creating web server to connect my DIY smart home devices to Google Home app.我正在创建网络服务器以将我的 DIY 智能家居设备连接到 Google Home 应用程序。
After authorisation and token request Google server makes POST request to fullfillment URL, but request is empty for some reason.在授权和令牌请求后,谷歌服务器向 fullfillment URL 发出 POST 请求,但由于某种原因请求为空。 According to documentation, it must be SYNC request, but it does not contain any values, even request ID.
根据文档,它必须是 SYNC 请求,但它不包含任何值,甚至请求 ID。
There is error "Couldn't update the setting. Check your Internet connection."出现错误“无法更新设置。请检查您的 Internet 连接。” on my phone after request.
请求后在我的手机上。
So why does it happen and how I can fix it?那么为什么会发生这种情况,我该如何解决呢?
const app=smarthome({ debug: true, });
app.onSync( async (body) => {
return {
requestId: body.requestId,
payload: {
agentUserId: "agentUserId",
devices // devices list
}
};
});
server.post("/request", app);
Oh, I forgot to include body-parser
'cause I'm using general web server instead of actions-on-google
API.哦,我忘了包含
body-parser
,因为我使用的是通用网络服务器而不是actions-on-google
API。 LOL哈哈
Case closed.案件结案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.