Skip to content

Commit

Permalink
Update QBKG12LM converters. Koenkk/zigbee2mqtt#117
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Jun 15, 2018
1 parent 5d6e942 commit b25a8bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
23 changes: 18 additions & 5 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,22 @@ const converters = {
},
},
QBKG12LM_power: {
cid: 'genAnalogInput',
cid: 'genBasic',
type: 'attReport',
convert: (model, msg, publish, options) => {
// TODO
console.log('EP', msg.endpoints[0].epId);

const mapping = {4: 'left', 5: 'right'};
const key = `power_${mapping[msg.endpoints[0].epId]}`;
const payload = {};
payload[key] = precisionRound(msg.data.data['presentValue'], 2);
return payload;
if (msg.data.data['65281']) {
const data = msg.data.data['65281'];
const key = mapping[msg.endpoints[0].epId];
const payload = {};
payload[`power_${key}`] = precisionRound(data['152'], 2);
payload[`consumption_${key}`] = precisionRound(data['149'], 2);
payload[`temperature_${key}`] = precisionRound(data['3'], 2);
return payload;
}
},
},
QBKG04LM_QBKG11LM_state: {
Expand Down Expand Up @@ -525,6 +533,11 @@ const converters = {
type: 'devChange',
convert: (model, msg, publish, options) => null,
},
ignore_analog_change: {
cid: 'genAnalogInput',
type: 'attReport',
convert: (model, msg, publish, options) => null,
},
ignore_multistate_report: {
cid: 'genMultistateInput',
type: 'attReport',
Expand Down
4 changes: 2 additions & 2 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ const devices = [
description: 'Aqara double key wired wall switch',
supports: 'left and right on/off, power measurement',
fromZigbee: [
fz.QBKG03LM_QBKG12LM_state, fz.ignore_analog_change, fz.QBKG12LM_power,
fz.ignore_multistate_report, fz.ignore_multistate_change,
fz.QBKG03LM_QBKG12LM_state, fz.QBKG12LM_power, fz.ignore_analog_change, fz.ignore_basic_change,
fz.ignore_multistate_report, fz.ignore_multistate_change, fz.ignore_onoff_change, fz.ignore_analog_change,
],
toZigbee: [tz.onoff],
ep: {'left': 1, 'right': 2},
Expand Down

0 comments on commit b25a8bd

Please sign in to comment.