stop using in-container mqtt, but use external one
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user