Support WXKG11LM. #4

This commit is contained in:
Koen Kanters 2018-04-19 22:45:53 +02:00
parent 3133cb7dae
commit c49b3f4ae3
3 changed files with 41 additions and 7 deletions

View File

@ -1,4 +1,5 @@
const clickLookup = {
1: 'single',
2: 'double',
3: 'triple',
4: 'quadruple',
@ -25,7 +26,7 @@ const store = {}
const parsers = [
{
devices: ['WXKG01LM', 'RTCGQ01LM', 'WSDCGQ01LM', 'MCCGQ01LM'],
devices: ['WXKG01LM', 'RTCGQ01LM', 'WSDCGQ01LM', 'MCCGQ01LM', 'WXKG11LM'],
cid: 'genBasic',
type: 'attReport',
disablePublish: true,
@ -124,6 +125,39 @@ const parsers = [
type: 'devChange',
convert: (msg) => {return {color_temp: msg.data.data['colorTemperature']}},
},
{
devices: ['WXKG11LM'],
cid: 'genOnOff',
type: 'attReport',
convert: (msg, publish) => {
const data = msg.data.data;
let clicks;
if (data.onOff) {
clicks = 1;
} else if (data['32768']) {
clicks = data['32768'];
}
if (clickLookup[clicks]) {
return {click: clickLookup[clicks]};
}
}
},
// Ignore parsers (these message dont need parsing).
{
devices: ['WXKG11LM'],
cid: 'genOnOff',
type: 'devChange',
convert: () => null
},
{
devices: ['WXKG11LM'],
cid: 'genBasic',
type: 'devChange',
convert: () => null
},
];
module.exports = parsers;

View File

@ -35,6 +35,12 @@ const devices = {
description: 'Hue Go',
supports: 'on/off, brightness, color temperature, color rgb',
},
'lumi.sensor_switch.aq2': {
model: 'WXKG11LM',
vendor: 'Xiaomi',
description: 'Aqara wireless switch',
supports: 'single, double, triple, quadruple click',
},
}
module.exports = devices;

View File

@ -4,12 +4,6 @@
*/
const plannedToSupport = [
{
model: 'WXKG11LM',
description: 'Aqara wireless switch',
supports: '-',
vendor: 'Xiaomi',
},
{
model: 'WSDCGQ11LM',
description: 'Aqara temperature & humidity sensor',