Google上的操作-Google Home EXEC输入和响应中的命令/设备/执行之间是什么关系? [英] Actions on Google - What is the relationship between commands/devices/executions in the Google Home EXEC input and response?

查看:54
本文介绍了Google上的操作-Google Home EXEC输入和响应中的命令/设备/执行之间是什么关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与Google Smart Home上的操作文档有关创建智能家居应用,特别是action.devices.EXECUTE部分。

This question concerns the Actions on Google Smart Home documentation Create a Smart Home App, specifically the action.devices.EXECUTE section.

对于 Command对象列表与其关联的设备和执行列表之间的确切关系,尤其是如何将它们转换为响应,我们有些困惑。

We are somewhat confused regarding the exact relationship between the list of 'Command' objects and their associated lists of Devices and Executions, especially regarding how these are translated to a response.

根据文档,我们认为目的是为了按顺序处理命令:从上到下。对于每个命令,将对命令中的每个设备ID进行处理(同样,从上到下)。

Based on the documentation, we believe that the intent is for Commands to be processed in order: top to bottom. Per Command, each Execution is processed (again, top to bottom) for each device ID in the Command.

如果我们正确理解了说明,则响应可能包含以下内容:输入中每个初始命令最多4个命令(一个用于SUCCESS,PENDING,OFFLINE&ERROR),每个命令都带有适合该结果的设备ID列表。

A response, if we understand the description correctly, could include up to 4 Commands per initial Command in the input (one for SUCCESS, PENDING, OFFLINE & ERROR), each with a list of device IDs for which that result is appropriate.

但是,响应中没有提及执行。这是否意味着如果某设备的1次执行失败(多次执行)失败了,则尽管该设备的其他执行成功了,它仍会在响应中列在ERROR下?

There is no mention of Executions in the response, however. Does this mean that if 1 execution for a device fails (out of multiple) that in the response it is listed under ERROR, despite other executions for the device succeeding?

例如,如果有命令打开电灯并将其颜色设置为蓝色。启用它成功,但是出现一些任意错误会阻止设置颜色,那么响应格式应该是什么样?

For example, if a command comes in to turn on a light and set its color to blue. Turning it on succeeds, but some arbitrary error prevents the color from being set, then what should the response format look like?

感谢您阅读。

推荐答案

一个命令数组将包含应该由该命令控制的所有设备。还有一个提供命令和参数的执行数组。

A commands array will contain all of the devices that are supposed to controlled with this command. There is an additional execution array which provides the command and parameters.

如果无法成功控制某些设备,则该设备ID应该返回错误,如图所示在文档中。

If some devices could not successfully be controlled, there should be an error returned for that device id, as shown in the documentation.

对于任何特定设备,想到一个命令成功而另一个命令失败的场景可能很奇怪。在这种情况下,您需要考虑最有意义的原因,可能是错误 protocolError unknownError

For any particular device, it may be odd to think of a scenario where one command is successful but another failing. In that case, you will need to think of the reason that makes the most sense, perhaps error protocolError or unknownError.

每个命令都应同时或并行处理。如果您无法进行用户请求的所有更改,那么根本不执行任何命令可能会更加一致。这样可以打开/关闭设备,但是如果颜色中断了,则如果同时发送两个命令,它将失败。

Every command is meant to be processed simultaneously, or in parallel. If you cannot make all of the changes that the user requested, it may be more consistent if no command was executed at all. So your device could be turned on/off, but if color is broken it should fail if both commands are sent at the same time.

这篇关于Google上的操作-Google Home EXEC输入和响应中的命令/设备/执行之间是什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆