diff --git a/server/services/zigbee2mqtt/lib/handleMqttMessage.js b/server/services/zigbee2mqtt/lib/handleMqttMessage.js index b26043a519..7e3164da14 100644 --- a/server/services/zigbee2mqtt/lib/handleMqttMessage.js +++ b/server/services/zigbee2mqtt/lib/handleMqttMessage.js @@ -28,6 +28,8 @@ async function handleMqttMessage(topic, message) { devices // Remove Coordinator + .filter((d) => d.type !== 'Coordinator') + // Keep only supported devices from zigbee2mqtt library .filter((d) => d.supported) .forEach((device) => { this.discoveredDevices[device.friendly_name] = device; diff --git a/server/test/services/zigbee2mqtt/lib/handleMqttMessage.test.js b/server/test/services/zigbee2mqtt/lib/handleMqttMessage.test.js index 69f172c062..d18ec2ebc8 100644 --- a/server/test/services/zigbee2mqtt/lib/handleMqttMessage.test.js +++ b/server/test/services/zigbee2mqtt/lib/handleMqttMessage.test.js @@ -68,7 +68,7 @@ describe('zigbee2mqtt handleMqttMessage', () => { }); }); - it('should receive devices', async () => { + it('should receive devices, exclude unsupported and coordinator', async () => { // PREPARE stateManagerGetStub = sinon.stub(); stateManagerGetStub diff --git a/server/test/services/zigbee2mqtt/lib/payloads/mqtt_devices_get.json b/server/test/services/zigbee2mqtt/lib/payloads/mqtt_devices_get.json index 7ed443deac..f40dafffa7 100644 --- a/server/test/services/zigbee2mqtt/lib/payloads/mqtt_devices_get.json +++ b/server/test/services/zigbee2mqtt/lib/payloads/mqtt_devices_get.json @@ -24,7 +24,7 @@ "interview_completed": true, "interviewing": false, "network_address": 0, - "supported": false, + "supported": true, "type": "Coordinator" }, { @@ -319,5 +319,36 @@ "software_build_id": "3000-0001", "supported": true, "type": "EndDevice" + }, + { + "date_code": "20181129", + "definition": null, + "endpoints": { + "1": { + "bindings": [], + "clusters": { + "input": [ + "genBasic", + "genIdentify", + "msTemperatureMeasurement", + "msPressureMeasurement", + "msRelativeHumidity" + ], + "output": ["genBasic", "genGroups"] + }, + "configured_reportings": [] + } + }, + "friendly_name": "0x23158d00045b2740", + "ieee_address": "0x23158d00045b2740", + "interview_completed": true, + "interviewing": false, + "manufacturer": "Lidl", + "model_id": "ZNCZ02LM", + "network_address": 23007, + "power_source": "Battery", + "software_build_id": "3000-0001", + "supported": false, + "type": "EndDevice" } ]