简体   繁体   English

Google智能家居应用测试操作失败

[英]Actions on Google smart home app test fail

I am developing a smart home app for google home to control smart devices. 我正在为Google Home开发一个智能家居应用程序,以控制智能设备。 I use gactions to push my app for testing: 我使用gactions推送我的应用进行测试:

gactions test --action_package action.json --project <project-name>

Everything works fine until today, the test command returns error: 直到今天一切正常,测试命令返回错误:

Pushing the app for the Assistant for testing...
ERROR: Failed to test the app for the Assistant
ERROR: Invalid JSON payload received. Unknown name "device_control" at 'preview_
action_package.action_package.actions[0]': Cannot find field.
Field Violations:
#  Field                                             Description
1  preview_action_package.action_package.actions[0]  Invalid JSON payload receiv
ed. Unknown name "device_control" at 'preview_action_package.action_package.acti
ons[0]': Cannot find field.
2017/05/26 09:39:10 Server did not return HTTP 200

here is my action.json, it's not changed since created: 这是我的action.json,自创建以来未更改:

{
    "actions": [{
    "name": "actions.devices",
    "deviceControl": {
    },
    "fulfillment": {
      "conversationName": "automation"
    }
  }],
    "conversations": {
      "automation": {
        "name": "automation",
        "url": "<my web endpoint>"
      }
    }
}

There is no device_control in my action.json. 我的action.json中没有device_control。 After some try, it seems the parser treat 'C' as '_c'. 经过一番尝试后,解析器似乎将“ C”视为“ _c”。

Is this an issue on Google's end? 这是Google的问题吗?

Google's JSON handling often treats camelCaseNaming and underscore_naming as equivalent. Google的JSON处理通常将camelCaseNaming和underscore_naming视为等效。 In this case, deviceControl and device_control are referencing the same thing. 在这种情况下, deviceControldevice_control引用的是同一件事。

The current (as of 18 May 2017) specification for an Action in the action package does not include deviceControl as a valid field. 用于当前(如5月18日2017)规范操作在动作包不包括deviceControl为有效的字段。 The only reference I can find to deviceControl is in descriptive documentation about the action package, but it is similarly left blank and not described there. 我可以找到的关于deviceControl唯一参考是关于操作包的描述性文档,但类似地留为空白,此处未进行描述。

You can probably safely remove this entry. 您可能可以安全地删除该条目。

just remove that: 只需删除:

"deviceControl": { }, “ deviceControl”:{},

in your action package, then it will work. 在您的操作包中,那么它将起作用。

I just verified this way works. 我只是验证了这种方式的工作原理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM