diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java index 7fa41890faeb2..563c6a3f486a7 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java @@ -148,6 +148,8 @@ protected synchronized void modified(Map config) { try { HomekitSettings oldSettings = settings; settings = processConfig(config); + if ((oldSettings == null) || (settings == null)) + return; changeListener.updateSettings(settings); if (!oldSettings.networkInterface.equals(settings.networkInterface) || oldSettings.port != settings.port || oldSettings.useOHmDNS != settings.useOHmDNS) { diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java index 7cd25e2ee00f3..a9d1b0d350728 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAccessoryFactory.java @@ -142,16 +142,17 @@ public class HomekitAccessoryFactory { }; private static List getRequiredCharacteristics(HomekitTaggedItem taggedItem) { + final List characteristics = new ArrayList<>(); + if (MANDATORY_CHARACTERISTICS.containsKey(taggedItem.getAccessoryType())) { + characteristics.addAll(Arrays.asList(MANDATORY_CHARACTERISTICS.get(taggedItem.getAccessoryType()))); + } if (taggedItem.getAccessoryType() == BATTERY) { final String isChargeable = taggedItem.getConfiguration(HomekitBatteryImpl.BATTERY_TYPE, "false"); if ("true".equalsIgnoreCase(isChargeable) || "yes".equalsIgnoreCase(isChargeable)) { - final List characteristics = new ArrayList<>(); - characteristics.addAll(Arrays.asList(MANDATORY_CHARACTERISTICS.get(taggedItem.getAccessoryType()))); characteristics.add(BATTERY_CHARGING_STATE); - return characteristics; } } - return Arrays.asList(MANDATORY_CHARACTERISTICS.get(taggedItem.getAccessoryType())); + return characteristics; } /**