diff --git a/lib/controller.js b/lib/controller.js index 84899103f..dc651a90c 100644 --- a/lib/controller.js +++ b/lib/controller.js @@ -412,7 +412,19 @@ class Controller { } // Find ep for this device - const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(this.zigbee.getDevice(deviceID).modelId); + const device = this.zigbee.getDevice(deviceID); + if (!device) { + logger.error(`Failed to find device with deviceID ${deviceID}`); + return; + } + + const mappedModel = zigbeeShepherdConverters.findByZigbeeModel(device.modelId); + if (!mappedModel) { + logger.warn(`Device with modelID '${device.modelId}' is not supported.`); + logger.warn(`Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices`); + return; + } + const ep = mappedModel.ep && mappedModel.ep[topicPrefix] ? mappedModel.ep[topicPrefix] : null; const published = [];