From 414cf1f9ac38976f15944108a6fc6ba7a73ab234 Mon Sep 17 00:00:00 2001 From: nicandris Date: Sat, 12 Sep 2020 12:59:51 +0200 Subject: [PATCH] added support for Aqara button WXKG12LM --- tasmota/xdrv_23_zigbee_5_converters.ino | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index e70e6702d..5e3140afd 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -1494,7 +1494,7 @@ void ZCLFrame::syntheticAqaraCubeOrButton(class Z_attribute_list &attr_list, cla // presentValue = x + 128 = 180ยบ flip to side x on top // presentValue = x + 256 = push/slide cube while side x is on top // presentValue = x + 512 = double tap while side x is on top - } else if (modelId.startsWith(F("lumi.remote"))) { // only for Aqara button + } else if (modelId.startsWith(F("lumi.remote"))) { // only for Aqara button WXKG11LM int32_t val = attr.getInt(); const __FlashStringHelper *aqara_click = F("click"); const __FlashStringHelper *aqara_action = F("action"); @@ -1516,6 +1516,31 @@ void ZCLFrame::syntheticAqaraCubeOrButton(class Z_attribute_list &attr_list, cla attr_list.addAttribute(aqara_click).setUInt(val); break; } + } else if (modelId.startsWith(F("lumi.sensor_switch"))) { // only for Aqara button WXKG12LM + int32_t val = attr.getInt(); + const __FlashStringHelper *aqara_click = F("click"); + const __FlashStringHelper *aqara_action = F("action"); + + switch (val) { + case 1: + attr_list.addAttribute(aqara_click).setStr(PSTR("single")); + break; + case 2: + attr_list.addAttribute(aqara_click).setStr(PSTR("double")); + break; + case 16: + attr_list.addAttribute(aqara_action).setStr(PSTR("hold")); + break; + case 17: + attr_list.addAttribute(aqara_action).setStr(PSTR("release")); + break; + case 18: + attr_list.addAttribute(aqara_action).setStr(PSTR("shake")); + break; + default: + attr_list.addAttribute(aqara_click).setUInt(val); + break; + } } }