@vshymanskyy as sole contributor to BlynkApi.h according to Github ill go ahead and tag you.
I’m noticing that some of my Blynk.virtualWrite’s don´t seem to make it through to my terminal. I can tell that my labeled widgets got updated by looking at the temp label.
Below is my output from Serial monitor for 2 cycles of my ESP device
For each of theese prints a string is concatenated and a virtualWrite to terminal is performed at the last line.
Yet as seen in the image only the first cycle printed to terminal
Perhaps if virtualWrite could return a boolean value based on success of write to server, theese type of issues could be coded around? As some of my writes make it through I could then just add a loop that atempts extra virtualWrites in case of failure.
---------------- 19:30:41 ----------------
Wake Reason: Door open
Chip RstReason: Deep-Sleep Wake
Battery voltage: 0.04
Battery raw: 9.00
Sleep time: 15 minutes
Recheck time: 30 seconds
Voltage factor (977): 0.977
Temperature: 22.62 °C
Door is closed
Door is unlocked
WiFi signal at 50 %
Sleeping until: 19:31:12
---------------- 19:31:18 ----------------
Wake Reason: Timer
Chip RstReason: Deep-Sleep Wake
Battery voltage: 0.04
Battery raw: 9.00
Sleep time: 15 minutes
Recheck time: 30 seconds
Voltage factor (977): 0.977
Temperature: 22.62 °C
Door is closed
Door is unlocked
WiFi signal at 47 %
Sleeping until: 19:45:00
I prefer virtualWrite for Terminal rather than flush but in your case you might want to try the print and flush method. It could be that the vw is waiting for the next blynk.run() cycle and missing it before you sleep.
If you are 5.0 perhaps try 4.10.
If neither of these work let me know as I might have a hack that could help.
I’ll get back to you once I’ve tried doing a “finishing” blynk.run.
No random writes, I concat a string then print to terminal before esp goes to sleep!
I’ve used flush before but it didn’t work that well for me, lost information there as well!
Actually not even the last write that’s lost but all writes for that cycle. I do
one write for the start time
Concat many strings and make a write at the end
And do a last write for sleep time
When this error occurs none of the writes make it to terminal
######### separate write
---------------- 19:31:18 ----------------
######### separate write
Wake Reason: Timer
Chip RstReason: Deep-Sleep Wake
Battery voltage: 0.04
Battery raw: 9.00
Sleep time: 15 minutes
Recheck time: 30 seconds
Voltage factor (977): 0.977
Temperature: 22.62 °C
Door is closed
Door is unlocked
WiFi signal at 47 %
######### separate write
Sleeping until: 19:45:00
So I’ve tried adding a
Blynk.run
Blynk.disconnect
Prior to setting my device to sleep.
No dice there on the whole not writing to terminal. I’ve noticed that the device does come online and connect to Blynk server. Just no terminal updates. Also the sleep was the default one hour even if I had set something else in the app, when this error occurred.
I think RTC is not working as it should, will investigate further with blynk debug
Below is a copy from Serial monitor when having blynk debug enabled and noticing that I do not get a print to terminal (I do see the device connected to blynk from phone app). I even went as far as rebuilding the project leaving the “Device tiles” for a simpler setup with tabs. This way atleast terminal history is retained.
Using ESP core v 2.4.0
Up to date on everything blynk related
RTC sync not showing any error SO I do not know where to go from here to get any closer to an answer as to why my last virtualWrite does not seem to make it through SOMETIMES. @Costas any ideas? @vshymanskyy Do you see anything off in regards to Blynk debug that might explain the lack of virtualWrites?
I’ve included the important bits of code since my code is long.
This is from blynk.log
06:27:39.606 INFO - adiiss_@hotmail.com hardware joined.`
*WM:
*WM: Adding parameter
*WM: static IP
*WM: Adding parameter
*WM: blynk-token
*WM: Adding parameter
*WM: blynk-server
*WM: Adding parameter
*WM: blynk-port
*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 3
*WM: IP Address:
*WM: 192.168.1.10
[2507]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.5.0 on Arduino
[2514] Connecting to 192.168.1.3:8442
[2553] <[02|00|01|00] *************AUTH REMOVED *****************
[2557] >[00|00|01|00|C8]
[2557] Ready (ping: 3ms).
[2558] Free RAM: 37144
[2624] <[11|00|02|00]Hver[00]0.5.0[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]Arduino[00]build[00]Jan 25 2018 20:23:25[00]
[2634] >[00|00|02|00|C8]
[2691] <[11|00|03|00|08]rtc[00]sync
[2693] >[11|00|03|00|0E]
[2693] >rtc[00]1516948059
[2693] Time sync: OK
---------------- 06:27:39 ----------------
[2760] <[10|00|04|00|05]vr[00]16
[2765] >[14|00|04|00|07]
[2765] >vw[00]16[00]0
[2827] <[10|00|05|00|0D]vr[00]10[00]12[00]2[00]14
Wake Reason: Door open
Chip RstReason: Deep-Sleep Wake
Battery voltage: 0.04
Battery raw: 9.00
[2839] >[14|00|05|00|07]
[2839] >vw[00]10[00]4
Sleep time: 15 minutes
[2906] <[14|00|05|00|08]vw[00]11[00]15
[2906] >[14|00|05|00|08]
[2906] >vw[00]12[00]30
Recheck time: 30 seconds
[2973] <[14|00|05|00|08]vw[00]13[00]30
[2973] >[14|00|05|00|08]
[2973] >vw[00]2[00]977
VoltageFactor (977): 0.977
[2974] >[14|00|05|00|07]
[2974] >vw[00]14[00]1
[2976] <[14|00|06|00|0B]vw[00]0[00]9.0000
[3047] <[14|00|07|00|0A]vw[00]1[00]0.037
Temperature: 21.81 °C
[3569] <[14|00|08|00|0B]vw[00]5[00]21.812
Door is closed
Door is unlocked
[3636] <[14|00|09|00|10]vw[00]3[00]LOCKED [F0|9F|94|92]
WiFi signal at 47 %
[3703] <[14|00|0A|00|08]vw[00]15[00]47
Sleeping until: 06:28:10
[3770] <[14|00|0B|01]Avw[00]20[00|0A]---------------- 06:27:39 ----------------[0A]Wake Reason: Door open[0A]Chip RstReason: Deep-Sleep Wake[0A]Battery voltage: 0.04[0A]Battery raw: 9.00[0A]Sleep time: 15 minutes[0A]Recheck time: 30 seconds[0A]VoltageFactor (977): 0.977[0A]Temperature: 21.81 [C2|B0]C[0A]Door is closed[0A]Door is unlocked[0A]WiFi signal at 47 %[0A]Sleeping until: 06:28:10[0A]
[3860] <[0E|00|0C|00|1F]Notice![0A|0A|E2|9A|AB] Battery low: 0.04V
[3860] Disconnected
Image for compare, wake time was stamped as 06:27:39 and should have been between those two
@Fettkeewl does RTC return the time when you get the error? Do you have a check for 1970? Perhaps you could add a short blocking routine to check for 1970, say try several times for X seconds.
As I am printing the same information to serial monitor as to Blynk terminal, the serial monitor log i pasted above contains information that should have been readable in the terminal. Hence my issue.
Everything in the background seems to work when my error occurs this from the fact that I get the expected output in Serial monitor
Explaining further every
------------- time stamp - - - - - - - - - -
Wall of text...
**...
Sleep until: time stamp
That you see in my terminal in the image signifies one wake cycle. There is one wake cycle missing, but I have that cycles data from the serial monitor
As you wish altough its a repeat of the above
I’ll remove the Blynk debug text for easier read since it is posted above
Serial Monitor Shows (for the part that is missing in terminal)
*WM:
*WM: Adding parameter
*WM: static IP
*WM: Adding parameter
*WM: blynk-token
*WM: Adding parameter
*WM: blynk-server
*WM: Adding parameter
*WM: blynk-port
*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 3
*WM: IP Address:
*WM: 192.168.1.10
Connecting to 192.168.1.3:8442
Ready (ping: 3ms).
Free RAM: 37144
Time sync: OK
---------------- 06:27:39 ----------------
Wake Reason: Door open
Chip RstReason: Deep-Sleep Wake
Battery voltage: 0.04
Battery raw: 9.00
Sleep time: 15 minutes
Recheck time: 30 seconds
Voltage factor (977): 0.977
Temperature: 21.81 °C
Door is closed
Door is unlocked
WiFi signal at 47 %
Sleeping until: 06:28:10
So terminal SHOULD have shown like this if it worked properly
The bolded is MISSING in terminal but appears in Serial monitor as per text above
---------------- 06:14:53 ----------------
Wake Reason: Door open
Chip RstReason: Deep-Sleep Wake
Battery voltage: 0.04
Battery raw: 9.00
Sleep time: 15 minutes
Recheck time: 30 seconds
Voltage factor (977): 0.977
Temperature: 21.69 °C
Door is closed
Door is unlocked
WiFi signal at 53 %
Sleeping until: 06:30:00
---------------- 06:27:39 ---------------- Wake Reason: Door open Chip RstReason: Deep-Sleep Wake Battery voltage: 0.04 Battery raw: 9.00 Sleep time: 15 minutes Recheck time: 30 seconds Voltage factor (977): 0.977 Temperature: 21.81 °C Door is closed Door is unlocked WiFi signal at 47 % Sleeping until: 06:28:10
---------------- 06:28:13 ----------------
Wake Reason: Door open
Chip RstReason: Deep-Sleep Wake
Battery voltage: 0.04
Battery raw: 9.00