Skip to content

Report NTP the same way in the header badge as in the Services tile - #1327

Merged
gskjold merged 1 commit into
mainfrom
fix/ntp-badge-matches-services
Dec 4, 2026
Merged

gskjold merged 1 commit into
mainfrom
fix/ntp-badge-matches-services

Conversation

@gskjold

@gskjold gskjold commented Nov 23, 2026

Copy link
Copy Markdown
Member

Why

The two places that show NTP status use different rules:

  • Services badge in the header (data.json sa, from AmsWebServer::computeServicesAggregate()): NTP counts as OK as soon as the clock is later than the build time.
  • Services tile and the MQTT services announcement (AmsJsonGenerator::generateServicesJson()): NTP is "connecting" until the first SNTP sync after boot, and again when no sync has succeeded for 3 hours (Track last SNTP sync time to flag a stale clock on the Services tile #1221).

So the badge could be green while the tile it links to showed NTP yellow.

Changes

  • Move the tile's rule into AmsJsonGenerator::ntpState(), next to hanState() and mqttHandlerState(), and use it in both places.
  • The other services already use the same logic in both places.

Verification

  • pio run for esp8266dev, esp32dev and esp32s2dev.
  • pio test -e native passes.
  • Not tested on a device.

🤖 Generated with Claude Code

The Services badge counted NTP as OK as soon as the clock was set, while the
Services tile and the MQTT services announcement report it as connecting until
the first SNTP sync and again when no sync has succeeded for 3 hours. The
badge could be green while the tile showed NTP yellow.

Move the tile's rule into AmsJsonGenerator::ntpState() and use it for both,
like hanState() and mqttHandlerState().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

🔧 PR Build Artifacts

Version: ba7fb7e

All environments built successfully. Download the zip files:

Artifacts expire after 7 days. View workflow run

@gskjold gskjold added this to the v2.6.1 milestone Nov 26, 2026
@gskjold
gskjold merged commit 99cd928 into main Dec 4, 2026
8 checks passed
@gskjold
gskjold deleted the fix/ntp-badge-matches-services branch December 4, 2026 09:11
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