Skip to content

Commit

Permalink
Support WXKG02LM. Koenkk#4
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Apr 21, 2018
1 parent 46a57db commit 6053ec8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
14 changes: 13 additions & 1 deletion lib/converters/zigbee2mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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).
{
Expand Down
16 changes: 16 additions & 0 deletions lib/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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',
Expand Down
6 changes: 0 additions & 6 deletions support/docgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 6053ec8

Please sign in to comment.