【发布时间】:2018-12-04 04:40:14
【问题描述】:
我正在我的 Raspberry Pi 3 上创建一个谷歌助手,并且我正在尝试创建一个自定义设备操作以最终打开我的车库门。它所做的只是在此时播放一个 LED。
这是我的 actions.json 文件:
{
"manifest": {
"displayName": "Garage door",
"invocationName": "Garage door",
"category": "PRODUCTIVITY"
},
"actions": [
{
"name": "me.custom.actions.GarageDoor",
"availability": {
"deviceClasses": [
{
"assistantSdkDevice": {}
}
]
},
"intent": {
"name": "me.custom.intents.GarageDoor",
"trigger": {
"queryPatterns": [
"open the garage door",
"close the garage door"
]
}
},
"fulfillment": {
"staticFulfillment": {
"templatedResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Okay"
}
},
{
"deviceExecution": {
"command": "me.custom.commands.GarageDoor"
}
}
]
}
}
}
}
],
"types": []
}
但是当我运行命令时,我得到了这个错误:
INFO:root:Transcript of user request: "open the garage door".
INFO:root:Playing assistant response.
WARNING:root:Error during command execution
Traceback (most recent call last):
File "/home/pi/assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/grpc/device_helpers.py", line 94, in dispatch_command
self.handlers[command](**params)
TypeError: gdoor() argument after ** must be a mapping, not NoneType
这是我的处理程序:
@device_handler.command('me.custom.commands.GarageDoor')
def gdoor(*args):
print(args)
global g_open
if g_open:
GPIO.output(18, 0)
g_open = 0
else:
GPIO.output(18, 1)
g_open = 1
我正在使用 *args 来查看它是否修复了任何问题 - 它没有。出于隐私考虑,我已将包裹名称更改为自定义。我在这里很困惑。任何帮助表示赞赏!
谢谢!
【问题讨论】:
标签: python raspberry-pi google-assistant-sdk