我在我的Raspberry Pi 3上创建了一个google助手,我正在尝试创建一个自定义的设备操作来最终打开我的车库门。它所做的就是在这个时间点播放一个LED。你知道吗
这是我的操作.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,看看它是否修复了任何东西-它没有。我把包名改为custom只是为了隐私。我很困惑。感谢您的帮助!你知道吗
谢谢!你知道吗
看看the sample code,函数签名似乎有点不同,因为它直接添加了参数。你知道吗
查看操作包,您似乎没有提供任何与命令实现相关的操作。如the sample所示:
如果没有任何参数,它可能根本无法映射任何函数。你知道吗
相关问题 更多 >
编程相关推荐