Sudden lack of data on SuperChart

Hi everyone, so today I’ve decided to create a device which I will monitor my room temperature with when I’m not home. I had an NodeMCU V1 ESP8266 and a DHT22 laying around from previous projects, so I decided to use them both and created a simple temperature sensor, which sends the temperature data to blynk server via virtual pin. I need to admit that I know nearly nothing about programming, so I created the code with the help of AI (Please be understanding). Here it is:

#define BLYNK_TEMPLATE_NAME "Czujnik Temperatury"

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

// Ustawienia sieci WiFi
char auth[] = "pmUJZUYw_***********************"; // Tutaj wprowadź swój Auth Token z aplikacji Blynk
char ssid[] = "Veganet_Internet";
char pass[] = "******";

// Ustawienia czujnika DHT22
#define DHTPIN D1     // Pin, do którego jest podłączony czujnik DHT22
#define DHTTYPE DHT22 // Typ czujnika DHT

DHT dht(DHTPIN, DHTTYPE);

// Liczba pomiarów do wykonania w ciągu 1 minuty
#define NUM_READINGS 6

// Interwał pomiędzy pomiarami (w sekundach)
#define MEASUREMENT_INTERVAL 10

// Deklaracja obiektu Blynk
BlynkTimer timer;

// Tablica przechowująca wyniki pomiarów
float readings[NUM_READINGS];

// Licznik wykonanych pomiarów
int readingsCounter = 0;

// Funkcja do wykonywania pomiarów co 10 sekund
void takeMeasurement()
{
  float temperature = dht.readTemperature(); // Odczytaj temperaturę z czujnika

  // Sprawdź, czy odczytano poprawnie temperaturę
  if (!isnan(temperature))
  {
    Serial.print("Odczytano temperaturę: ");
    Serial.println(temperature);
    
    readings[readingsCounter] = temperature;
    readingsCounter++;
  }
  else
  {
    Serial.println("Błąd odczytu temperatury!");
  }

  // Jeśli wykonano wystarczającą liczbę pomiarów, oblicz średnią i wyślij do Blynk
  if (readingsCounter >= NUM_READINGS)
  {
    Serial.println("Zbieranie danych zakończone.");
    
    float sum = 0;
    for (int i = 0; i < NUM_READINGS; i++)
    {
      sum += readings[i];
    }
    float average = sum / NUM_READINGS;
    
    Serial.print("Średnia temperatura: ");
    Serial.println(average);
    
    Blynk.virtualWrite(V5, average); // Wyślij średnią temperaturę do serwera Blynk
    delay(200); // Dodaj opóźnienie przed deep sleep

    // Wyzeruj licznik i tablicę pomiarów
    readingsCounter = 0;
    memset(readings, 0, sizeof(readings));
    delay(200);
    
    // Po wysłaniu danych, wchodzimy w tryb deep sleep na 2 minuty
    Serial.println("Wejście w tryb Deep Sleep...");
    ESP.deepSleep(2e6 * 60); // 2 minuty w mikrosekundach
  }
}

void setup()
{
  // Inicjalizacja portu szeregowego
  Serial.begin(9600);
  Serial.println("Inicjalizacja...");

  // Inicjalizacja czujnika DHT
  dht.begin();

  // Połączenie z siecią WiFi
  Blynk.begin(auth, ssid, pass);
  delay(100); // Dodaj opóźnienie przed rozpoczęciem pomiarów

  // Ustawienie interwału dla funkcji takeMeasurement
  timer.setInterval(MEASUREMENT_INTERVAL * 1000, takeMeasurement);
}

void loop()
{
  Blynk.run();
  timer.run();
}

Believe me or not, but the code was working (and probbably is still working) perfectly fine, Every temperature measurement was succesfully sent to the Blynk server and it was showing correctly on the SuperChart. A Few hours go by, and the SuperChart stopped showing historical data, while the gauge is still working. I haven’t made any changes to the code in these few hours, only thing I Changed is the Decimal value on the Blynk app on android to show more accurate measurements, but it wasn’t simultaneous. Here is the photo of the chart on the Web Dashboard:

I don’t remember the version of the blynk libraries, but i remember the moment Arduino IDE decided to update the libraries to the latest versions, so they are most likely latest, if it will be crucial, i will provide the current version. Also if more info is needed, I will try to provide it too.

I don’t know what the issue could be, so any help would be highly appreciated!

Have you tried refreshing your browser screen (F5 on a Windows PC)?

Pete.

Yes, a lot of times, even tried changing resolution but no luck. It is also stuck on Blynk App on my phone (Android)

Post a screenshot of your V5 datastream setup.

Pete.

Here you go:


Oh i see the problem now!

I must assure you I didn’t move that switch at all! (Enable history data)

Anyway Thank you so much for help, I enabled the history data back and now it is back to normal!

You’ve also turned this setting off…

Turn it back on and everything will work again.

Pete.

1 Like

It was just added recently (~2 months ago) as it is appear many datapoints don’t need to be stored, so we have done it to improve performance (less data to stor) for some setups.

1 Like

After further examination i came to a conclusion that everytime you change any settings of a Datastream on a Blynk app on Android, It “automatically” turns off, and you need to manually turn it back on on the web dashboard on PC.

I don’t know if this is a feature or a bug, but thats what i noticed, anyway thanks for your help!

Hello @DawidBoTak . Please explain in more detail what you meant

Okay, so I wanted to have a more accurate measurment of a temeprature reading, but i wasn’t home, so i decided to change the setting on the Blynk app on android. I went into developer mode >> my template >> Datastreams Icon >> tapped on my V5 datastream. Went into “edit” on top right, and changed the decimals formatting from “#.#” to “#.##” and backed out of the developer mode in order to save the settings since there is no save button. After that, the next sensor values that were coming from the temperature sensor have stopped being posted on the SuperChart, but were still posting on the gauge (now i know why). After that i had to get on my PC and enable the history data back on manually (since there is no option in a phone Blynk app to “enable history data”, at least I didn’t find it yet).

@DawidBoTak thanks for the detailed report. the bug is confirmed. Android data stream editing “erases” this flag. So as qucik fix you need to set it back on web, until we fix it on Android.

1 Like

I am glad i could help!

Please resolve this bug, since 8:30 AM 19FEB INDIAN STANDARD TIME. None of my devices updating data on superchart. Client yells on me.

Please resolve the issue as soon as possible. None of my device logging the data it stopped since 19th feb 2024 9:15 PM IST.

@Seth_MSR @Saiteja the issue is fixed.

1 Like

aknowleged.