Issues with the ESP and fast synching and virtualwrite

A consideration.

I, amongst others, have come across the issue with crashing or disconnecting the ESP (e.g. WeMos & sonoff in my case) when doing too many syncs and virtual writes at once.

It can be solved with the use of the timer but can create more programming and it’s a bit messy.

Is there a possible consideration of being able to throw a load of syncs and virtual writes at Blynk and have it sort out the mess?

Possible?

1 Like

The problem isn’t so much as whether Blynk can sort it out, rather controlling the rapid flood of data needing to be sorted out. Managed code is probably still best, and is probably the “normal” way to control any large I/O data flow, Blynk or no Blynk.

However, I think there is something in the works for a more evened out Blynk.syncAll()

Seems to me, reading the thread from @Dmitriy, the potential change to sync all will do pretty much what I am suggesting. With more of us using the ESP with more and more data to and from the device and phone and with the inherent problems of flooding the wifi, esp and blynck with data it might be a sensible precaution in the meantime to add a function like this. The appetite comes with the eating with this toy :slight_smile:

I/we have a similar problem with virtualwrites. We need to space these out as well. I think I understand there is a blynk limit anyway which I think we can configure away. But I don’t think this is the problem for me right now. If I throw more than 2-4 writes at my sonoff is has trouble (goes off line/crashes) and I need to space them out.

This is a bit of a "Slow Blynk.syncAll()" hack… but that’s how I roll :wink:

This will take about 8 seconds (in my tests) to go through the 0-126 virtual pins.

Obviously you would only need it to go as high as your largest vpin used.

int Vcount;

void BlynkSyncAllHack() {  // Slow but stable SyncAll hack
  for (Vcount = 0; Vcount <= 127; Vcount++) {  // Count from 0 to 127
    Blynk.syncVirtual(Vcount);  // Generate a vPin sync for each count
    delay(5);  // Small delay to allow "spacing" between each vPin sync
    Blynk.run();  // Just keeps Blynk running
  }
}

I still sometimes have issues even after syncing, but then I am also trying to run connection management on a ESP as WiFi adaptor for Arduino setup… so… there’s that :stuck_out_tongue_winking_eye:

1 Like

And by using a timer to call this counting sync function, it will run even smoother and doesn’t need the extra Blynk.run().

int Vcount = 0;

timer.setTimer(5, BlynkSyncAllHack, 127);  // Run the function 127 times every 5ms

void BlynkSyncAllHack() {
  Blynk.syncVirtual(Vcount);  // Generate a vPin sync for each count
  Vcount++;
}
1 Like

Very nice. What I had missed was the ability to use a variable int for the argument for syncVirtual. I had been using constant V1, V2 etc as I thought it needed to be a constant…

I’ll give it a try.

If I put my data to virtual write into an indexed array I might be able to use the same trick to space the virtualwrites.

Thanks. You are up late/very early :slight_smile:

Yes… both :smiley: Last night was one of my “awake with clarity of thinking” moments… so I take advantage of those whenever they happen and get some of my more complicated projects worked on.

But now time to go to sleep for a few hours… if those darn birds will stop twittering “good morning” to each other :stuck_out_tongue:

Great solution, saved me from disaster

1 Like

Very old topic, later changes added anti-flooding to Blynk making this issue irrelevant for the most part.