Fix homeassistant discover crash when device undefined.

This commit is contained in:
Koen Kanters
2018-04-25 21:34:26 +02:00
parent a13080f399
commit 875ca536e0
+3 -1
View File
@@ -36,7 +36,9 @@ class Controller {
if (settings.get().homeassistant) {
// MQTT discovery of all paired devices on startup.
this.zigbee.getAllClients().forEach((device) => {
homeassistant.discover(device.ieeeAddr, deviceMapping[device.modelId].homeassistant, this.mqtt);
if (deviceMapping[device.modelId]) {
homeassistant.discover(device.ieeeAddr, deviceMapping[device.modelId].homeassistant, this.mqtt);
}
});
}