如文件所述
the Modes trait
对于
availableModes
以下内容:
目前,您必须使用示例json中的名称;尚不支持自定义名称。
通过在
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
}
}
]}
}