Detect when ESP App comes on line

I’d like to update the Blynk app with current states of the ESP8266 when i start the app. The problem is if i quit the blynk app or hit the play/stop button in the blynk app all the current data I’ve sent to the app is gone.

Here is a quick example. Say I am turning on an LED with with the blynk app and I want some feed back using the LED’s in the Blynk app. Currently I’m pushing data from the ESP to the App when a change is made. If I quit the Blynk app and start it up again the app has no idea if the LED is on or off. I’ve created a hack that keeps sending updated data to the app if he hasn’t gotten an button presses from the app for a while but that is not elegant and not in near real time like a button press is. is there a way for my ESP8266 to know when an App is open and Idling so I can update the App status?

Look up sync in the Blynk docs.

Cosas,

Thanks for the replay. I currently am using sync and that works great for the Hardware. It still does not update the status of the App for me. The only way I can see a sync with the app is a Blynk.virtualWrite after the app is connected and open. It doesn’t seam to update the app at first open. the Blynk.sync works great on the device to go the other way. I find I have to do a Blunk.virtualWrite after the Blynk app is open and the play button is pressed. If I do a Blunk.virtualWrite when the app is in a stopped mode and then start it the App never resync’s.

Why are you stopping your app?

I can think of tons of applications where I’ll be stopping the app while running. Automation is a great example. I want to turn the light off on the table. it might be 3 days later that I want to turn the light back on. By then my phone could have rebooted etc. Maybe I’m not home and I want to turn on the light. I need to know the status of the light to see if it is on or off. and constantly sending a blynk.write to the server is a waste of bandwidth.

We also have a BLYNK_READ functionality: http://docs.blynk.cc/#blynk-main-operations-get-data-from-hardware-perform-requests-by-widget

When it’s used - requests are generated by the Widget. For example, you can attach a Value Display Widget to some Virtual Pin, set the Frequency parameter and get the status of the V Pin only when open the Blynk app.
Hardware will be silent until the app requests data.