Bridge sends data faster than timer function limit to database (not app)

Hello everyone,
First things first…

 1. The Blynk library version you are using.                       **(0.5.1)**
 2. Android or iOS and the version of the OS.                      **(Android 5.0)**
 3. Server type, Local or Cloud based.                             **(Local Server)**
 4. If local server, which version you are using.                  **(0.33.1-java8)**
 5. How you powering the MCU.                                      **(with USB)**
 6. Has the MCU ever connected to a Blynk server (Cloud or local). **(yes)**
 7. The IDE you areusing, including the version number.            **(Arduino 1.8.0)**
 8. The settings you have in the IDE for the MCU.                  **(ESP8266-01)**
 9.The Arduino core version you are using.                         **(1.8.0)**
10. The make and model of your phone.                              **(Samsung Note 3)**

I have ESP8266-01 module with DHT22 for temp sens and send them to Nodemcu with bridge. My code as same as Bridge example. I can send data to Nodemcu, Nodemcu receive them and show to me by app for desired periods (5min) . But it happens to fast for my postgresql database, :hushed: exactly 15 sec. But my timer function for this 5min.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#define DHTPin 2                              
#define DHTTYPE DHT22                         

char auth[] = "xxx";
char ssid[] = "xxx";
char sifre[] = "xxx";
float hum;                                    
float temp;                               

WidgetBridge Bridge1(V5);
DHT dht(DHTPin, DHTTYPE);
BlynkTimer timer1;

BLYNK_WRITE(V5)
{
  int pin = param.asInt();
  if (pin == HIGH)   sending();
}

BLYNK_CONNECTED()
{
  Bridge1.setAuthToken("xxx"); 
}

void setup()
{
  Serial.begin(115200);
  dht.begin();
  WiFi.begin(ssid, sifre);
  Blynk.config(auth, IPAddress(xxx, xxx, xxx, xxx), 8080);
  while (Blynk.connect() == false) {
  }
  Blynk.virtualWrite(V0, BLYNK_VERSION);
  Blynk.virtualWrite(V1, ESP.getCoreVersion());
  sending();
  timer1.setInterval(300000L, sending);
}


void sending() 
{
  temp = dht.readTemperature();
  delay(1250);
  hum = dht.readHumidity();
  if (isnan(hum) || isnan(temp))                
  {
    Serial.println("DHT error!");
    delay(500);
    return;
  }
  Blynk.virtualWrite(V19, temp);        
  delay(1250);                      // This delays for the emoncms.org webhooks 
  Blynk.virtualWrite(V20, hum);             
  Bridge1.virtualWrite(V19, temp);       
  delay(1250);
  Bridge1.virtualWrite(V20, hum);             
}

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

As you see this sending function must work for 5 min periods but it sends to data my database for 15 sec periods.

Ekran Alıntısı2

  1. Is that normal for database?

  2. What must I do? thanks…

SOLVED…

if both device have same pins (like on nodemcu V2 and V2 on ESP8266) postgresql store them same pin number BUT different device_id :slight_smile:

add device_id=(xxxx) to my query and bingo…