From aae846518c37c1bf5996924e51ff3442680b132b Mon Sep 17 00:00:00 2001 From: Alex X Date: Sun, 15 Oct 2023 16:09:58 +0300 Subject: [PATCH] Add switches: frfox.switch.bl02, lxun.switch.lxswm4, lxun.switch.sw08 #1140 --- .../core/converters/devices.py | 84 +++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/custom_components/xiaomi_gateway3/core/converters/devices.py b/custom_components/xiaomi_gateway3/core/converters/devices.py index 0a43358c..1959a090 100644 --- a/custom_components/xiaomi_gateway3/core/converters/devices.py +++ b/custom_components/xiaomi_gateway3/core/converters/devices.py @@ -2628,19 +2628,91 @@ 7856: ["Unknown", "Mesh Double Wall Switch (No N)", "frfox.switch.bl02"], "spec": [ Converter("channel_1", "switch", mi="2.p.1"), - MapConv("mode_1", "select", mi="2.p.2", map={ - 0: "default", 1: "wireless", 2: "flex", 3: "scene", - }), Converter("channel_2", "switch", mi="3.p.1"), - MapConv("mode_2", "select", mi="3.p.2", map={ - 0: "default", 1: "wireless", 2: "flex", 3: "scene", - }), + MapConv("mode_1", "select", mi="2.p.2", map={0: "default", 1: "wireless", 2: "flex", 3: "scene"}), + MapConv("mode_2", "select", mi="3.p.2", map={0: "default", 1: "wireless", 2: "flex", 3: "scene"}), Action, ButtonMIConv("button_1", mi="4.e.1", value=1), ButtonMIConv("button_2", mi="5.e.1", value=1), Converter("backlight", "switch", mi="6.p.1"), Converter("led", "switch", mi="6.p.2"), ] +}, { + 11253: ["LianXun", "Smart Switch Four-key Mesh", "lxun.switch.lxswm4"], + "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"), + 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("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), + ] +}, { + 12987: ["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"), + 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), + ] }, { 7857: ["Unknown", "Mesh Triple Wall Switch (No N)", "frfox.switch.bl03"], "spec": [