What happens to BLYNK_WRITE when offline

Say you have this

BLYNK_WRITE(V2)
{
  FunctionMode = param.asInt();   //READ OR CONTROL MODE
}

where V2 is a button widget and it is set to 1 (ON) and you go offline, what is FunctionMode set while offline?

It would remain the same as it was prior to going offline.

And if you included a BLYNK_CONNECTED callback function which contained a Blynk.syncVirtual(V2) command then it would force your BLYNK_WRITE(V2) callback to be triggered automatically whenever your device comes back online and re-connects to the Blynk server.

Pete.

Brilliant thanks

Does that include all types of data? Meaning say I have a numeric input setting widget set say at 55.5 when offline the data is still 55.5?

The BLYNK_WRITE(V2) callback is triggered when the value of your widget attached to V2 changes. If is a numeric I put widget and you set it to 55.5 when the device is online then 5he value of the variable in your sketch will change, because the callback function has been triggered.
If you initialise that variable at a value of zero on start-up and the device is offline then the value will still be zero, because it’s not been able to contact the Blynk server to get the latest value from the app.

If it gets the value from the server then goes offline, but doesn’t restart, then it’ll retain that last value, even though the value in the app may since have changed. If you have a Blynk.syncVirtual command set-up as I discussed earlier then it will get the latest value from the server when it re-connects.

Pete.

Thanks for that. Yes I do have the virtual sync statements as you suggested. I only used those as per recommendation on a previous post. I was just curious to learn what values remain at offline.

The thing is I would like to simulate the situation and see but that would be hard as it would mean switching off my router which would cause WW3 in my household

Or just connect your device to a power bank and walk down the street so that you are out of Wi-Fi range?

You could also set-up a secondary wireless access point with a different SSID and have your device connect to that, then switch it off to cause a disconnection - that’s what I do.

Pete.

I like the secondary WAP idea. Think I will invest in that