# Sync with latest server value every time device connects to the cloud

Enable this option to set higher priority to the values changes made in Blynk.Apps or Blynk.Console instead of those sent from a Device. Useful for controlling Devices.

For example, a user owns a wi-fi connected dimmer light

1. The device goes offline
2. User sets the brightness of the light to 100% in the mobile app or on the web
3. When the device comes back online, it can request the latest value from the server and set brightness to 100

To sync the device to the latest state, use the firmware API commands:

Blynk.syncAll() will sync only Datastreams that are enabled for sync (with this setting).

BLYNK\_CONNECTED() { // when device is conneceted to Blynk Cloud... Blynk.syncAll(); // request the values for all datastreams that has "sync" setting enabled } Blynk.sync() will sync any requested Datastream, even if sync setting is not enabled for the specified datastream

BLYNK\_CONNECTED() { // when device is conneceted to Blynk Cloud... Blynk.sync(V0); // syncs V0 pin only (even if sync setting is off for V0 }


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blynk.io/en/blynk.console/templates/datastreams/datastreams-common-settings/sync-with-latest-server-value-every-time-device-connects-to-the-cloud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
