mirror of
https://github.com/esphome/esphome.git
synced 2024-12-18 15:57:58 +01:00
Fix time.on_time triggering if time jumped back (#1806)
Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
parent
b0d12aeea1
commit
dd637582a4
@ -22,7 +22,10 @@ void CronTrigger::loop() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (this->last_check_.has_value()) {
|
if (this->last_check_.has_value()) {
|
||||||
if (*this->last_check_ >= time) {
|
if (*this->last_check_ > time && this->last_check_->timestamp - time.timestamp > 900) {
|
||||||
|
// We went back in time (a lot), probably caused by time synchronization
|
||||||
|
ESP_LOGW(TAG, "Time has jumped back!");
|
||||||
|
} else if (*this->last_check_ >= time) {
|
||||||
// already handled this one
|
// already handled this one
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user