[netatmo] Do not ignore updated events (same timestamp) (#12701)

Fix #12699

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
pull/12710/head
lolodomo 2022-05-08 12:08:02 +02:00 committed by GitHub
parent 8830ed527e
commit 553fcfa3b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 8 deletions

View File

@ -15,8 +15,6 @@ package org.openhab.binding.netatmo.internal.handler.channelhelper;
import static org.openhab.binding.netatmo.internal.NetatmoBindingConstants.*;
import static org.openhab.binding.netatmo.internal.utils.ChannelTypeUtils.*;
import java.time.ZonedDateTime;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.netatmo.internal.api.data.ModuleType;
@ -37,7 +35,6 @@ import org.openhab.core.types.UnDefType;
@NonNullByDefault
public class EventChannelHelper extends ChannelHelper {
private boolean isLocal;
private @Nullable ZonedDateTime lastEventTime;
private @Nullable String vpnUrl, localUrl;
private ModuleType moduleType = ModuleType.UNKNOWN;
@ -63,12 +60,9 @@ public class EventChannelHelper extends ChannelHelper {
public void setNewData(@Nullable NAObject data) {
if (data instanceof Event) {
Event event = (Event) data;
ZonedDateTime localLast = lastEventTime;
ZonedDateTime eventTime = event.getTime();
if ((localLast != null && !eventTime.isAfter(localLast)) || !event.getEventType().appliesOn(moduleType)) {
return; // ignore incoming events if they are deprecated
if (!event.getEventType().appliesOn(moduleType)) {
return;
}
lastEventTime = eventTime;
}
super.setNewData(data);
}