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);