]> git.basschouten.com Git - openhab-addons.git/commitdiff
[homekit] Fix duplicate name characteristic errors (#17151)
authorCody Cutrer <cody@cutrer.us>
Fri, 26 Jul 2024 07:12:25 +0000 (01:12 -0600)
committerGitHub <noreply@github.com>
Fri, 26 Jul 2024 07:12:25 +0000 (09:12 +0200)
Depending on how the accessory initializes, optional characteristics
may be added before or after the service. For IrrigationSystem, it's
added before optional characteristics.

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

index 5a85d496244f93fcbcf5838cf0209398ba9e9697..7f36bcd62dcb77b72bef54b6dd6d89aa10baaaaa 100644 (file)
@@ -451,6 +451,10 @@ public abstract class AbstractHomekitAccessoryImpl implements HomekitAccessory {
             return;
         }
         rawCharacteristics.put(characteristic.getClass(), characteristic);
+        // belongs on the accessory information service
+        if (characteristic.getClass() == NameCharacteristic.class) {
+            return;
+        }
         var service = getPrimaryService();
         if (service != null) {
             // find the corresponding add method at service and call it.