Time Sync Card
This feature is only available in ESP-DASH Pro
A utility card for synchronizing device time with the MCU using browser time data. Enables precise timekeeping functionality while requiring both device and MCU to be in the same timezone for accurate synchronization.
💡
Time sync card grabs the time from your browser, so only use it when your device and MCU are known to be in the same geographical location/timezone.
Initializer
/*
Time Sync Card
Valid Arguments: (ESPDash dashboard, Card Type, const char* name)
*/
Card timesync(&dashboard, TIME_SYNC_CARD, "Time Sync");
Callback
timesync.attachCallback([&](const char* value){
Serial.println("Time Sync Triggered: "+String(value));
});
Updater
💡
Time sync card doesn’t require any updater.
Reference
This is a reference sketch showing positions for intializer and callback.
...
/* Time sync card initializer */
Card timesync(&dashboard, TIME_SYNC_CARD, "Time Sync");
void setup() {
...
/* Time sync card callback */
timesync.attachCallback([&](const char* value){
Serial.println("Time Sync Triggered: "+String(value));
});
}
void loop() {
...
}