diff --git a/lib/extension/bind.ts b/lib/extension/bind.ts index c9d26ec9a..763316975 100755 --- a/lib/extension/bind.ts +++ b/lib/extension/bind.ts @@ -469,7 +469,12 @@ export default class Bind extends Extension { const key = `${endpoint.getDevice().ieeeAddr}_${endpoint.ID}_${pollOnMessage.indexOf(poll)}`; if (!this.pollDebouncers[key]) { this.pollDebouncers[key] = debounce(async () => { - await endpoint.read(poll.read.cluster, readAttrs); + try { + await endpoint.read(poll.read.cluster, readAttrs); + } catch (error) { + logger.error(`Failed to poll ${readAttrs} from ` + + `${this.zigbee.resolveEntity(endpoint.getDevice()).name}`); + } }, 1000); } diff --git a/test/bind.test.js b/test/bind.test.js index 1e81d59de..e31365bb8 100644 --- a/test/bind.test.js +++ b/test/bind.test.js @@ -588,6 +588,7 @@ describe('Bind', () => { it('Should poll bounded Hue bulb when receiving message from scene controller', async () => { const remote = zigbeeHerdsman.devices.bj_scene_switch; const data = {"action": "recall_2_row_1"}; + zigbeeHerdsman.devices.bulb_color_2.getEndpoint(1).read.mockImplementationOnce(() => {throw new Error('failed')}); const payload = {data, cluster: 'genScenes', device: remote, endpoint: remote.getEndpoint(10), type: 'commandRecall', linkquality: 10, groupID: 0}; await zigbeeHerdsman.events.message(payload); await flushPromises(); @@ -595,7 +596,7 @@ describe('Bind', () => { expect(debounce).toHaveBeenCalledTimes(3); expect(zigbeeHerdsman.devices.bulb_color_2.getEndpoint(1).read).toHaveBeenCalledWith("genOnOff", ["onOff"]); expect(zigbeeHerdsman.devices.bulb_color_2.getEndpoint(1).read).toHaveBeenCalledWith("genLevelCtrl", ["currentLevel"]); - expect(zigbeeHerdsman.devices.bulb_color_2.getEndpoint(1).read).toHaveBeenCalledWith("lightingColorCtrl", ["currentX", "currentY", "colorTemperature"]); + expect(zigbeeHerdsman.devices.bulb_color_2.getEndpoint(1).read).toHaveBeenCalledWith("lightingColorCtrl", ["currentX", "currentY", "colorTemperature"]); }); it('Should poll grouped Hue bulb when receiving message from TRADFRI remote', async () => {