Problem with thermostat maybe from the server

Hello blynkers, I have o problem. In this picture there are thermostats . I use esp8266 for that… if you look the diagram ( green line) for some hours the thermostat dont close ever when the temperature was up 30° but it continued on… what problem is this? Server problem? I think that i had internet commection because i dont saw any disconnect in blynk at this hours

Not a server problem, the line would be zero, or a period of missing data - depending on how tour Superchart is configured.

Pete.

Thanks you for reply… what maybe cause this problem? How can i resolve this problem?

Difficult to say without more understanding of the physical setup, hardware used, code used etc.

Maybe a relay that’s sticking, or a bug in your code?

Pete.

I use 8 relay module d0 d1 d2 d3 d5 d6 d7 d8 with esp8266… also i forget to say that when became this problem the button in app remain on and not to change off and the opposite… like app problem , and when i touch the button on or off it contious to work normal with the command which i have give from the eventor settings

this is my code

#include <FS.h>
#include <DNSServer.h>
#include <WiFiManager.h>
#include <ESP8266WebServer.h>
#include <BlynkSimpleEsp8266.h>
#include <ArduinoJson.h>
const char* host = "www.google.com"; 

/* TIMER */
#include <SimpleTimer.h>
SimpleTimer timer;

/* DS18B20 Temperature Sensor */
#include <OneWire.h>
#include<DallasTemperature.h> 
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

//BlynkTimer timer;

float temp_0;
float temp_1;
float temp_2;
float temp_3;
unsigned long lst_milis = 0;

const int relay_1 = 16;
const int relay_2 = 5;
const int relay_3 = 4;
const int relay_4 = 0;
const int relay_5 = 14;
const int relay_6 = 12;
const int relay_7 = 13;
const int relay_8 = 15;


#define SET_PIN 0

char blynk_token[40] = "";
bool shouldSaveConfig = false;

void saveConfigCallback () {
 Serial.println("Should save config");
 shouldSaveConfig = true;
}


BLYNK_CONNECTED()  //sygxronizei to esp otan bgei apo to reuma stis leitoyrgies poy eixe stamatisi
{
Blynk.syncAll();
}


void setup()
{
 //Blynk.config(auth);
// Blynk.begin(auth, ssid, pass);
 DS18B20.begin();
 timer.setInterval(1000L,getSendData);
 timer.setInterval(10000L,WiFiStatus);
 
 Serial.begin(115200);
 Serial.println();
 pinMode(SET_PIN, INPUT_PULLUP);
 delay(3000);

 //read configuration from FS json
 Serial.println("mounting FS...");
 if (SPIFFS.begin()) {
   Serial.println("mounted file system");
   if (SPIFFS.exists("/config.json")) {
     //file exists, reading and loading
     Serial.println("reading config file");
     File configFile = SPIFFS.open("/config.json", "r");
     if (configFile) {
       Serial.println("opened config file");
       DynamicJsonDocument jsonBuffer ( 1024 ) ;
       DeserializationError error = deserializeJson ( jsonBuffer, configFile ) ;
       if ( not error )
         {
           serializeJson(jsonBuffer, Serial);
           strcpy(blynk_token, jsonBuffer["blynk_token"]) ;
           Serial.println("\nparsed json");
           Serial.println( blynk_token );
         }
       else  
         Serial.println("failed to load json config");

       configFile.close();
   }
 } else {
   Serial.println("failed to mount FS");
 }

 WiFiManagerParameter custom_blynk_token("blynk", "blynk token", blynk_token, 32);
 WiFiManager wifiManager;
 wifiManager.setSaveConfigCallback(saveConfigCallback);
 wifiManager.addParameter(&custom_blynk_token);

 if (digitalRead(SET_PIN) == LOW) {
   wifiManager.resetSettings();
 }

 if (!wifiManager.autoConnect("Kitchenroom")) {
   Serial.println("failed to connect and hit timeout");
   delay(3000);
   ESP.reset();
   delay(5000);
 }

 Serial.println("wifi connected");
 strcpy(blynk_token, custom_blynk_token.getValue());

 //save the custom parameters to FS
 if (shouldSaveConfig) {
   Serial.println("saving config");
   DynamicJsonDocument jsonBuffer ( 1024 ) ;
   jsonBuffer["blynk_token"] = blynk_token;

   File configFile = SPIFFS.open("/config.json", "w");
   if (!configFile) {
     Serial.println("failed to open config file for writing");
   }
   else
     serializeJson(jsonBuffer, configFile);
   configFile.close();
 }
 
 Serial.println();
 Serial.print("local ip : ");
 Serial.println(WiFi.localIP());
 Serial.print("Blynk Token : ");
 Serial.println(blynk_token);
 Blynk.config(blynk_token);
 }
}

void loop() {
 Blynk.run();
 timer.run(); // Initiates SimpleTimer
}


/***************************************************
* Send Sensor data to Blynk
**************************************************/
void getSendData(){
   unsigned long cur_millis = millis();
   if (cur_millis - lst_milis >= 2000)         //if 2 seconds since last mesurement 
       {
       lst_milis = cur_millis;
       DS18B20.requestTemperatures(); 
              
          temp_0 = DS18B20.getTempCByIndex(0); // Sensor 1 will capture Temp in Celcius
          temp_1 = DS18B20.getTempCByIndex(1); // Sensor 2 will capture Temp in Celcius
          temp_2 = DS18B20.getTempCByIndex(2); // Sensor 3 will capture Temp in Celcius     

         if(temp_0 != -127){
           Serial.println(temp_0);
           Blynk.virtualWrite(1 , temp_0);    //virtual pin 1
         }
         else{
           Serial.println("Error: Could not read temperature data for sensor No.0");
         }

         if(temp_1 != -127){
           Serial.println(temp_1);
           Blynk.virtualWrite(2 , temp_1);    //virtual pin 2
         }
         else{
           Serial.println("Error: Could not read temperature data for sensor No.1");
           }

           if(temp_2 != -127){
           Serial.println(temp_2);
           Blynk.virtualWrite(3, temp_2);    //virtual pin 3
         }
         else{
           Serial.println("Error: Could not read temperature data for sensor No.2");
          }
          if(temp_3 != -127){
           Serial.println(temp_3);
           Blynk.virtualWrite(4, temp_3);    //virtual pin 4
         }
         else{
           Serial.println("Error: Could not read temperature data for sensor No.3");
          }
       }
   }



void WiFiStatus()
{
 WiFiClient client;
 if (client.connect(host, 80))
 {
       Serial.println("connected");
       client.stop();
    
   }
   else {
    Serial.println("connection failed!"); 
 digitalWrite(relay_1, HIGH); // Και εδω δηλωνεις οτι θα ξεκιναει κλειστο
 digitalWrite(relay_2, HIGH);
 digitalWrite(relay_3, HIGH);
 digitalWrite(relay_4, HIGH); 
 digitalWrite(relay_5, HIGH);
 digitalWrite(relay_6, HIGH);
 digitalWrite(relay_7, HIGH);
 digitalWrite(relay_8, HIGH); 
    client.stop();
   
  }
}

I’d say that your problem is most likely mixing Eventor actions and code on your device.
As far as I’m concerned, it’s one or the other - which is one of the reasons I’ve never used Eventor.

Pete.

thanks you for replay… what you suggest to do so that to avoid this problem… because it is essential the eventor for my project :confused:

Whatever you do in Eventor can be done in code instead.

Pete.

Not all these pins are suitable… read below.

1 Like

thanks you for reply :slight_smile:

1 Like