From d00ca1caebf8032288748a1e215361ac63e530e5 Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 28 Sep 2022 20:39:20 +0200 Subject: [PATCH] [remoteopenhab] Optimize filtering of ALIVE events (#13432) * [remoteopenhab] Optimize handling of ALIVE events Signed-off-by: Laurent Garnier --- .../internal/rest/RemoteopenhabRestClient.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/bundles/org.openhab.binding.remoteopenhab/src/main/java/org/openhab/binding/remoteopenhab/internal/rest/RemoteopenhabRestClient.java b/bundles/org.openhab.binding.remoteopenhab/src/main/java/org/openhab/binding/remoteopenhab/internal/rest/RemoteopenhabRestClient.java index c19a6335e06..ef4e865c579 100644 --- a/bundles/org.openhab.binding.remoteopenhab/src/main/java/org/openhab/binding/remoteopenhab/internal/rest/RemoteopenhabRestClient.java +++ b/bundles/org.openhab.binding.remoteopenhab/src/main/java/org/openhab/binding/remoteopenhab/internal/rest/RemoteopenhabRestClient.java @@ -400,17 +400,13 @@ public class RemoteopenhabRestClient { connected = true; listeners.forEach(listener -> listener.onConnected()); } + if (!"message".equals(name)) { + // Ignore silently all events which are not "message" events. This includes the "alive" events. + return; + } try { RemoteopenhabEvent event = jsonParser.fromJson(data, RemoteopenhabEvent.class); - if ("ALIVE".equals(event.type)) { - // ignore ALIVE message - return; - } - if (!"message".equals(name)) { - logger.debug("Received unhandled event with name '{}' and data '{}'", name, data); - return; - } String itemName; String thingUID; RemoteopenhabEventPayload payload;