From 276a17472835aebc8f9a1dc03f0d351da909c91a Mon Sep 17 00:00:00 2001 From: flyibeat <78073839+flyibeat@users.noreply.github.com> Date: Fri, 15 Sep 2023 17:04:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add=20support=20for=20=E2=80=9CK=20Series?= =?UTF-8?q?=20Single=20Wall=20Switch=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomi_gateway3/core/converters/devices.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/custom_components/xiaomi_gateway3/core/converters/devices.py b/custom_components/xiaomi_gateway3/core/converters/devices.py index 0f8f4c38..519df719 100644 --- a/custom_components/xiaomi_gateway3/core/converters/devices.py +++ b/custom_components/xiaomi_gateway3/core/converters/devices.py @@ -1726,6 +1726,23 @@ 15: "sleep" }) ] +}, { + 12455: ["Yeelight", "K Series Single Wall Switch", "YLYKG"], + "spec": [ + Converter("switch", "switch", mi="2.p.1"), + MapConv("power-on-state", "select", mi="2.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless", "select", mi="2.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("indicator-light", "switch", mi="5.p.1", enabled=False), + MapConv("operatingmode", "select", mi="8.p.1", map={ + 1: "Top Speed Mode", 2: "Standard Mode" }, enabled=False), + Converter("action", "sensor", enabled=False), + ButtonMIConv("button", mi="14.e.1", value=1), + ButtonMIConv("button", mi="14.e.2", value=2), + ButtonMIConv("button", mi="14.e.3", value=16), + ], }, { 1945: ["Xiaomi", "Mesh Wall Switch", "DHKG01ZM"], "spec": [ From c231e68fdf4ebe7831f55de01ddd0e36cbd2af82 Mon Sep 17 00:00:00 2001 From: flyibeat <78073839+flyibeat@users.noreply.github.com> Date: Fri, 15 Sep 2023 17:16:07 +0800 Subject: [PATCH 2/3] add support for Yeelight K series --- .../core/converters/devices.py | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_gateway3/core/converters/devices.py b/custom_components/xiaomi_gateway3/core/converters/devices.py index 519df719..ef974bc6 100644 --- a/custom_components/xiaomi_gateway3/core/converters/devices.py +++ b/custom_components/xiaomi_gateway3/core/converters/devices.py @@ -1727,7 +1727,7 @@ }) ] }, { - 12455: ["Yeelight", "K Series Single Wall Switch", "YLYKG"], + 12455: ["Yeelight", "K Series Single Wall Switch", "YLYKG-0025/0020"], "spec": [ Converter("switch", "switch", mi="2.p.1"), MapConv("power-on-state", "select", mi="2.p.2", map={ @@ -1743,6 +1743,67 @@ ButtonMIConv("button", mi="14.e.2", value=2), ButtonMIConv("button", mi="14.e.3", value=16), ], +}, { + 12456: ["Yeelight", "K Series Double Wall Switch", "YLYKG-0026/0021"], + "spec": [ + Converter("channel_1", "switch", mi="2.p.1"), + MapConv("power-on-state_1", "select", mi="2.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_1", "select", mi="2.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("channel_2", "switch", mi="3.p.1"), + MapConv("power-on-state_2", "select", mi="3.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_2", "select", mi="3.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("indicator-light", "switch", mi="5.p.1", enabled=False), + MapConv("operatingmode", "select", mi="8.p.1", map={ + 1: "Top Speed Mode", 2: "Standard Mode" }, enabled=False), + Converter("action", "sensor", enabled=False), + ButtonMIConv("button_1", mi="14.e.1", value=1), + ButtonMIConv("button_1", mi="14.e.2", value=2), + ButtonMIConv("button_1", mi="14.e.3", value=16), + ButtonMIConv("button_2", mi="15.e.1", value=1), + ButtonMIConv("button_2", mi="15.e.2", value=2), + ButtonMIConv("button_2", mi="15.e.3", value=16), + ], +}, { + 12457: ["Yeelight", "K Series Triple Wall Switch", "YLYKG-0026/0021"], + "spec": [ + Converter("channel_1", "switch", mi="2.p.1"), + MapConv("power-on-state_1", "select", mi="2.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_1", "select", mi="2.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("channel_2", "switch", mi="3.p.1"), + MapConv("power-on-state_2", "select", mi="3.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_2", "select", mi="3.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("channel_3", "switch", mi="4.p.1"), + MapConv("power-on-state_3", "select", mi="4.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_3", "select", mi="4.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("indicator-light", "switch", mi="5.p.1", enabled=False), + MapConv("operatingmode", "select", mi="8.p.1", map={ + 1: "Top Speed Mode", 2: "Standard Mode" }, enabled=False), + Converter("action", "sensor", enabled=False), + ButtonMIConv("button_1", mi="14.e.1", value=1), + ButtonMIConv("button_1", mi="14.e.2", value=2), + ButtonMIConv("button_1", mi="14.e.3", value=16), + ButtonMIConv("button_2", mi="15.e.1", value=1), + ButtonMIConv("button_2", mi="15.e.2", value=2), + ButtonMIConv("button_2", mi="15.e.3", value=16), + ButtonMIConv("button_3", mi="16.e.1", value=1), + ButtonMIConv("button_3", mi="16.e.2", value=2), + ButtonMIConv("button_3", mi="16.e.3", value=16), + ], }, { 1945: ["Xiaomi", "Mesh Wall Switch", "DHKG01ZM"], "spec": [ From 8660ebef92b9625e906b89c82e57be5788111445 Mon Sep 17 00:00:00 2001 From: flyibeat <78073839+flyibeat@users.noreply.github.com> Date: Fri, 15 Sep 2023 17:18:59 +0800 Subject: [PATCH 3/3] K Series 4-Key Wall Switch --- .../core/converters/devices.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/custom_components/xiaomi_gateway3/core/converters/devices.py b/custom_components/xiaomi_gateway3/core/converters/devices.py index ef974bc6..75c1460b 100644 --- a/custom_components/xiaomi_gateway3/core/converters/devices.py +++ b/custom_components/xiaomi_gateway3/core/converters/devices.py @@ -1804,6 +1804,50 @@ ButtonMIConv("button_3", mi="16.e.2", value=2), ButtonMIConv("button_3", mi="16.e.3", value=16), ], +}, { + 12458: ["Yeelight", "K Series 4-Key Wall Switch", "YLYKG-0028/0023"], + "spec": [ + Converter("channel_1", "switch", mi="2.p.1"), + MapConv("power-on-state_1", "select", mi="2.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_1", "select", mi="2.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("channel_2", "switch", mi="3.p.1"), + MapConv("power-on-state_2", "select", mi="3.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_2", "select", mi="3.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("channel_3", "switch", mi="4.p.1"), + MapConv("power-on-state_3", "select", mi="4.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_3", "select", mi="4.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("channel_4", "switch", mi="12.p.1"), + MapConv("power-on-state_4", "select", mi="12.p.2", map={ + 1: "On", 2: "Off", 3: "Default" }, enabled=False), + MapConv("wireless_4", "select", mi="12.p.3", map={ + 0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless" + }, enabled=False), + Converter("indicator-light", "switch", mi="5.p.1", enabled=False), + MapConv("operatingmode", "select", mi="8.p.1", map={ + 1: "Top Speed Mode", 2: "Standard Mode" }, enabled=False), + Converter("action", "sensor", enabled=False), + ButtonMIConv("button_1", mi="14.e.1", value=1), + ButtonMIConv("button_1", mi="14.e.2", value=2), + ButtonMIConv("button_1", mi="14.e.3", value=16), + ButtonMIConv("button_2", mi="15.e.1", value=1), + ButtonMIConv("button_2", mi="15.e.2", value=2), + ButtonMIConv("button_2", mi="15.e.3", value=16), + ButtonMIConv("button_3", mi="16.e.1", value=1), + ButtonMIConv("button_3", mi="16.e.2", value=2), + ButtonMIConv("button_3", mi="16.e.3", value=16), + ButtonMIConv("button_4", mi="17.e.1", value=1), + ButtonMIConv("button_4", mi="17.e.2", value=2), + ButtonMIConv("button_4", mi="17.e.3", value=16), + ], }, { 1945: ["Xiaomi", "Mesh Wall Switch", "DHKG01ZM"], "spec": [