• Hi @user79559,

    • first you connect over serial with baud rate 1152000 COM14

    Device found {"bitrate":115200,"bufferSize":4096,"con­nectionId":5,"ctsFlowControl":false,"dat­aBits":"eight","name":"","parityBit":"no­","paused":true,"persistent":false,"rece­iveTimeout":0,"sendTimeout":0,"stopBits"­:"one"}
    [success] Connected to .\COM14
    Connected to .\COM14

    • send some code

    Found a prompt... great!

    Sending...
    ---> "\u0010reset();\n\u0010var ESP8266 = require(\"ESP8266\"),\u001b\n wifi = require(\"Wifi\");\n\u0010\u001b[4dfunct­ion onInit() {\u001b\n wifi.connect(\"LP82K1\", {password: \"excitedboat325\"}, function(err) {\u001b\n if(err)console.log(err);else {\u001b\n console.log(\"wifi connected!\");//116\u001b\n print(wifi.getIP().ip);\u001b\n\u001b\n }\u001b\n });\u001b\n}\n\n"
    Splitting for reset(), delay 250
    Sent
    Disconnect callback...
    WARNING: [notify_warn] Disconnected
    Disconnected
    Connecting...
    Set Slow Write = true
    Connected [object Object]

    • try to connect via telnet

    Device found {"socketId":5}
    [success] Connected to TCP/IP: 192.168.0.121:23 (No response from board)

    Connected to TCP/IP: 192.168.0.121:23 (No response from board)

    Please share what you try to achieve, so someone might point you to documents or code snippets to support you.

  • var settings_pol = 20;
    var settings_kondey = 24;
    var last_temp = 0;
    var temp_pol = 0;
    var dalas = setInterval(function() {
       require("DS18B20").connect(new OneWire(D13)).getTemp(function (temp) {
        print("Temp is "+temp+"°C");
        if(temp!==null){
        if(temp<settings_pol)digitalWrite(D14, true);
        if(temp>settings_pol)digitalWrite(D14, false);
          temp_pol = temp;
        } else digitalWrite(D14, false);
      });
    }, 10000);
     function start_sensor(){
    var dht_senso = setInterval(function() {
      require("DHT22").connect(D12).read(function (a) {
        print("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString());
        if(a.temp != -1){
        if(a.temp>(settings_kondey+0.3))digitalWrite(D4, true);
        if(a.temp<settings_kondey)digitalWrite(D4, false);
    
         // if(a.temp!=last_temp){
          setTimeout(function () { mqtt.publish("test", "{\"temp\":"+a.temp+",\"hum\":"+a.rh+",\"temp_pol\":"+temp_pol+",\"settings_kondey\":"+settings_kondey+",\"settings_pol\":"+settings_pol+"}");},1000);
         //   last_temp = a.temp;
         // }
        }else digitalWrite(D4, false);
      });
    }, 5000);
    }
    var server = "192.168.0.182"; // the ip of your MQTT broker
      var options = { // ALL OPTIONAL - the defaults are below
        client_id : "random",   // the client ID sent to MQTT - it's a good idea to define your own static one based on `getSerial()`
        keep_alive: 60,         // keep alive time in seconds
        port: 1883,             // port number
        clean_session: true,
        //username: "home",   // default is undefined
        //password: "789456",   // default is undefined
        protocol_name: "MQTT",  // or MQIsdp, etc..
        protocol_level: 4,      // protocol level
      };
      var mqtt = require("MQTT").create(server, options /*optional*/);
    function reboot(){
     print("reboot...");
     ESP8266.reboot();
    }
    var ESP8266 = require("ESP8266"),
         wifi = require("Wifi");
    //var ssid = "Electrolux";
    //var options = {password: "12345678"};
    function onInit() {
       setTimeout(reboot,18000000);
       wifi.stopAP();
       //wifi.startAP(ssid, options);
       //wifi.startAP("Electrolux");
      // wifi.connect("INGRIFABSR", {password: "B73vFeX6se2"}, function(err) {
         wifi.connect("LP82K1", {password: "excitedboat325"}, function(err) {
            if(err)console.log(err);else {
              console.log("wifi connected!");//116
              print(wifi.getIP().ip);
      mqtt.on('connected', function() {
        mqtt.subscribe("settings");
        print("mqtt connected!");
        start_sensor();
      });
      mqtt.on('publish', function (pub) {
        console.log("topic: "+pub.topic);
        console.log("message: "+pub.message);
        var settings=[];
        if(pub.topic==="settings")settings = JSON.parse(pub.message);
        settings_pol = settings.settings_pol;
        settings_kondey = settings.settings_kondey;
      });
      mqtt.connect();
      mqtt.on('disconnected', function() {
      console.log("MQTT disconnected... reconnecting.");
      setTimeout(function() {
      mqtt.connect();
      }, 10000);
      });
            }
         });
    }
    
About

Avatar for MaBe @MaBe started