diff --git a/lib/zbDeviceEvent.js b/lib/zbDeviceEvent.js index e6e1a3b1..47d7e21a 100644 --- a/lib/zbDeviceEvent.js +++ b/lib/zbDeviceEvent.js @@ -36,11 +36,22 @@ class DeviceEvent extends BaseExtension { async callOnEvent(device, type, data, mappedDevice) { if (!mappedDevice) { - mappedDevice = await zigbeeHerdsmanConverters.findByDevice(device); + try { + mappedDevice = await zigbeeHerdsmanConverters.findByDevice(device); + } + catch (error) { + this.log.error(`onEvent: unable to find mapped device for ${JSON.stringify(device)} `); + return; + } } if (mappedDevice && mappedDevice.onEvent) { - mappedDevice.onEvent(type, data, device,mappedDevice.options,'{}'); + try { + mappedDevice.onEvent(type, data, device,mappedDevice.options,'{}'); + } + catch (error) { + this.log.error(`onEvent for ${JSON.stringify(device)} failed with error ${error.message}`); + } } } }