Trait action.devices.traits.Modes似乎不起作用



我正在努力使action.devices.traits.Modes特性发挥作用。在action.devices.SYNC请求时,我返回以下响应:

{
"payload":{
"devices":[
{
"id":"12345",
"type":"action.devices.types.SWITCH",
"traits":[
"action.devices.traits.OnOff",
"action.devices.traits.StartStop",
"action.devices.traits.Modes"
],
"name":{
"defaultNames":null,
"name":"David",
"nicknames":null
},
"willReportState":false,
"roomHint":"living room",
"attributes":{
"pausable":true,
"availableModes":[
{
"name":"speed",
"name_values":[
{
"name_synonym":[
"speed"
],
"lang":"en"
}
],
"settings":[
{
"setting_name":"slow",
"setting_values":[
{
"setting_synonym":[
"slow"
],
"lang":"en"
}
]
},
{
"setting_name":"normal",
"setting_values":[
{
"setting_synonym":[
"normal"
],
"lang":"en"
}
]
},
{
"setting_name":"fast",
"setting_values":[
{
"setting_synonym":[
"fast"
],
"lang":"en"
}
]
}
],
"ordered":true
}
]
}
}
]
}
}

我在上验证了此响应https://developers.google.com/actions/smarthome/tools/validator/,得到的反馈是很好。

现在,当我在控制台或智能手机上的助手中键入以下短语之一时,不会调用履行服务:

What mode is David in?
What speed is David in?
What is the David's speed?
Set the speed of David to normal.
Set David's speed to normal.
Set David to normal speed.
...

所有这些都可以简单地追溯到谷歌搜索。

而CCD_ 3和CCD_。以下短语按预期工作:

Turn David on
Resume David.
...

我不知道出了什么问题,也不知道该怎么调试。AFAIK,智能家居服务或多或少是一个黑匣子,所以我不确定这里出了什么问题。

availableModes:的模式特征文档中所述

当前,您必须使用示例JSON中的名称;还不支持自定义名称。

通过在GitHub样本上提交问题,可以单独手动创建名称。

然而,在你的具体速度情况下,你应该看看FanSpeed的特点。它提供了相同的功能,您可以定义几种速度模式,然后在它们之间切换。你可以更新你的设备JSON,使其看起来更像这样:

{
"payload":{
"devices":[
{
"id":"12345",
"type":"action.devices.types.SWITCH",
"traits":[
"action.devices.traits.OnOff",
"action.devices.traits.StartStop",
"action.devices.traits.FanSpeed"
],
"name":{
"defaultNames":null,
"name":"David",
"nicknames":null
},
"willReportState":false,
"roomHint":"living room",
"attributes":{
"pausable":true,
"availableFanSpeeds": {
"speeds": [{
"speed_name": "Low",
"speed_values": [{
"speed_synonym": ["low", "slow"],
"lang": "en"
},
{
"speed_synonym": ["low", "slow"],
"lang": "de"
}]
},
{
"speed_name": "High",
"speed_values": [{
"speed_synonym": ["high"],
"lang": "en"
},
{
"speed_synonym": ["high"],
"lang": "de"
}]
}],
"ordered": true
},
"reversible": true
}
}
]}
}

最新更新