首页 > 解决方案 > 谷歌主页。关于配置锁定设备的问题

问题描述

介绍:

我开发了一个能够打开/关闭锁的 IoT 项目。我需要实现谷歌集成以使用谷歌助手来控制用户锁。我已经为 Google 实现了 OAuth 服务器。我还实现了一些控制器来处理 Google Action Intents SYNC:QUERYEXECUTE. 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 建议设置辅助用户验证,但它是可选的。

我不明白这样做不正确。如果有人遇到这样的问题并解决了,那么你能帮助我吗?

先决条件:

标签: iotgoogle-homegoogle-smart-home

解决方案


并非所有设备都支持触摸控制,并且锁不是可以直接控制的设备类型。但他们仍会响应语音命令。


推荐阅读