I am attempting to configure an Aqara/Xiaomi "WXKG11LM Wireless Mini Switch" to toggle a light on and off based on a single click. The device is correctly recognized from the signature string "lumi.remote.b1acn01" and supports the "multi level input property" with four possible values:
1 for a single press
2 for a double press
0 for a long press
255 for release (after a long press)
I have been able to define this device in the zb-xiaomi.js extension file and can build rules based any one of the four values.
The value returned from the device does not change until a different button action is executed, e.g. a single press returns a value of '1' but another single press some time later cannot be detected as the value returned has not changed.
However, I would really like to be able to used a single click to toggle on and off another device rather than having to use a single click to turn on the device and a double-click to turn off the device. If I use value=1 and the present state of the device I am activating (i.e. on/off), the I get the classic flip-flop result reported in issue 694 - and based on the discussion in that posting, I can see that the answer is to use "events" and I can even see that there is code to support "single press", "double press", and "long press" - but cannot see how to define these for my device.
I will keep playing with the configuration, but any assistance on how to define an event would be greatly appreciated.
For information, here is the current configuration of the WXKG11LM:
/
BACKGROUND READING
Property vs. Action vs. EventToggle option for RulesFlip-Flop Implementation? /
'lumi.remote.b1acn01': {
// LUMI WXKG11LM Wireless Mini Switch
// https://www.zigbee2mqtt.io/devices/WXKG11LM.html
// https://github.com/zigbeer/documents/tree/master/zcl-id/clusters/general.md#genMultistateInput
name: 'button',
'@type': ['MultiLevelSwitch'],
description: 'Aqara Wireless Mini Switch',
powerSource: zb_constants_1.POWERSOURCE.BATTERY,
activeEndpoints: {
1: {
profileId: zb_constants_1.PROFILE_ID.ZHA_HEX,
inputClusters: [
zb_constants_1.CLUSTER_ID.GENBASIC_HEX,
zb_constants_1.CLUSTER_ID.GENMULTISTATEINPUT_HEX, // 0x0012 (18)
],
outputClusters: [],
},
},
properties: {
press: {
description: 'Aqara Wireless Mini Switch - vaue returned',
descr: {
'@type': 'MultilevelInputProperty',
label: 'Value returned',
type: 'integer',
enum: [0,1,2,255],
readOnly: true,
},
profileId: zb_constants_1.PROFILE_ID.ZHA,
endpoint: 1,
clusterId: zb_constants_1.CLUSTER_ID.GENMULTISTATEINPUT,
attr: 'presentValue', // 0x055 (81)
value: '',
parseValueFromAttr: 'parseNumericAttr',
},
},
},
I am attempting to configure an Aqara/Xiaomi "WXKG11LM Wireless Mini Switch" to toggle a light on and off based on a single click. The device is correctly recognized from the signature string "lumi.remote.b1acn01" and supports the "multi level input property" with four possible values:
I have been able to define this device in the zb-xiaomi.js extension file and can build rules based any one of the four values.
The value returned from the device does not change until a different button action is executed, e.g. a single press returns a value of '1' but another single press some time later cannot be detected as the value returned has not changed.
However, I would really like to be able to used a single click to toggle on and off another device rather than having to use a single click to turn on the device and a double-click to turn off the device. If I use value=1 and the present state of the device I am activating (i.e. on/off), the I get the classic flip-flop result reported in issue 694 - and based on the discussion in that posting, I can see that the answer is to use "events" and I can even see that there is code to support "single press", "double press", and "long press" - but cannot see how to define these for my device.
I will keep playing with the configuration, but any assistance on how to define an event would be greatly appreciated.
For information, here is the current configuration of the WXKG11LM: / BACKGROUND READING Property vs. Action vs. Event Toggle option for Rules Flip-Flop Implementation?
/ 'lumi.remote.b1acn01': { // LUMI WXKG11LM Wireless Mini Switch // https://www.zigbee2mqtt.io/devices/WXKG11LM.html // https://github.com/zigbeer/documents/tree/master/zcl-id/clusters/general.md#genMultistateInput name: 'button', '@type': ['MultiLevelSwitch'], description: 'Aqara Wireless Mini Switch', powerSource: zb_constants_1.POWERSOURCE.BATTERY, activeEndpoints: { 1: { profileId: zb_constants_1.PROFILE_ID.ZHA_HEX, inputClusters: [ zb_constants_1.CLUSTER_ID.GENBASIC_HEX, zb_constants_1.CLUSTER_ID.GENMULTISTATEINPUT_HEX, // 0x0012 (18) ], outputClusters: [], }, }, properties: { press: { description: 'Aqara Wireless Mini Switch - vaue returned', descr: { '@type': 'MultilevelInputProperty', label: 'Value returned', type: 'integer', enum: [0,1,2,255], readOnly: true, }, profileId: zb_constants_1.PROFILE_ID.ZHA, endpoint: 1, clusterId: zb_constants_1.CLUSTER_ID.GENMULTISTATEINPUT, attr: 'presentValue', // 0x055 (81) value: '', parseValueFromAttr: 'parseNumericAttr', }, }, },