Support WXKG02LM. #4

This commit is contained in:
Koen Kanters 2018-04-21 13:01:57 +02:00
parent 5b52defe9e
commit 4d3d15f5b9
3 changed files with 29 additions and 7 deletions

View File

@ -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).
{

View File

@ -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',

View File

@ -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',