简体   繁体   English

有关Google智能家居“模式”特征的详细信息

[英]Detail about google smart home “mode” trait

I have a question about the device.trait "Modes" 我对device.trait“模式”有疑问

I create a washer machine with traits Modes and the SYNC.response look like this 我用特征模式创建了一个洗衣机,并且SYNC.response看起来像这样

{
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"agentUserId": "1836.15267389",
"devices": [
    {
        "id": "311_washer_1",
        "type": "action.devices.types.WASHER",
        "traits": ["action.devices.traits.Modes","action.devices.traits.OnOff"],
        "name": {
            "name": "Laboratory Washer 1",
            "nicknames": ["Laboratory Washer"]
        },
        "willReportState": false,
        "attributes":{
            "availableModes":[{
                "name": "speed",
                "name_values": [{
                    "name_synonym": ["speed"],
                    "lang": "en"
                }],
                "settings": [{
                        "setting_name": "fast",
                        "setting_values": [{
                            "setting_synonym": ["fast"],
                            "lang": "en"
                        }]
                    },{
                        "setting_name": "medium",
                        "setting_values":[{
                            "setting_synonym":["medium"],
                            "lang": "en"
                        }]
                    },{
                        "setting_name": "slow",
                        "setting_values":[{
                            "setting_synonym":["slow"],
                            "lang": "en"
                        }]
                    }
                ],
                "ordered": true
            }]
        }
    }
]
}

} }

I have a mode call "speed" 我有一个模式调用“速度”

but when I talk to the assistant, it just replay my that "That mode isn't available for it" 但是当我与助手交谈时,它只是重播“该模式不可用”

Can somebody tell me where is wrong or is it related to 有人可以告诉我哪里错了吗?

Currently, you must use the names in the example JSON; 当前,您必须在示例JSON中使用名称。 custom names are not yet supported. 自定义名称尚不支持。

in the instruction page 说明页面中

Thank you~~ 谢谢~~

For incorporating modes, there are only a specific set of available mode values and settings that you are able to use. 对于合并模式,您只能使用一组特定的可用模式值和设置。 Custom names and settings are currently not supported, so you need to stick to a specific list. 当前不支持自定义名称和设置,因此您需要遵守特定列表。

If you would like to get a new mode or settings added, you can file an issue on the GitHub sample and I'll add the specific values that you want. 如果您想添加新的模式或设置,可以在GitHub示例上提出问题 ,然后添加所需的特定值。

In the meantime, here's an example that should work using current modes. 同时,这是一个应使用当前模式工作的示例。

"availableModes":[{
    "name": "Cleaning Mode",
    "name_values": [{
        "name_synonym": ["cleaning mode"],
        "lang": "en"
    }],
    "settings": [{
        "setting_name": "High",
        "setting_values": [{
            "setting_synonym": ["high"],
            "lang": "en"
        }]
    },{
        "setting_name": "Medium",
        "setting_values":[{
            "setting_synonym":["medium"],
            "lang": "en"
        }]
    },{
        "setting_name": "Low",
        "setting_values":[{
            "setting_synonym":["low"],
            "lang": "en"
        }]
    }],
    "ordered": true
}]

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

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