Skip to content

Conversation

Revers-BR
Copy link

Description

This pull request replaces the manual timezone configuration with dynamic timezone detection using the ezTime library. The device now determines its timezone based on the IP address using the public API ip-api.com.

Changes introduced

  • Integrated the ezTime library for timezone and NTP support
  • Replaced the setTimezone() function with setTimezoneByIP(), which:
    • Performs an HTTP GET request to retrieve timezone information based on IP
    • Calls tz.setLocation() using the received timezone string
    • Automatically synchronizes the device time using NTP (waitForSync())
  • Replaced getLocalTime() with ezTime::now() and localtime() for building the struct tm
  • Updated updateTimeDisplayData() to reflect the new timezone-aware implementation
  • Retained date/time formatting using strftime()

Benefits

  • Automatically handles Daylight Saving Time (DST) transitions
  • Eliminates the need for hardcoded POSIX timezone strings
  • Increases portability and flexibility for international deployments

Notes

  • Requires an active Wi-Fi connection to perform IP-based timezone detection
  • The ezTime library must be installed via the Arduino Library Manager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant