syncVirtual debug shows Packet too big and device reconnects

Hi I’m having trouble with what I think the behaviour of the sync virtual should do.

The app has a Step H on it mapped to V12 with a range of 0 - 1
I would expect the BLYNK_WRITE_DEFAULT to be called on/after every connection but it doesn’t, with the code as shown even using the step in the app does not call the BLYNK_WRITE_DEFAULT.

even if i just use a BLYNK_WRITE(V12){…} it still does not work.
if I comment out the Blynk.syncVirtual(V12); then using using the step in the app works as expected.

The very last code at the bottom works as expected but kind of feels like I’m having to work outside of the library

Hardware is a Wos D1 Mini, Arduino Software 1.8.1

Here is the debug output from the terminal, Non Working code next, working - work around code last


[24502] Connected to WiFi
[24502] IP: 192.168.0.108
[24502] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.7 on Arduino

[24508] Free RAM: 39232
[24510] Connecting to blynk-cloud.com:8441
[26156] Certificate OK
[26156] <[02|00|01|00] 64dc0b71ca8748ad829b4785c638bd02
[26438] >[00|00|01|00|C8]
[26438] Ready (ping: 1ms).
[26438] <[11|00|01|00]Hver[00]0.4.7[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]Arduino[00]build[00]May 12 2017 14:41:08[00]
BLYNK_CONNECTED(justConnected:==>true)
[26721] <[10|00|02|00|05]vr[00]12
[26997] >,[D5|DD]([A1]
[26997] Packet too big: 10401
[26997] Connecting to blynk-cloud.com:8441
[28629] Certificate OK
[36439] <[06|00|03|00|00]
[41745] Connecting to blynk-cloud.com:8441
[43605] Certificate OK
[43606] <[02|00|01|00] 64dc0b71ca8748ad829b4785c638bd02
[43911] >[00|00|01|00|C8]
[43911] Ready (ping: 1ms).
[43911] <[11|00|04|00]Hver[00]0.4.7[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]Arduino[00]build[00]May 12 2017 14:41:08[00]
BLYNK_CONNECTED(justConnected:==>true)
[44218] <[10|00|05|00|05]vr[00]12
[44525] >(Q[8B|02|DF]
[65481] >[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|00|05|00|09]vw[00]12[00]0.0[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14|1E]b[00|04]vr[00]2[14|1E]b[00|04]vr[00]3[14|1E]b[00|04]vr[00]4[14|1E]b[00|04]vr[00]5[14]
[65627] Invalid header type: 40
[65630] Connecting to blynk-cloud.com:8441
[68173] Certificate OK
[68173] <[06|00|06|00|00]
[73453] Connecting to blynk-cloud.com:8441
[75074] Certificate OK
[75074] <[02|00|01|00] 64dc0b71ca8748ad829b4785c638bd02
[75350] >[00|00|01|00|C8]
[75350] Ready (ping: 1ms).
[75350] <[11|00|07|00]Hver[00]0.4.7[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]Arduino[00]build[00]May 12 2017 14:41:08[00]
BLYNK_CONNECTED(justConnected:==>true)
[75633] <[10|00|08|00|05]vr[00]12
[75908] >[95|F9]6[D1|BA]
[75908] Packet too big: 53690
[75908] Connecting to blynk-cloud.com:8441

And here is the code

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <BlynkSimpleEsp8266_SSL.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXX";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXXXXX";
char pass[] = "XXXXXXX";


// This is called for all virtual pins, that don't have BLYNK_WRITE handler
BLYNK_WRITE_DEFAULT() {
  Serial.print("input V");
  Serial.print(request.pin);
  Serial.print("==>");
  // Print all parameter values
  for (auto i = param.begin(); i < param.end(); ++i) {
    Serial.print("* ");
    Serial.println(i.asString());
  }
}


// This function will run every time Blynk connection is established
BLYNK_CONNECTED() {
  Serial.println("BLYNK_CONNECTED(justConnected:==>true)");
  // Request Blynk server to re-send latest values for all pins
  //Blynk.syncAll();
  Blynk.syncVirtual(V12);
}


void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
}

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

Working version of code

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <BlynkSimpleEsp8266_SSL.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXX";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXXXX";
char pass[] = "XXXXXX";

// This is called for all virtual pins, that don't have BLYNK_WRITE handler
BLYNK_WRITE_DEFAULT() {
  Serial.print("input V");
  Serial.print(request.pin);
  Serial.print("==>");
  // Print all parameter values
  for (auto i = param.begin(); i < param.end(); ++i) {
    Serial.print("* ");
    Serial.println(i.asString());
  }
}


// Keep this flag not to re-sync on every reconnection
bool justConnected = false;
// This function will run every time Blynk connection is established
BLYNK_CONNECTED() {
  if (justConnected == false) {
    Serial.println("BLYNK_CONNECTED(justConnected:==>true)");
    // Request Blynk server to re-send latest values for all pins
    //Blynk.syncAll();

    justConnected = true;
  }
}



void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();

  if (justConnected == true){
    justConnected = false;
    Serial.println("BLYNK_CONNECTED(justConnected:==>false)");
    Blynk.syncAll();    
  }
  
}

@lorneb how many widget do you have? Please try to increase

#define BLYNK_MAX_READBYTES 256

to let’s say 1024

this should help.

Ok, got some time to try out suggestion, but no luck

I tried putting the “#define BLYNK_MAX_READBYTES 1024” before and after the #include <BlynkSimpleEsp8266_SSL.h>

But still got the same error

[24496] Connected to WiFi
[24496] IP: 192.168.0.93
[24496] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.7 on Arduino

[24503] Free RAM: 39232
[24505] Connecting to blynk-cloud.com:8441
[26136] Certificate OK
[26136] <[02|00|01|00] 64dc0b71ca8748ad829b4785c638bd02
[26417] >[00|00|01|00|C8]
[26418] Ready (ping: 2ms).
[26418] <[11|00|01|00]Hver[00]0.4.7[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]Arduino[00]build[00]May 17 2017 13:55:11[00]
BLYNK_CONNECTED(justConnected:==>true)
[26697] <[10|00|02|00|05]vr[00]12
[26972] >[EB]}[9B|E5|AA]
[26972] Packet too big: 58794
[26973] Connecting to blynk-cloud.com:8441
[28582] Certificate OK
[36419] <[06|00|03|00|00]
[41759] Connecting to blynk-cloud.com:8441
[43925] Certificate OK

@vshymanskyy suggestions?

Response from the server is clobbered. Could you try without SSL?

Without SSL worked without any issues, SSL seems to work sometimes for random about of time before giving the Packet too big error.

Thanks for you help