- 积分
- 482
- 金钱
- 381
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 482
- 金钱
- 381
- HASS币
- 0
|
楼主 |
发表于 2024-3-1 19:07:07
|
显示全部楼层
本帖最后由 louwu 于 2024-3-1 19:12 编辑
请教一下如何写,我按前面的代码补充了4个开关,显示倒是有8个开关了,
结果下排的情景开关无效,这些字符串各代表什么啊
"spec": [
Converter("switch_1", "switch", mi="2.p.1"),
Converter("switch_2", "switch", mi="3.p.1"),
Converter("switch_3", "switch", mi="4.p.1"),
Converter("switch_4", "switch", mi="12.p.1"),
改成8键了
from custom_components.xiaomi_gateway3.core.converters.devices import *
DEVICES = [{
8553: ["LianXun", "Smart Switch 8-key Mesh", "lxun.switch.sw08"],
"spec": [
Converter("switch_1", "switch", mi="2.p.1"),
Converter("switch_2", "switch", mi="3.p.1"),
Converter("switch_3", "switch", mi="4.p.1"),
Converter("switch_4", "switch", mi="12.p.1"),
Converter("switch_5", "switch", mi="5.p.1"),
Converter("switch_6", "switch", mi="6.p.1"),
Converter("switch_7", "switch", mi="7.p.1"),
Converter("switch_8", "switch", mi="8.p.1"),
MapConv("backlight", "select", mi="5.p.1", map={0: "off", 1: "on"}),
MapConv("backlight_1", "select", mi="9.p.1", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("backlight_2", "select", mi="9.p.2", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("backlight_3", "select", mi="9.p.3", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("backlight_4", "select", mi="9.p.4", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("backlight_5", "select", mi="9.p.5", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("backlight_6", "select", mi="9.p.6", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("backlight_7", "select", mi="9.p.7", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("backlight_8", "select", mi="9.p.8", map={1: "reverse", 2: "open", 3: "close", 4: "flash"}),
MapConv("mode_1", "select", mi="10.p.1", map={1: "normal", 2: "scene", 3: "flex"}),
MapConv("mode_2", "select", mi="10.p.2", map={1: "normal", 2: "scene", 3: "flex"}),
MapConv("mode_3", "select", mi="10.p.3", map={1: "normal", 2: "scene", 3: "flex"}),
MapConv("mode_4", "select", mi="10.p.4", map={1: "normal", 2: "scene", 3: "flex"}),
Action,
ButtonMIConv("button_1", mi="11.e.1", value=1),
ButtonMIConv("button_2", mi="11.e.2", value=1),
ButtonMIConv("button_3", mi="11.e.3", value=1),
ButtonMIConv("button_4", mi="11.e.4", value=1),
ButtonMIConv("button_1", mi="11.e.5", value=2),
ButtonMIConv("button_2", mi="11.e.6", value=2),
ButtonMIConv("button_3", mi="11.e.7", value=2),
ButtonMIConv("button_4", mi="11.e.8", value=2),
ButtonMIConv("button_1", mi="11.e.9", value=16),
ButtonMIConv("button_2", mi="11.e.10", value=16),
ButtonMIConv("button_3", mi="11.e.11", value=16),
ButtonMIConv("button_4", mi="11.e.12", value=16),
ButtonMIConv("button_5", mi="11.e.13", value=1),
ButtonMIConv("button_6", mi="11.e.14", value=1),
ButtonMIConv("button_7", mi="11.e.15", value=1),
ButtonMIConv("button_8", mi="11.e.16", value=1),
ButtonMIConv("button_5", mi="11.e.17", value=2),
ButtonMIConv("button_6", mi="11.e.18", value=2),
ButtonMIConv("button_7", mi="11.e.19", value=2),
ButtonMIConv("button_8", mi="11.e.20", value=2),
ButtonMIConv("button_5", mi="11.e.21", value=16),
ButtonMIConv("button_6", mi="11.e.22", value=16),
ButtonMIConv("button_7", mi="11.e.23", value=16),
ButtonMIConv("button_8", mi="11.e.24", value=16),
]
}] + DEVICES
|
|