From dbce44554f1c20e85fe96c78a8a8a95d0f58725b Mon Sep 17 00:00:00 2001 From: Alex X Date: Thu, 4 Apr 2024 22:02:45 +0300 Subject: [PATCH] Add topwit.switch.rzw34 mesh model #1125 --- .../xiaomi_gateway3/core/converters/const.py | 2 ++ .../xiaomi_gateway3/core/devices.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/custom_components/xiaomi_gateway3/core/converters/const.py b/custom_components/xiaomi_gateway3/core/converters/const.py index 22fcaf1d..5dc22876 100644 --- a/custom_components/xiaomi_gateway3/core/converters/const.py +++ b/custom_components/xiaomi_gateway3/core/converters/const.py @@ -27,6 +27,8 @@ BUTTON_BOTH_23 = "button_both_23" BUTTON_BOTH_SINGLE = "button_both_single" +BUTTON_BOTH_DOUBLE = "button_both_double" +BUTTON_BOTH_HOLD = "button_both_hold" # https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/converters/fromZigbee.js#L4738 BUTTON = { diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index 4d0b7502..ce1e02cb 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -3101,6 +3101,22 @@ MathConv("light_off_gradient_time", "number", mi="2.p.7", multiply=0.5, min=0, max=10, entity=ENTITY_CONFIG), MathConv("light_on_gradient_time", "number", mi="2.p.8", multiply=0.5, min=0, max=10, entity=ENTITY_CONFIG), ] +}, { + 15082: ["Unknown", "Smart Quadruple Switch", "topwit.switch.rzw34"], + "spec": [ + BaseConv("switch_1", "switch", mi="2.p.1"), + BaseConv("switch_2", "switch", mi="3.p.1"), + BaseConv("switch_3", "switch", mi="4.p.1"), + BaseConv("switch_4", "switch", mi="23.p.1"), + MapConv("mode_1", "select", mi="2.p.2", map={0: "off", 1: "wireless"}), + MapConv("mode_2", "select", mi="3.p.2", map={0: "off", 1: "wireless"}), + MapConv("mode_3", "select", mi="4.p.2", map={0: "off", 1: "wireless"}), + MapConv("mode_4", "select", mi="23.p.4", map={0: "off", 1: "wireless"}), + BaseConv("action", "sensor"), + MapConv("action", mi="5.e.1.p.2", map={1: BUTTON_1_SINGLE, 2: BUTTON_2_SINGLE, 3: BUTTON_3_SINGLE, 4: BUTTON_BOTH_SINGLE}), + MapConv("action", mi="5.e.2.p.2", map={1: BUTTON_1_DOUBLE, 2: BUTTON_2_DOUBLE, 3: BUTTON_3_DOUBLE, 4: BUTTON_BOTH_DOUBLE}), + MapConv("action", mi="5.e.3.p.2", map={1: BUTTON_1_HOLD, 2: BUTTON_2_HOLD, 3: BUTTON_3_HOLD, 4: BUTTON_BOTH_HOLD}), + ] }, { "default": "mesh", # default Mesh device "spec": [