Skip to content

Commit

Permalink
Fix QBKG03LM, QBKG04LM, QBKG11LM and QBKG12LM reporting click on stat…
Browse files Browse the repository at this point in the history
…e get and fix state get. #1252
  • Loading branch information
Koenkk committed May 23, 2020
1 parent c5ec9a4 commit 94cdc33
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
21 changes: 7 additions & 14 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -1716,13 +1716,11 @@ const converters = {
}
},
},
QBKG04LM_QBKG11LM_state: {
QBKG04LM_QBKG11LM_click: {
cluster: 'genOnOff',
type: ['attributeReport', 'readResponse'],
type: ['attributeReport'],
convert: (model, msg, publish, options, meta) => {
if (msg.data['61440']) {
return {state: msg.data['onOff'] === 1 ? 'ON' : 'OFF'};
} else {
if (!msg.data['61440']) {
return {click: 'single'};
}
},
Expand Down Expand Up @@ -1751,16 +1749,11 @@ const converters = {
}
},
},
QBKG03LM_QBKG12LM_LLKZMK11LM_state: {
QBKG03LM_QBKG12LM_LLKZMK11LM_click: {
cluster: 'genOnOff',
type: ['attributeReport', 'readResponse'],
type: ['attributeReport'],
convert: (model, msg, publish, options, meta) => {
if (msg.data['61440']) {
const key = `state_${getKey(model.endpoint(msg.device), msg.endpoint.ID)}`;
const payload = {};
payload[key] = msg.data['onOff'] === 1 ? 'ON' : 'OFF';
return payload;
} else {
if (!msg.data['61440']) {
const mapping = {4: 'left', 5: 'right', 6: 'both'};
const button = mapping[msg.endpoint.ID];
return {click: button};
Expand Down Expand Up @@ -1803,7 +1796,7 @@ const converters = {
},
QBKG03LM_buttons: {
cluster: 'genOnOff',
type: ['attributeReport', 'readResponse'],
type: ['attributeReport'],
convert: (model, msg, publish, options, meta) => {
const mapping = {4: 'left', 5: 'right'};
const button = mapping[msg.endpoint.ID];
Expand Down
25 changes: 13 additions & 12 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ const devices = [
description: 'Aqara single key wired wall switch without neutral wire. Doesn\'t work as a router and doesn\'t support power meter',
supports: 'release/hold, on/off',
fromZigbee: [
fz.QBKG04LM_QBKG11LM_state, fz.QBKG04LM_buttons,
fz.QBKG04LM_QBKG11LM_operation_mode, fz.ignore_basic_report,
fz.on_off, fz.QBKG04LM_QBKG11LM_click, fz.QBKG04LM_buttons,
fz.QBKG04LM_QBKG11LM_operation_mode,
],
toZigbee: [tz.on_off, tz.xiaomi_switch_operation_mode],
endpoint: (device) => {
Expand All @@ -630,9 +630,8 @@ const devices = [
description: 'Aqara single key wired wall switch',
supports: 'on/off, power measurement',
fromZigbee: [
fz.QBKG04LM_QBKG11LM_state, fz.QBKG11LM_power, fz.QBKG04LM_QBKG11LM_operation_mode,
fz.QBKG11LM_click,
fz.ignore_multistate_report, fz.xiaomi_power,
fz.on_off, fz.QBKG04LM_QBKG11LM_click, fz.QBKG11LM_power, fz.QBKG04LM_QBKG11LM_operation_mode,
fz.QBKG11LM_click, fz.ignore_multistate_report, fz.xiaomi_power,
],
toZigbee: [tz.on_off, tz.xiaomi_switch_operation_mode],
endpoint: (device) => {
Expand All @@ -648,11 +647,11 @@ const devices = [
description: 'Aqara double key wired wall switch without neutral wire. Doesn\'t work as a router and doesn\'t support power meter',
supports: 'release/hold, on/off, temperature',
fromZigbee: [
fz.QBKG03LM_QBKG12LM_LLKZMK11LM_state, fz.QBKG03LM_buttons,
fz.QBKG03LM_QBKG12LM_operation_mode, fz.ignore_basic_report,
fz.generic_device_temperature,
fz.on_off, fz.QBKG03LM_QBKG12LM_LLKZMK11LM_click, fz.QBKG03LM_buttons,
fz.QBKG03LM_QBKG12LM_operation_mode, fz.generic_device_temperature,
],
toZigbee: [tz.on_off, tz.xiaomi_switch_operation_mode],
meta: {multiEndpoint: true},
endpoint: (device) => {
return {'system': 1, 'left': 2, 'right': 3};
},
Expand All @@ -665,9 +664,10 @@ const devices = [
description: 'Aqara double key wired wall switch',
supports: 'on/off, power measurement, temperature',
fromZigbee: [
fz.QBKG03LM_QBKG12LM_LLKZMK11LM_state, fz.QBKG12LM_LLKZMK11LM_power, fz.QBKG03LM_QBKG12LM_operation_mode,
fz.QBKG12LM_click, fz.ignore_multistate_report, fz.xiaomi_power,
fz.on_off, fz.QBKG03LM_QBKG12LM_LLKZMK11LM_click, fz.QBKG12LM_LLKZMK11LM_power,
fz.QBKG03LM_QBKG12LM_operation_mode, fz.QBKG12LM_click, fz.xiaomi_power,
],
meta: {multiEndpoint: true},
toZigbee: [tz.on_off, tz.xiaomi_switch_operation_mode],
endpoint: (device) => {
return {'left': 1, 'right': 2, 'system': 1};
Expand Down Expand Up @@ -948,9 +948,10 @@ const devices = [
description: 'Aqara wireless relay controller',
supports: 'on/off, power measurement',
fromZigbee: [
fz.QBKG03LM_QBKG12LM_LLKZMK11LM_state, fz.QBKG12LM_LLKZMK11LM_power, fz.xiaomi_power,
fz.ignore_multistate_report,
fz.QBKG03LM_QBKG12LM_LLKZMK11LM_click, fz.QBKG12LM_LLKZMK11LM_power, fz.xiaomi_power,
fz.ignore_multistate_report, fz.on_off,
],
meta: {multiEndpoint: true},
toZigbee: [tz.on_off, tz.LLKZMK11LM_interlock],
endpoint: (device) => {
return {'l1': 1, 'l2': 2};
Expand Down

0 comments on commit 94cdc33

Please sign in to comment.