stop using in-container mqtt, but use external one

This commit is contained in:
Dobromir Popov
2023-05-15 13:43:49 +03:00
parent 9d8c3d74c4
commit 3749143faf
2 changed files with 13 additions and 12 deletions

View File

@@ -180,15 +180,16 @@ mqtt_client.on("message", function (topic, message) {
}
if (topic === EspDeviceName + "/ping") {
try {
console.log("MQTT> processing /ping message. Payload:" + context);
//console.log("MQTT> processing /ping message. Payload:" + context);
var data = context.replace(/^\{|\}$/g, '').split('|');
var ip = data[4].replace(/"/g, '');
if (ip != config.gardenIP) {
//console.log("MQTT> /ping got us " + data.length + " data items");
config.gardenIP = ip;
let newConfig = require(configPath);
newConfig[env].gardenIP = ip;
newConfig[env].gardenIP = ip;
fs.writeFileSync(configPath, JSON.stringify(newConfig, null, 2));
handled = true;
console.log("Got NEW reporded garden controller IP: " + ip + ". new value stored in persistent settings storage");
}
} catch (e) {