mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-27 21:20:03 +00:00
Fix crash when deviceSettings are missing.
This commit is contained in:
+4
-3
@@ -612,16 +612,17 @@ class Controller {
|
||||
}
|
||||
|
||||
const deviceSettings = settings.getDevice(deviceID);
|
||||
const friendlyName = deviceSettings ? deviceSettings.friendly_name : deviceID;
|
||||
const options = {
|
||||
retain: deviceSettings.retain,
|
||||
qos: deviceSettings.qos ? deviceSettings.qos : 0,
|
||||
retain: deviceSettings ? deviceSettings.retain : false,
|
||||
qos: deviceSettings && deviceSettings.qos ? deviceSettings.qos : 0,
|
||||
};
|
||||
|
||||
if (appSettings.mqtt.include_device_information) {
|
||||
messagePayload.device = this.getDeviceInfoForMqtt(device);
|
||||
}
|
||||
|
||||
this.mqtt.publish(deviceSettings.friendly_name, JSON.stringify(messagePayload), options);
|
||||
this.mqtt.publish(friendlyName, JSON.stringify(messagePayload), options);
|
||||
}
|
||||
|
||||
startupLogVersion(callback) {
|
||||
|
||||
Reference in New Issue
Block a user