mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-22 02:29:55 +00:00
MQTT publish log message when new device connects. #77
This commit is contained in:
@@ -200,6 +200,7 @@ class Controller {
|
||||
if (!settings.getDevice(device.ieeeAddr)) {
|
||||
logger.info(`New device with address ${device.ieeeAddr} connected!`);
|
||||
settings.addDevice(device.ieeeAddr);
|
||||
this.mqttLog('device_connected', device.ieeeAddr);
|
||||
}
|
||||
|
||||
// We can't handle devices without modelId.
|
||||
@@ -367,6 +368,11 @@ class Controller {
|
||||
|
||||
this.mqtt.publish(deviceSettings.friendly_name, JSON.stringify(payload), options);
|
||||
}
|
||||
|
||||
mqttLog(type, message) {
|
||||
const payload = {type: type, message: message};
|
||||
this.mqtt.publish('bridge/log', JSON.stringify(payload), {retain: false});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Controller;
|
||||
|
||||
Reference in New Issue
Block a user