Persistent control status

I have a switch controlled from my phone. It works fine.
But when the hardware restarts it does not restore the switch status set on my control application on phone. Is it possible to restore the status by any method.

Is there any way the phone app set a status on a google sheet and the hardware reads that status on every reboot and restore the state.

Is there any other better way to solve this.

Look at the documentation for whichever version of Blynk you are using and read about the BLYNK_CONNECTED() function which is triggered each time your hardware restarts or re-connects to the Blynk server, and the Blynk.syncVirtual() and the Blynk.syncAll() which can be used inside the BLYNK_CONNECTED() to force the server to send the latest values to the hardware.

Pete.

2 Likes

Thanks Pete.
I tried Blynk.syncAll(). I did not get the desired result.
But Blynk.syncVirtual() worked for me.

If you are using Blynk IoT then Blynk.syncAll() doesn’t work unless the Sync with latest server value every time device connects to the cloud option is enabled in the advanced datastream options, for each datastream that you wish to synchronise.
That’s why I suggested that you read the documentation for the relevant version of Blynk that you are using.

In future, it would make life much easier if you stated which version of Blynk that your question related to - that’s why you are prompted for this information when you create a new “need help…” topic.

Pete.