ntp - wolfen351/public-micropython-iot-platform GitHub Wiki

Overview

The NTP (Network Time Protocol) module is responsible for synchronizing the device's local time with an NTP server. It provides functionality to adjust for time zones and daylight saving time (DST) based on user preferences. The module also exposes telemetry data and a web-based interface for configuration.

Features

  • Synchronizes local time with an NTP server (0.nz.pool.ntp.org by default).
  • Supports time zone configuration using IANA time zone names.
  • Adjusts for daylight saving time (DST) where applicable.
  • Provides telemetry data in ISO 8601 format.
  • Web-based configuration interface for time zone and offset settings.

UI Hardware / Pinout Configuration

No specific hardware or pinout configuration is required for this module. It relies on the device's network interface for NTP synchronization.

Telemetry Provided

  • Time: Current local time in ISO 8601 format.
  • Time Zone: Configured time zone name.
  • NTP Status: Indicates whether the time is synchronized.

Telemetry Consumed

This module does not consume telemetry from other modules.

Commands Provided

  • /ntploadsettings: Loads the current NTP settings.
  • /ntpsavesettings: Saves the updated NTP settings.

Commands Consumed

This module does not consume commands from other modules.

Additional Information

  • The module currently uses a hardcoded NTP server (0.nz.pool.ntp.org).
  • DST adjustments are limited to specific time zones (e.g., "Pacific/Auckland").
  • Future improvements could include:
    • Support for dynamic NTP server configuration.
    • Enhanced DST handling for more time zones.
    • Improved error handling and logging.
    • Integration with other modules for advanced time-based features.