Skip to content

Commit

Permalink
Debounce SA-003-Zigbee on zclTransactionSequenceNumber. Koenkk/zigbee…
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk authored and Koen Kanters committed Jan 22, 2020
1 parent 3823d5d commit 8401788
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,19 @@ const converters = {
};
},
},
SA003_on_off: {
cluster: 'genOnOff',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const last = store[msg.device.ieeeAddr];
const current = msg.meta.zclTransactionSequenceNumber;

if (last !== current && msg.data.hasOwnProperty('onOff')) {
store[msg.device.ieeeAddr] = last;
return {state: msg.data['onOff'] === 1 ? 'ON' : 'OFF'};
}
},
},
tint404011_scene: {
cluster: 'genBasic',
type: 'write',
Expand Down
2 changes: 1 addition & 1 deletion devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -7015,7 +7015,7 @@ const devices = [
vendor: 'eWeLink',
description: 'Zigbee smart plug',
supports: 'on/off',
fromZigbee: [fz.on_off],
fromZigbee: [fz.SA003_on_off],
toZigbee: [tz.on_off],
meta: {configureKey: 1},
configure: async (device, coordinatorEndpoint) => {
Expand Down

0 comments on commit 8401788

Please sign in to comment.