merged together the 2 aqara buttons

This commit is contained in:
nicandris 2020-09-12 13:10:35 +02:00
parent 414cf1f9ac
commit a951a38d39
1 changed files with 4 additions and 20 deletions

View File

@ -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 WXKG11LM
} else if (modelId.startsWith(F("lumi.remote")) || modelId.startsWith(F("lumi.sensor_switch"))) { // only for Aqara buttons WXKG11LM & WXKG12LM
int32_t val = attr.getInt();
const __FlashStringHelper *aqara_click = F("click");
const __FlashStringHelper *aqara_action = F("action");
@ -1503,25 +1503,6 @@ void ZCLFrame::syntheticAqaraCubeOrButton(class Z_attribute_list &attr_list, cla
case 0:
attr_list.addAttribute(aqara_action).setStr(PSTR("hold"));
break;
case 1:
attr_list.addAttribute(aqara_click).setStr(PSTR("single"));
break;
case 2:
attr_list.addAttribute(aqara_click).setStr(PSTR("double"));
break;
case 255:
attr_list.addAttribute(aqara_click).setStr(PSTR("release"));
break;
default:
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;
@ -1537,6 +1518,9 @@ void ZCLFrame::syntheticAqaraCubeOrButton(class Z_attribute_list &attr_list, cla
case 18:
attr_list.addAttribute(aqara_action).setStr(PSTR("shake"));
break;
case 255:
attr_list.addAttribute(aqara_action).setStr(PSTR("release"));
break;
default:
attr_list.addAttribute(aqara_click).setUInt(val);
break;