fixed alarm rule with future ts

This commit is contained in:
YevhenBondarenko 2024-05-23 23:45:40 +02:00
parent a8dee2643b
commit 213663268d

View File

@ -250,8 +250,9 @@ class AlarmState {
newAlarm.setCleared(false); newAlarm.setCleared(false);
newAlarm.setSeverity(severity); newAlarm.setSeverity(severity);
long startTs = dataSnapshot.getTs(); long startTs = dataSnapshot.getTs();
if (startTs == 0L) { long currentTime = System.currentTimeMillis();
startTs = System.currentTimeMillis(); if (startTs == 0L || startTs > currentTime) {
startTs = currentTime;
} }
newAlarm.setStartTs(startTs); newAlarm.setStartTs(startTs);
newAlarm.setEndTs(startTs); newAlarm.setEndTs(startTs);