Skip to content

Commit

Permalink
Poll lamps with Philips, Atmel, Gledopto, Mueller-Licht manufacturer …
Browse files Browse the repository at this point in the history
…codes (#5139)

* Poll lamps with Philips or Atmel manufacturer code

* Fixes incorrect test

Following up on #2122 (comment)

* Adds GLEDOPTO_CO_LTD and MUELLER_LICHT_INT to lamp polling
  • Loading branch information
pedrolamas authored Nov 30, 2020
1 parent b1b134f commit 8b50897
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions lib/extension/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ const pollOnMessage = [
},
// Read the following attributes
read: {cluster: 'genLevelCtrl', attributes: ['currentLevel']},
// When the bound devices/members of group have the following manufacturerID
manufacturerID: ZigbeeHerdsman.Zcl.ManufacturerCode.Philips,
// When the bound devices/members of group have the following manufacturerIDs
manufacturerIDs: [
ZigbeeHerdsman.Zcl.ManufacturerCode.Philips,
ZigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
ZigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
ZigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
],
},
{
key: 2,
Expand All @@ -98,7 +103,12 @@ const pollOnMessage = [
],
},
read: {cluster: 'genOnOff', attributes: ['onOff']},
manufacturerID: ZigbeeHerdsman.Zcl.ManufacturerCode.Philips,
manufacturerIDs: [
ZigbeeHerdsman.Zcl.ManufacturerCode.Philips,
ZigbeeHerdsman.Zcl.ManufacturerCode.ATMEL,
ZigbeeHerdsman.Zcl.ManufacturerCode.GLEDOPTO_CO_LTD,
ZigbeeHerdsman.Zcl.ManufacturerCode.MUELLER_LICHT_INT,
],
},
];

Expand Down Expand Up @@ -264,7 +274,7 @@ class Report extends Extension {

for (const endpoint of toPoll) {
for (const poll of polls) {
if (poll.manufacturerID !== endpoint.getDevice().manufacturerID) {
if (!poll.manufacturerIDs.includes(endpoint.getDevice().manufacturerID)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion test/report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ describe('Report', () => {
expect(zigbeeHerdsman.devices.bulb_color_2.getEndpoint(1).read).toHaveBeenCalledTimes(2);

// Should only call Hue bulb, not e.g. tradfri
expect(zigbeeHerdsman.devices.bulb.getEndpoint(1).read).toHaveBeenCalledTimes(0);
expect(zigbeeHerdsman.devices.bulb_2.getEndpoint(1).read).toHaveBeenCalledTimes(0);
});

it('Should not configure reporting for the ZNLDP12LM closuresWindowCovering as it is ignored', async () => {
Expand Down

0 comments on commit 8b50897

Please sign in to comment.