From ba92f739612930a7dea7f1988de17bf576af2689 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 9 Oct 2019 19:40:46 +0200 Subject: [PATCH] Resolve Coordinator to coordinator. https://github.com/Koenkk/zigbee2mqtt/issues/2100 --- lib/zigbee.js | 2 +- test/deviceBind.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/zigbee.js b/lib/zigbee.js index 77f15324f..e4f22c412 100644 --- a/lib/zigbee.js +++ b/lib/zigbee.js @@ -129,7 +129,7 @@ class Zigbee extends events.EventEmitter { key = key.toString(); } - if (key === 'coordinator') { + if (typeof key === 'string' && key.toLowerCase() === 'coordinator') { const coordinator = this.getDevicesByType('Coordinator')[0]; return { type: 'device', diff --git a/test/deviceBind.test.js b/test/deviceBind.test.js index 0ae9a662b..de6be232c 100644 --- a/test/deviceBind.test.js +++ b/test/deviceBind.test.js @@ -75,7 +75,7 @@ describe('Device bind', () => { const endpoint = device.getEndpoint(1); mockClear(device); endpoint.unbind.mockClear(); - MQTT.events.message('zigbee2mqtt/bridge/unbind/remote', 'coordinator'); + MQTT.events.message('zigbee2mqtt/bridge/unbind/remote', 'Coordinator'); await flushPromises(); expect(endpoint.unbind).toHaveBeenCalledTimes(3); expect(endpoint.unbind).toHaveBeenCalledWith("genOnOff", target);