From 891e4ebf71a9e3bcc791a35a97df8f77ea4ed9ad Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 22 Apr 2024 21:40:38 +0800 Subject: [PATCH 1/3] add support for device linp.remote.k9b11, linp.switch.qt1db1, linp.switch.qt1db2, linp.switch.qt1db3, linp.switch.qt1db4 --- .../xiaomi_gateway3/core/devices.py | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index 813c7e9e..00ac23e0 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -1515,6 +1515,23 @@ MathConv("humidity", mi="3.p.1008", round=1), BaseConv("battery", mi="2.p.1003"), ], +}, { + # linp.remote.k9b11 + 5481: ["Linptech", "Wireless Button", "k9b11"], + "spec": [ + # mibeacon2 spec + BLEMapConv("action", "sensor", mi=4097, map={"000000": BUTTON_1_SINGLE, "000001": BUTTON_1_DOUBLE, "000002": BUTTON_1_HOLD, "010000": BUTTON_2_SINGLE, "010001": BUTTON_2_DOUBLE, "010002": BUTTON_2_HOLD}), + BLEByteConv("battery", "sensor", mi=18435, entity=ENTITY_LAZY), # uint8 + # miot spec + ConstConv("action", mi="2.e.1.p.1", value=BUTTON_1_SINGLE), + ConstConv("action", mi="2.e.2.p.1", value=BUTTON_1_DOUBLE), + ConstConv("action", mi="2.e.3.p.1", value=BUTTON_1_HOLD), + ConstConv("action", mi="4.e.1.p.1", value=BUTTON_2_SINGLE), + ConstConv("action", mi="4.e.2.p.1", value=BUTTON_2_DOUBLE), + ConstConv("action", mi="4.e.3.p.1", value=BUTTON_2_HOLD), + BaseConv("battery", mi="3.p.1003"), + ], + # "ttl": "6h" # battery every 6 hours }, { 6473: ["Yeelight", "Double Button", "XMWXKG01YL", "yeelink.remote.contrl"], "spec": [ @@ -2620,6 +2637,61 @@ ConstConv("action", mi="7.e.1", value=BUTTON_1_SINGLE), ConstConv("action", mi="7.e.2", value=BUTTON_2_SINGLE), ], +}, { + 15658: ["Linptech", "Single Wall Switch QT1", "linp.switch.qt1db1"], + "spec": [ + BaseConv("channel_1", "switch", mi="2.p.1"), + BoolConv("wireless_1", "switch", mi="2.p.2"), + BaseConv("led", "switch", mi="11.p.1"), + BaseConv("action", "sensor"), + MapConv("touch", "select", mi="12.p.1", map={0: "Off", 1: "Low", 2:"Medium", 3:"High"}), + ConstConv("action", mi="3.e.1", value=BUTTON_SINGLE), + ], +}, { + 15659: ["Linptech", "Double Wall Switch QT1", "linp.switch.qt1db2"], + "spec": [ + BaseConv("channel_1", "switch", mi="2.p.1"), + BaseConv("channel_2", "switch", mi="3.p.1"), + BoolConv("wireless_1", "switch", mi="2.p.2"), + BoolConv("wireless_2", "switch", mi="3.p.2"), + BaseConv("led", "switch", mi="11.p.1"), + BaseConv("action", "sensor"), + MapConv("touch", "select", mi="12.p.1", map={0: "Off", 1: "Low", 2:"Medium", 3:"High"}), + ConstConv("action", mi="4.e.1", value=BUTTON_1_SINGLE), + ConstConv("action", mi="5.e.1", value=BUTTON_2_SINGLE), + ], +}, { + 15660: ["Linptech", "Triple Wall Switch QT1", "linp.switch.qt1db3"], + "spec": [ + BaseConv("channel_1", "switch", mi="2.p.1"), + BaseConv("channel_2", "switch", mi="3.p.1"), + BaseConv("channel_3", "switch", mi="4.p.1"), + BoolConv("wireless_1", "switch", mi="2.p.2"), + BoolConv("wireless_2", "switch", mi="3.p.2"), + BoolConv("wireless_3", "switch", mi="4.p.2"), + BaseConv("led", "switch", mi="11.p.1"), + BaseConv("action", "sensor"), + MapConv("touch", "select", mi="12.p.1", map={0: "Off", 1: "Low", 2:"Medium", 3:"High"}), + ConstConv("action", mi="5.e.1", value=BUTTON_1_SINGLE), + ConstConv("action", mi="6.e.1", value=BUTTON_2_SINGLE), + ConstConv("action", mi="7.e.1", value=BUTTON_3_SINGLE), + ], +}, { + 15661: ["Linptech", "Quadruple Wall Switch QT1", "linp.switch.qt1db4"], + "spec": [ + BaseConv("channel_1", "switch", mi="2.p.1"), + BaseConv("channel_2", "switch", mi="3.p.1"), + BaseConv("channel_3", "switch", mi="4.p.1"), + BaseConv("channel_4", "switch", mi="5.p.1"), + BoolConv("wireless_1", "switch", mi="2.p.2"), + BoolConv("wireless_2", "switch", mi="3.p.2"), + BoolConv("wireless_3", "switch", mi="4.p.2"), + BoolConv("wireless_4", "switch", mi="5.p.2"), + BaseConv("led", "switch", mi="11.p.1"), + BaseConv("action", "sensor"), + MapConv("action", mi="6.e.1.p.1", map={1: BUTTON_1_SINGLE, 2: BUTTON_2_SINGLE, 3: BUTTON_3_SINGLE, 4: BUTTON_4_SINGLE}), + MapConv("touch", "select", mi="12.p.1", map={0: "Off", 1: "Low", 2:"Medium", 3:"High"}), + ], }, { 2274: ["Linptech", "Lingpu Triple Wall Switch", "linp.switch.q3s3"], "spec": [ From de69fc05f77d44f2ee6a68fb9102a55f2159267c Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 22 Apr 2024 22:22:59 +0800 Subject: [PATCH 2/3] fix for device linp.remote.k9b11 --- custom_components/xiaomi_gateway3/core/devices.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index 00ac23e0..ff2a7d80 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -1523,12 +1523,12 @@ BLEMapConv("action", "sensor", mi=4097, map={"000000": BUTTON_1_SINGLE, "000001": BUTTON_1_DOUBLE, "000002": BUTTON_1_HOLD, "010000": BUTTON_2_SINGLE, "010001": BUTTON_2_DOUBLE, "010002": BUTTON_2_HOLD}), BLEByteConv("battery", "sensor", mi=18435, entity=ENTITY_LAZY), # uint8 # miot spec - ConstConv("action", mi="2.e.1.p.1", value=BUTTON_1_SINGLE), - ConstConv("action", mi="2.e.2.p.1", value=BUTTON_1_DOUBLE), - ConstConv("action", mi="2.e.3.p.1", value=BUTTON_1_HOLD), - ConstConv("action", mi="4.e.1.p.1", value=BUTTON_2_SINGLE), - ConstConv("action", mi="4.e.2.p.1", value=BUTTON_2_DOUBLE), - ConstConv("action", mi="4.e.3.p.1", value=BUTTON_2_HOLD), + ConstConv("action", mi="2.e.1", value=BUTTON_1_SINGLE), + ConstConv("action", mi="2.e.2", value=BUTTON_1_DOUBLE), + ConstConv("action", mi="2.e.3", value=BUTTON_1_HOLD), + ConstConv("action", mi="4.e.1", value=BUTTON_2_SINGLE), + ConstConv("action", mi="4.e.2", value=BUTTON_2_DOUBLE), + ConstConv("action", mi="4.e.3", value=BUTTON_2_HOLD), BaseConv("battery", mi="3.p.1003"), ], # "ttl": "6h" # battery every 6 hours From e1c17930467187adc9c2771b139f87ba00de112a Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 22 Apr 2024 22:47:09 +0800 Subject: [PATCH 3/3] fix for device linp.switch.qt1db1 switch naming --- custom_components/xiaomi_gateway3/core/devices.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index ff2a7d80..bf5aefea 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -2640,8 +2640,8 @@ }, { 15658: ["Linptech", "Single Wall Switch QT1", "linp.switch.qt1db1"], "spec": [ - BaseConv("channel_1", "switch", mi="2.p.1"), - BoolConv("wireless_1", "switch", mi="2.p.2"), + BaseConv("switch", "switch", mi="2.p.1"), + BoolConv("wireless", "switch", mi="2.p.2"), BaseConv("led", "switch", mi="11.p.1"), BaseConv("action", "sensor"), MapConv("touch", "select", mi="12.p.1", map={0: "Off", 1: "Low", 2:"Medium", 3:"High"}),