]> git.basschouten.com Git - openhab-addons.git/commitdiff
[remoteopenhab] Optimize filtering of ALIVE events (#13432)
authorlolodomo <lg.hc@free.fr>
Wed, 28 Sep 2022 18:39:20 +0000 (20:39 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Sep 2022 18:39:20 +0000 (20:39 +0200)
* [remoteopenhab] Optimize handling of ALIVE events

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.remoteopenhab/src/main/java/org/openhab/binding/remoteopenhab/internal/rest/RemoteopenhabRestClient.java

index c19a6335e06eec586cbc8f70fec3f56b9bf6ba1a..ef4e865c5791ebf63b0ddcb0c87bc129113012e5 100644 (file)
@@ -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;