Blynk widget states and sleeping devices

I have a large project that uses a Particle Core that is battery powered and have added Blynk to it. Since it is battery powered it goes to sleep after 30 seconds of idle time and wakes up either every hour or when there is a certain amount of sound. Right now if I let the Core go to sleep, exit the Blynk app, and relaunch the application everything is cleared (LED, LCD, and terminal). How is this supposed to work? Shouldn’t the widgets be left in the state they were already in?

Another issue is I use a switch button and I would like to detect the state of the button/virtual PIN when the Core wakes up. If I hit the button when the device is asleep, it doesn’t generate an event when it wakes up. How would I handle this?

Also, another issue is with the LCD widget. If I print two lines to the LCD they print fine, but if I exit Blynk app and return to it only the last line I printed displays. What is that about and how would I fix it?

@Dmitriy Wondering if I could get some input. I was also looking at SyncAll(), not sure if that is in place yet in the cloud. Also, not sure exactly how that would work.

This should not happen. Are you sure your core doesn’t reset all widget states?

They should.

It doesn’t. You may need sync command for that (in case button in switch mode).

It is look like problem with your code.

It is.

Did you see example?

This is happening after the Core is in deep sleep and not reporting any values. It seems that after it has been offline for a little bit states start clearing.

I would like to see this, but this wasn’t the case.

From the documentation I’m not clear on what the sync command does exactly. Does the sync command set all virtual pin values based on what is currently set on the app? If so, will all the values generate BLYNK_WRITE events?

How should I be doing this? This is currently how I write two lines the LCD. Should I be doing it differently?

lcd.print(0, 0, "State 1: True");
lcd.print(0, 1, "State 2: False");

Same question as above…

From the documentation I’m not clear on what the sync command does exactly. Does the sync command set all virtual pin values based on what is currently set on the app? If so, will all the values generate BLYNK_WRITE events?

Yes. Yes.

Yeap. It is ok. Maybe you run it in main loop?

Please check pin state via HTTP API (http://cloud.blynk.cc:8080/AUTH_TOKEN/pin/V1). If pin state in HTTP no equal in-app state - this is application bug and should be fixed.