show ntp in info

This commit is contained in:
proddy
2025-11-06 12:56:42 +01:00
parent 4a6ccce09a
commit c28b098c65

View File

@@ -1452,6 +1452,7 @@ bool System::command_service(const char * cmd, const char * value) {
ok = true; ok = true;
} }
} }
int n; int n;
if (!ok && Helpers::value2number(value, n)) { if (!ok && Helpers::value2number(value, n)) {
#ifndef EMSESP_STANDALONE #ifndef EMSESP_STANDALONE
@@ -1671,15 +1672,19 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
// NTP status // NTP status
node = output["ntp"].to<JsonObject>(); node = output["ntp"].to<JsonObject>();
#ifndef EMSESP_STANDALONE
node["NTPStatus"] = EMSESP::system_.ntp_connected() ? "connected" : "disconnected";
EMSESP::esp32React.getNTPSettingsService()->read([&](const NTPSettings & settings) { EMSESP::esp32React.getNTPSettingsService()->read([&](const NTPSettings & settings) {
#ifndef EMSESP_STANDALONE
node["enabled"] = settings.enabled; node["enabled"] = settings.enabled;
#else
node["enabled"] = true;
#endif
node["server"] = settings.server; node["server"] = settings.server;
node["tzLabel"] = settings.tzLabel; node["tzLabel"] = settings.tzLabel;
}); });
#ifndef EMSESP_STANDALONE
node["timestamp"] = time(nullptr); node["timestamp"] = time(nullptr);
#endif #endif
node["NTPStatus"] = EMSESP::system_.ntp_connected() ? "connected" : "disconnected";
// AP Status // AP Status
node = output["ap"].to<JsonObject>(); node = output["ap"].to<JsonObject>();