]> git.basschouten.com Git - openhab-addons.git/commitdiff
[ihc] Improved command handling when controller is not ready (#10895)
authorpali <pauli.anttila@gmail.com>
Thu, 15 Jul 2021 17:49:59 +0000 (20:49 +0300)
committerGitHub <noreply@github.com>
Thu, 15 Jul 2021 17:49:59 +0000 (19:49 +0200)
* [ihc] Improved command handling when controller is not ready

When connection from binding to IHC controller is open, but controller
is in programming state, things state is offline with special status to
indicate that binding can't send or receive any resource updates at the
moment. Things status check during command sending will prevent
unnecessary resource updates which will eventually fail and binding then
tries to restart the connection.

Signed-off-by: Pauli Anttila <pauli.anttila@gmail.com>
bundles/org.openhab.binding.ihc/src/main/java/org/openhab/binding/ihc/internal/handler/IhcHandler.java

index 9c7d36ea1e30bf7b53add4b1271ff2df1bd3c6ca..8590338583c2312ae6a0711f06840d8b774971b8 100644 (file)
@@ -202,16 +202,21 @@ public class IhcHandler extends BaseThingHandler implements IhcEventListener {
         logger.debug("Received channel: {}, command: {}", channelUID, command);
 
         if (ihc == null) {
-            logger.warn("Connection is not initialized, abort resource value update for channel '{}'!", channelUID);
+            logger.debug("Connection is not initialized, aborting resource value update for channel '{}'!", channelUID);
             return;
         }
 
         if (ihc.getConnectionState() != ConnectionState.CONNECTED) {
-            logger.warn("Connection to controller is not open, abort resource value update for channel '{}'!",
+            logger.debug("Connection to controller is not open, aborting resource value update for channel '{}'!",
                     channelUID);
             return;
         }
 
+        if (thing.getStatus() != ThingStatus.ONLINE) {
+            logger.debug("Controller is not ONLINE, aborting resource value update for channel '{}'!", channelUID);
+            return;
+        }
+
         switch (channelUID.getId()) {
             case CHANNEL_CONTROLLER_STATE:
                 if (command.equals(RefreshType.REFRESH)) {