diff --git a/lib/converters/zigbee2mqtt.js b/lib/converters/zigbee2mqtt.js index 65d143d398..d5eb3ca624 100644 --- a/lib/converters/zigbee2mqtt.js +++ b/lib/converters/zigbee2mqtt.js @@ -10,6 +10,12 @@ const battery = { max: 3000, } +const WXKG02LM = { + 1: 'left', + 2: 'right', + 3: 'both', +}; + const toPercentage = (value, min, max) => { if (value > max) { value = max; @@ -156,7 +162,13 @@ const parsers = [ type: 'attReport', convert: (msg) => {return {pressure: msg.data.data['measuredValue']}} }, - + { + devices: ['WXKG02LM'], + cid: 'genOnOff', + type: 'attReport', + convert: (msg) => {return {click: WXKG02LM[msg.endpoints[0].epId]}} + }, + // Ignore parsers (these message dont need parsing). { diff --git a/lib/devices.js b/lib/devices.js index 9b6fe8443e..7e7ba48368 100644 --- a/lib/devices.js +++ b/lib/devices.js @@ -82,6 +82,15 @@ const homeassistant = { json_attributes: ['battery'], } }, + 'sensor_button': { + type: 'sensor', + object_id: 'button', + discovery_payload: { + icon: 'mdi:toggle-switch', + value_template: '{{ value_json.click }}', + json_attributes: ['battery'], + } + } }; const devices = { @@ -97,6 +106,13 @@ const devices = { description: 'Aqara wireless switch', supports: 'single, double, triple, quadruple click', }, + 'lumi.sensor_86sw2\u0000Un': { + model: 'WXKG02LM', + vendor: 'Xiaomi', + description: 'Aqara double key wireless wall switch', + supports: 'left, right and both click', + homeassistant: [homeassistant.sensor_button] + }, 'lumi.sens': { model: 'WSDCGQ01LM', vendor: 'Xiaomi', diff --git a/support/docgen.js b/support/docgen.js index 8d36c2837d..c3f78c8d77 100644 --- a/support/docgen.js +++ b/support/docgen.js @@ -22,12 +22,6 @@ const plannedToSupport = [ supports: '-', vendor: 'Xiaomi', }, - { - model: 'WXKG02LM', - description: 'Aqara double key wireless wall switch', - supports: '-', - vendor: 'Xiaomi', - }, { model: 'QBKG11LM', description: 'Aqara single key wired wall switch',