]> git.basschouten.com Git - openhab-addons.git/commitdiff
[homekit] fix window coverings based on groups of rollershutters (#13232)
authorCody Cutrer <cody@cutrer.us>
Mon, 8 Aug 2022 07:43:54 +0000 (01:43 -0600)
committerGitHub <noreply@github.com>
Mon, 8 Aug 2022 07:43:54 +0000 (09:43 +0200)
it was getting the state as a decimal type, not a percent type, so
it was getting 1 instead of 100.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitPositionAccessoryImpl.java

index 4ce3602883061d91c871714d50c7f35a9c170789..0cbb761b13cb53f6f6ce50af2faa43ada2566b50 100644 (file)
@@ -164,7 +164,15 @@ abstract class AbstractHomekitPositionAccessoryImpl extends AbstractHomekitAcces
         final Optional<HomekitTaggedItem> taggedItem = getCharacteristic(type);
         if (taggedItem.isPresent()) {
             final Item item = taggedItem.get().getItem();
-            if ((item instanceof RollershutterItem) || ((item instanceof DimmerItem))) {
+            Item baseItem = item;
+            // Check the type of the base item for a group item
+            if (item instanceof GroupItem) {
+                baseItem = ((GroupItem) item).getBaseItem();
+                if (baseItem == null) {
+                    baseItem = item;
+                }
+            }
+            if (baseItem instanceof RollershutterItem || baseItem instanceof DimmerItem) {
                 value = item.getStateAs(PercentType.class);
             } else {
                 value = item.getStateAs(DecimalType.class);