diff --git a/docker-compose.yml b/docker-compose.yml index 3f20685..89abd33 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,13 +10,13 @@ services: - DATABASE_PASS=mitko2021 - GARDEN_IP=0.0.0.0 # - GARDEN_IP=192.168.0.100 - - MQTT_HOST=node-mqtt + - MQTT_HOST=192.168.0.10 - MQTT_PORT_HTTP=1883 - MQTT_PORT_HTTPS=8444 - MQTT_ESP_NAME=Garden depends_on: - node-mysql - - node-mqtt + #- node-mqtt restart: always ports: - 2081:2080 @@ -32,13 +32,13 @@ services: volumes: - iotdbdata:/var/lib/mysql # for mitko:mqtt - node-mqtt: - image: eclipse-mosquitto - command: mosquitto -c /mosquitto-no-auth.conf - hostname: node-mqtt - ports: - - 1885:1883 - - 10883:1883 - restart: always + # node-mqtt: + # image: eclipse-mosquitto + # command: mosquitto -c /mosquitto-no-auth.conf + # hostname: node-mqtt + # ports: + # - 1885:1883 + # - 10883:1883 + # restart: always volumes: iotdbdata: \ No newline at end of file diff --git a/src/mqtt.js b/src/mqtt.js index ba14b90..aa6d947 100644 --- a/src/mqtt.js +++ b/src/mqtt.js @@ -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) {