Google Assistent - 无法创建设备实例

时间:2018-01-12 16:36:29

标签: google-assistant-sdk google-assist-api

我不知道为什么他不能创建实例。

首先它说:

C:\Users\Thomas\Desktop>googlesamples-assistant-pushtotalk --device-id                         assi
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: 'C:\\.....\\AppData\\...
INFO:root:Registering device
ERROR:root:Option --device-model-id required when registering a device instance.

接下来尝试使用--device-model-id

C:\Users\Thomas\Desktop>googlesamples-assistant-pushtotalk --device-model-id assi
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: 'C:\\Users\\Thomas\\AppData\\Roaming\\googlesamples-assistant\\device_config.json'
INFO:root:Registering device
ERROR:root:Option --project-id required when registering a device instance.

然后尝试使用--project-id

C:\Users\Thomas\Desktop>googlesamples-assistant-pushtotalk --device-model-id assi --project-id evil-assist
INFO:root:Connecting to embeddedassistant.googleapis.com
WARNING:root:Device config not found: [Errno 2] No such file or directory: 'C:\\Users\\Thomas\\AppData\\Roaming\\googlesamples-assistant\\device_config.json'
INFO:root:Registering device
ERROR:root:Failed to register device: {
  "error": {
    "code": 400,
    "message": "Could not create the device instance. Client type need to be specified as SDK_LIBRARY or SDK_SERVICE.",
    "status": "INVALID_ARGUMENT"
  }
}

我还在developers.google.com上注册了该设备。

C:\Users\Thomas\Desktop>googlesamples-assistant-devicetool list --model
Device Model Id: assi
        Project Id: evil-assist
        Device Type: action.devices.types.LIGHT
        Trait action.devices.traits.OnOff

C:\Users\Thomas\Desktop>googlesamples-assistant-devicetool list --device
Device Instance Id: assi
    Nickname: assi
    Model: assi

为什么它不起作用的任何想法?

3 个答案:

答案 0 :(得分:0)

资助解决方案..

使用

更新库
python -m pip install --upgrade google-assistant-sdk[samples]

我在2天前更新了它,似乎该版本中有一个错误。现在它有效。

答案 1 :(得分:0)

答案 2 :(得分:0)

您应该按照Thomas Mayer所述更新库。

googlesamples-assistant-devicetool

略有变化。要创建设备实例ID,请执行以下命令:

googlesamples-assistant-devicetool --project-id myand
roidthings-5dba4 register-device --device 123456 --model myandroidthings-xxxxxx-myproduct-yyyyyy --client-type LIBRARY

除此以外,https://developers.google.com/assistant/sdk/guides/library/python/似乎是最新的

最后一个选项取决于您支持的平台:https://developers.google.com/assistant/sdk/overview#features SERVICE适用于所有gRPC平台。 库适用于linux-armv7l和linux-x86_64