特征 action.devices.traits.Modes 似乎不起作用
Trait action.devices.traits.Modes does not seem to be working
我正在努力使 action.devices.traits.Modes
特性发挥作用。根据 action.devices.SYNC
请求,我 return 做出以下回应:
{
"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.
...
所有这些都简单地回退到 Google 搜索。
但是 action.devices.traits.OnOff
和 action.devices.traits.StartStop
特征工作正常。以下短语按预期工作:
Turn David on
Resume David.
...
我不知道出了什么问题,也不知道我应该如何调试它。据我所知,智能家居服务或多或少是一个黑盒子,所以我不确定这里发生了什么on/wrong。
如 the Modes trait for availableModes
的文档中所述:
Currently, you must use the names in the example JSON; custom names are not yet supported.
可以通过在 GitHub sample.
上提交问题,在个人基础上手动创建名称
但是,在您的特定速度情况下,您应该查看 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
}
}
]}
}
我正在努力使 action.devices.traits.Modes
特性发挥作用。根据 action.devices.SYNC
请求,我 return 做出以下回应:
{
"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.
...
所有这些都简单地回退到 Google 搜索。
但是 action.devices.traits.OnOff
和 action.devices.traits.StartStop
特征工作正常。以下短语按预期工作:
Turn David on
Resume David.
...
我不知道出了什么问题,也不知道我应该如何调试它。据我所知,智能家居服务或多或少是一个黑盒子,所以我不确定这里发生了什么on/wrong。
如 the Modes trait for availableModes
的文档中所述:
Currently, you must use the names in the example JSON; custom names are not yet supported.
可以通过在 GitHub sample.
上提交问题,在个人基础上手动创建名称但是,在您的特定速度情况下,您应该查看 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
}
}
]}
}