From b39e3a79bc38c157a4618e4287dfa9da635a20e4 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Fri, 26 Jul 2024 01:12:25 -0600 Subject: [PATCH] [homekit] Fix duplicate name characteristic errors (#17151) 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 --- .../internal/accessories/AbstractHomekitAccessoryImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitAccessoryImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitAccessoryImpl.java index 5a85d496244..7f36bcd62dc 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitAccessoryImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitAccessoryImpl.java @@ -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.