]> git.basschouten.com Git - openhab-addons.git/commitdiff
[velux] Do not use new API on Somfy devices (#14225)
authorAndrew Fiddian-Green <software@whitebear.ch>
Sun, 29 Jan 2023 09:32:33 +0000 (09:32 +0000)
committerGitHub <noreply@github.com>
Sun, 29 Jan 2023 09:32:33 +0000 (10:32 +0100)
* [velux] revert use of new API for Somfy devices
* [velux] fix compare to wrong value

Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/handler/ChannelActuatorPosition.java
bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/things/VeluxProductPosition.java

index 81c93697ec326b8ccef99ffc0c6817e1d9051730..bf9a9ee5619fc624585b505aba3b56d6e67da80d 100644 (file)
@@ -95,10 +95,18 @@ final class ChannelActuatorPosition extends ChannelHandlerTemplate {
                 break;
             }
 
+            final VeluxExistingProducts existingProducts = thisBridgeHandler.existingProducts();
+
             GetProduct bcp = null;
             switch (channelId) {
                 case CHANNEL_ACTUATOR_POSITION:
                 case CHANNEL_ACTUATOR_STATE:
+                    // apparently Somfy products do not to support new API; so use older API instead
+                    if (existingProducts.get(veluxActuator.getProductBridgeIndex()).isSomfyProduct()) {
+                        bcp = thisBridgeHandler.thisBridge.bridgeAPI().getProduct();
+                        break;
+                    }
+                    // fall through
                 case CHANNEL_VANE_POSITION:
                     bcp = thisBridgeHandler.thisBridge.bridgeAPI().getProductStatus();
                 default:
@@ -118,7 +126,6 @@ final class ChannelActuatorPosition extends ChannelHandlerTemplate {
 
             VeluxProduct newProduct = bcp.getProduct();
             ProductBridgeIndex productBridgeIndex = newProduct.getBridgeProductIndex();
-            VeluxExistingProducts existingProducts = thisBridgeHandler.existingProducts();
             VeluxProduct existingProduct = existingProducts.get(productBridgeIndex);
             ProductState productState = newProduct.getProductState();
             switch (productState) {
index b303fbb9ee8d110e5f5a2395a19e23dbe11aa977..851e277b1f7a26000626cb19de56ff3ecf15e65f 100644 (file)
@@ -140,7 +140,7 @@ public class VeluxProductPosition {
     }
 
     public static boolean isUnknownOrValid(int position) {
-        return (position == VeluxProductPosition.VPP_UNKNOWN) || isValid(position);
+        return (position == VeluxProductPosition.VPP_VELUX_UNKNOWN) || isValid(position);
     }
 
     /**