iot - 谷歌主页。关于配置锁定设备的问题
问题描述
介绍:
- 创建了一个谷歌智能家居项目
- 已通过 ngrok 配置代理服务器以将 Google 请求重定向到我的本地计算机
我开发了一个能够打开/关闭锁的 IoT 项目。我需要实现谷歌集成以使用谷歌助手来控制用户锁。我已经为 Google 实现了 OAuth 服务器。我还实现了一些控制器来处理 Google Action Intents SYNC
:QUERY
和EXECUTE
. Google 发送带有 SYNC 意图的请求,应用程序响应包含具有特定设置的设备列表的有效负载。实例:
{
requestId: 'requestIdOfGoogle', // contains in the request body
payload: {
agentUserId: 'userId123', // matches user id inside app system
devices: [
{
id: 1,
type: 'action.devices.types.LOCK', // device type
traits: ['action.devices.traits.LockUnlock'], // feature that has a device
name: {
name: 'Kos Lock'
},
willReportState: true,
roomHint: 'Main Door',
deviceInfo: { // Test data
manufacturer: 'smart-home-inc',
model: 'hs1234',
hwVersion: '3.2',
swVersion: '11.4'
}
}
]
}
}
然后谷歌向我的服务器发送请求,QUERY
以获取有关设备状态的信息,实例
{
requestId: 'requestIdOfGoogle', // contains in the request body
payload: {
devices: {
1: {
status: 'SUCCESS',
online: true,
isLocked: true,
// isJammed - Boolean. Whether the device is currently jammed and therefore its
// locked state cannot be determined.
isJammed: false
}
}
}
}
但在发送响应后,未配置测试锁,用户无法使用 Google 助理控制测试锁。 在此处输入图像描述
我试图为锁添加其他特征,但它对我没有帮助。当我尝试配置门设备时,我也遇到了同样的问题。但是,当我向 Google 发送Light
设备时,它可以成功运行。当您使用该LockUnlock
特征时,Google Doc 建议设置辅助用户验证,但它是可选的。
我不明白这样做不正确。如果有人遇到这样的问题并解决了,那么你能帮助我吗?
先决条件:
- 使用节点 ^14.0.0
- 编程语言——
js
解决方案
并非所有设备都支持触摸控制,并且锁不是可以直接控制的设备类型。但他们仍会响应语音命令。
推荐阅读
- c++ - 将数据复制到另一个任务
- python - 使用虚拟环境时,jupyter notebook 中使用了哪些模块?
- java - 如何在 Java 中生成内部分离的 XML 签名
- python - 约束中的“或”:docplex
- c# - UnityEvent 没有被调用
- sympy - 如何从 sympy 逻辑对象/表达式中获取所有文字(包括否定文字)?
- javascript - 地图和过滤器的组合不能按预期工作
- variables - 如何将多行结果映射到 SSIS 执行 SQL 任务中的不同变量?
- javascript - Webpack 正在为每个 SVG 文件生成一个捆绑文件
- django - 包含在 urlpatterns 和 404 中