[SOLVED] Timer widget fails to trigger every so often with ESP32

What does debug shows?

@Dmitriy

Debug shows no vw on vpin5 (the timer) when using sync:

[18] Connecting to RobsTV
[2652] Connected to WiFi
[2652] IP: 192.168.1.93
[2652] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on Arduino

[5001] Connecting to blynk-cloud.com:8442
[5061] <[02|00|01|00] 5417eefaa3204b3e814d6edde7d9a6fd
[5112] >[00|00|01|00|C8]
[5112] Ready (ping: 50ms).
[5112] <[11|00|02|00]Hver[00]0.4.8[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]Arduino[00]build[00]Jul 28 2017 13:38:59[00]
[5178] >[00|00|02|00|C8]
[15118] <[06|00|03|00|00]
[15169] >[00|00|03|00|C8]
[15401] >[14]k[FD|00|06]
[15402] >vw[00]2[00]1
[15402] <[10]k[FD|00|00]
[15446] >[14]k[FD|00|06]
[15447] >vw[00]0[00]0
[15448] >[14]k[FD|00|06]
[15448] >vw[00]1[00]0
[15449] >[14]k[FD|00|06]
[15450] >vw[00]2[00]1
[15450] <[10]k[FD|00|00]
[15451] >[14]k[FD|00|01]
[15452] >1
[15454] >[14]k[FD|00|06]
[15456] >vw[00]4[00]0
[15458] >[14]k[FD|00|06]
[15460] >vw[00]3[00]0
[15462] <[14]k[FD|00|06]vw[00]4[00]0
[15506] >[14]k[FD|00|06]
[15507] >vw[00]0[00]0
[15507] >[14]k[FD|00|06]
[15508] >vw[00]1[00]0
[15509] >[14]k[FD|00|06]
[15510] >vw[00]2[00]1
[15510] <[10]k[FD|00|00]
[15511] >[14]k[FD|00|01]
[15512] >1
[15514] >[14]k[FD|00|06]
[15516] >vw[00]4[00]0
[15518] >[14]k[FD|00|06]
[15520] >vw[00]3[00]0
[15522] <[14]k[FD|00|06]vw[00]4[00]0
[15526] >[14]R[BC|00|06]
[15528] >vw[00]2[00]0
[15638] >[14]k[FD|00|06]
[15639] >vw[00]0[00]0
[15640] >[14]k[FD|00|06]
[15640] >vw[00]1[00]0
[15641] >[14]k[FD|00|06]
[15642] >vw[00]2[00]0
[15642] >[14]k[FD|00|01]
[15643] >1
[15644] >[14]k[FD|00|06]
[15646] >vw[00]4[00]0
[15648] >[14]k[FD|00|06]
[15650] >vw[00]3[00]0
[15652] <[14]k[FD|00|06]vw[00]4[00]0
[25652] <[06|00|04|00|00]
[25716] >[00|00|04|00|C8]
[35653] <[06|00|05|00|00]
[35716] >[00|00|05|00|C8]

This is the code Iā€™ve got setup for the test:

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

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

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

WidgetLED testLED(V4);

BLYNK_WRITE(V2)  //sync
{
  int pinValue = param.asInt(); 
  if (pinValue == 1)
  {
    Blynk.syncAll();
  }
}
BLYNK_WRITE(V3) //LED toggle
{
  int pinValue = param.asInt(); 
  if (pinValue == 1)
  {
    testLED.on();
  }
  if (pinValue == 0)
  {
    testLED.off();
  }
}
BLYNK_WRITE(V5) //timer
{
  int pinValue = param.asInt(); 
  if (pinValue == 1)
  {
    testLED.on();
    Blynk.virtualWrite(V3, 1);
  }
  if (pinValue == 0)
  {
    testLED.off();
    Blynk.virtualWrite(V3, 0);
  }
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);
  
}

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

When changing from Blynk.syncAll() to Blynk.syncVirtual(V5) it spits out this in the debug:

[204945] >[14],[F5|00|06]
[204946] >vw[00]2[00]1
[204946] <[10],[F5|00|04]vr[00]5
[205006] >[14],[F5|00|01]
[205006] >1
[205054] >[14|0D]@[00|06]
[205055] >vw[00]2[00]0

Which is interesting. I assume vr[00]5 means it is reading the vpin and it knows itā€™s a 1, how do I capitalize on that to make my BLYNK_WRITE(V5) trigger?

@Gunner @Costas

Since this thread is really not about the timer failing to trigger anymore, and more about using Blynk.sync() functions with the timer, should I make a new thread? Iā€™d really love to get this resolved.

No, changing to another topic will not improve anyones ability to assist or suggest. I think your topic and issue still is valid and needs resolutionā€¦ it is just determining the cause of such issue, before any resolution can be determined.

E.gā€¦

Is it the Timer Widget and how it links with the server (and thus to your device).

Or is the issue is caused by code and/or the way you use sketch timers (not to be confused with the Timer Widget) vs BlynkTimer:

And how/if Blynk.sync() even affects the issue, or does it just add to the confusion.

As is the case with all ā€œNeed Help With My Projectā€ topics, much of the load is on your own diagnostic and reporting. Until then we are only seeing ā€œsnapshotsā€ and postulating ideas. So, on that note, do you have any other simpler sketches that can duplicate the issue?

Thatā€™s why I asked if I should make a new topic, I duplicated the issue with the simple sketch 2 posts above this with debug info.

I think I figured out why the timer was missing triggers in the first place: I had a webhook assigned to one of my pins that was generating a packet too big error when it returned a json and causing the next ~8 commands to be skipped. I increased #define BLYNK_MAX_READBYTES to 4092.

4 Likes

@Dmitriy need to think how to handle this - maybe sync can be disabled for wevhook widget? whatā€™s the use case?

Keeping these possibly related issues in the one topic makes for easier referencing and locating any resolution for future readers.

I was actually referring to the original issue of missed timers, not the potential sync contributionā€¦ but you seem to have resolved that timer issue already. Good diagnostics! :+1:

This topic is marked SOLVED, however feel free to keep adding any new related issues with regards to sync, timers, etc.

But this is feature :slight_smile:. If we disable this someone else will create topic saying why I canā€™t get data from webhook :).

1 Like

Letā€™s leave as it is for now. Iā€™ll just add additional warnings to docs for now. If more people will complain we will thinks further.

1 Like