Can read back, modify, and update a virtual variable

Hardware: ESP32 Phone: ANDROID 13.
I would like to know if I could read back a virtual variable that was previously sent to Blynk, when my ESP32 reboots after a fault or crash. The reason is if the ESP32 crashes, I do not want to loose the accumulated value. I am using it to time my furnace operating time. it sends that time once a week and then resets to zero. In other words, use the blynk virtual variable as a non-volatile storage. So if something goes wrong I will not lose the value like I would if I depended on a volatile variable in the ESP32. Instead, I could get the last value from Blynk.
Is this possible ?
On another device, I used a feature allowing transfer of a value from one device to the other. But I couldn’t do that transferring back to the same device.

Yes, of course.

Assuming that your furnace operating time is stored in a global integer variable called furnace_time and it’s value is being written to datastream V1, you add the following to your sketch…

BLYNK_CONNECTED()
{
  Blynk.syncVirtual(V1);
}


BLYNK_WRITE(V1)
{   
  furnace_time = param.asInt(); // Get the last value written to Blynk
}

Explanation…

BLYNK_CONNECTED() is called whenever your device connects or re-connects to Blynk. This will usually be when your device has rebooted after a power loss.

Blynk.syncVirtual(V1) tells the Blynk server to write the current value of the V1 datastream back to the device. This triggers the BLYNK_WRITE(V1) “callback” function and the param.asInt() command extracts the value that’s sent back as an integer and assigns it to your furnace_time variable. If you’re not using a an integer variable for furnace_time hen choose the appropriate command from this list…

param.asInt()
param.asFloat()
param.asDouble()
param.asStr()

Pete.