mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
add NTP status to mqtt/ha (heartbeat) and log
This commit is contained in:
@@ -154,14 +154,13 @@ class System {
|
||||
ethernet_connected_ = b;
|
||||
}
|
||||
|
||||
void ntp_connected(bool b) {
|
||||
ntp_connected_ = b;
|
||||
ntp_last_check_ = b ? uuid::get_uptime_sec() : 0;
|
||||
}
|
||||
void ntp_connected(bool b);
|
||||
|
||||
bool ntp_connected() {
|
||||
// timeout 2 hours, ntp sync is normally every hour.
|
||||
ntp_connected_ = (uuid::get_uptime_sec() - ntp_last_check_ > 7201) ? false : ntp_connected_;
|
||||
if ((uuid::get_uptime_sec() - ntp_last_check_ > 7201) && ntp_connected_) {
|
||||
ntp_connected(false);
|
||||
}
|
||||
return ntp_connected_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user