esp8266 Save() mqtt problem

Posted on
  • Hey everyone.

    Having some issues with my nodemcu development board. Im afraid it could be a hardware issue (the esp8266 gets really hot).

    Everything works when its freshly sent to the device but as soon as i reconnect the mqtt connection bugs out.

    Working:

    >save()
    =undefined
    Compacting Flash...
    Calculating Size...
    Writing..
    CRunning onInit()...
    Connecting to WiFi
    connected? err= null info= {
      "ip": "192.168.1.22",
      "netmask": "255.255.255.0",
      "gw": "192.168.1.1",
      "mac": "ec:fa:bc:07:d5:27"
     }
    MQTT connected
    > 
    

    After reboot

    connected? err= null info= {
      "ip": "192.168.1.22",
      "netmask": "255.255.255.0",
      "gw": "192.168.1.1",
      "mac": "ec:fa:bc:07:d5:27"
     }
    MQTT connected
    MQTT disconnected... reconnecting.
    MQTT connected
    MQTT disconnected... reconnecting.
    

    Sometimes there is an Memoy error:

    Execution Interrupted during event processing.
    New interpreter error: MEMORY
    

    Le codes:

    var WIFI_NAME = "Girl Scout Cookies 2,4Ghz";
    var WIFI_KEY = "";
    var MQTT_HOST = "192.168.1.200";
    var PATH = "/garden/";
    var DEVICE = "roland";
    var mqtt;
    var wifi;
    
    // Mqtt Connection 
    function mqttConnect() {
      mqtt = require("MQTT").connect({
        host: MQTT_HOST,
      });
      mqtt.on('connected', function() {
        console.log("MQTT connected");
        // subscribe to wildcard for our name
        mqtt.subscribe(PATH+"#");
      });
      mqtt.on('publish', mqttMessage);
      mqtt.on('disconnected', function() {
        console.log("MQTT disconnected... reconnecting.");
        setTimeout(function() {
          mqtt.connect();
        }, 1000);
      });
    }
    function mqttMessage(pub) {
      console.log("MQTT=> ",pub.topic,pub.message);
    }
    
    
    function onInit(){
    console.log("Connecting to WiFi");
    wifi = require("Wifi");
    wifi.connect(WIFI_NAME, {password:WIFI_KEY}, function(err){
      console.log("connected? err=", err, "info=", wifi.getIP());
      mqttConnect();
      });
    }
    
    

    I have tried different firmwares both 1.95 and 1.96
    No diff.

    Any thoughts?

About

esp8266 Save() mqtt problem

Posted by Avatar for Gustav @Gustav

Actions