]> git.basschouten.com Git - openhab-addons.git/commitdiff
[homekit] Support multiple values per enum mapping (#17144)
authorCody Cutrer <cody@cutrer.us>
Tue, 6 Aug 2024 06:11:41 +0000 (00:11 -0600)
committerGitHub <noreply@github.com>
Tue, 6 Aug 2024 06:11:41 +0000 (08:11 +0200)
* [homekit] Support multiple values per enum mapping

Signed-off-by: Cody Cutrer <cody@cutrer.us>
18 files changed:
bundles/org.openhab.io.homekit/README.md
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitAccessoryImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/AbstractHomekitPositionAccessoryImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitAirQualitySensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonDioxideSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonMonoxideSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitContactSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitFilterMaintenanceImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitHeaterCoolerImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitIrrigationSystemImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLeakSensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLockImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOccupancySensorImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSecuritySystemImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSlatImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmartSpeakerImpl.java
bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmokeSensorImpl.java

index 6e320cd00e6c5b5c31e55f7acec0998e576edf2c..66cd514115972db95dfcefdeed8be0bf8acf7135 100644 (file)
@@ -724,6 +724,25 @@ All enum values can be customized via item metadata. I.e. `HEAT="heating", COOL=
 They are appropriately marked.
 Enums that are linked to Switches or Contacts have an `inverted` param that will reverse the sense of `ON`/`OFF` or `OPEN`/`CLOSED`.
 
+Enum mappings can have multiple values for a single key.
+These must be an array, not a comma separated string.
+If the characteristic can be set by HomeKit, the first value will be used when sending the command to the linked item.
+Such a mapping can be configured manually in MainUI on HomeKit metadata in the Code editor:
+```yaml
+value: "Lock"
+config:
+  SECURE:
+    - LOCK
+    - LOCKED
+  UNSECURE:
+    - UNLOCK
+    - UNLOCKED
+```
+Or in a `.items` file:
+```java
+String MyLock "My Lock" { homekit="Lock"[SECURE="LOCK","LOCKED", UNSECURE="UNLOCK","UNLOCKED"] }
+```
+
 All accessories support the following characteristics that can be set via metadata or linked to a String item:
  * Name (defaults to item's label)
  * Manufacturer (defaults to "none")
index 7f36bcd62dcb77b72bef54b6dd6d89aa10baaaaa..8168c59a0526b177f1056f427238a154137f3d6d 100644 (file)
@@ -372,19 +372,19 @@ public abstract class AbstractHomekitAccessoryImpl implements HomekitAccessory {
     }
 
     @NonNullByDefault
-    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(
             HomekitCharacteristicType characteristicType, Class<T> klazz) {
         return createMapping(characteristicType, klazz, null, false);
     }
 
     @NonNullByDefault
-    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(
             HomekitCharacteristicType characteristicType, Class<T> klazz, boolean inverted) {
         return createMapping(characteristicType, klazz, null, inverted);
     }
 
     @NonNullByDefault
-    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(
             HomekitCharacteristicType characteristicType, Class<T> klazz, @Nullable List<T> customEnumList) {
         return createMapping(characteristicType, klazz, customEnumList, false);
     }
@@ -398,7 +398,7 @@ public abstract class AbstractHomekitAccessoryImpl implements HomekitAccessory {
      * @return mapping of enum values to custom string values
      */
     @NonNullByDefault
-    protected <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(
+    protected <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(
             HomekitCharacteristicType characteristicType, Class<T> klazz, @Nullable List<T> customEnumList,
             boolean inverted) {
         HomekitTaggedItem item = getCharacteristic(characteristicType).get();
@@ -416,7 +416,7 @@ public abstract class AbstractHomekitAccessoryImpl implements HomekitAccessory {
      * @return key for the value
      */
     @NonNullByDefault
-    public <T> T getKeyFromMapping(HomekitCharacteristicType characteristicType, Map<T, String> mapping,
+    public <T> T getKeyFromMapping(HomekitCharacteristicType characteristicType, Map<T, Object> mapping,
             T defaultValue) {
         final Optional<HomekitTaggedItem> c = getCharacteristic(characteristicType);
         if (c.isPresent()) {
index 21fdf0934998255f9bb0c62cb809c43cecb4ae0f..c54047fa98190a198d371b14f54fc277531641eb 100644 (file)
@@ -53,7 +53,7 @@ abstract class AbstractHomekitPositionAccessoryImpl extends AbstractHomekitAcces
     private final Logger logger = LoggerFactory.getLogger(AbstractHomekitPositionAccessoryImpl.class);
     protected int closedPosition;
     protected int openPosition;
-    private final Map<PositionStateEnum, String> positionStateMapping;
+    private final Map<PositionStateEnum, Object> positionStateMapping;
     protected boolean emulateState;
     protected boolean emulateStopSameDirection;
     protected boolean sendUpDownForExtents;
index 946201b0d9058c24889d02b3b27ee867e44022f1..5b9059c865f5f339c6832714d2f0aff67d50d06e 100644 (file)
@@ -35,7 +35,7 @@ import io.github.hapjava.services.impl.AirQualityService;
  * @author Eugen Freiter - Initial contribution
  */
 public class HomekitAirQualitySensorImpl extends AbstractHomekitAccessoryImpl implements AirQualityAccessory {
-    private final Map<AirQualityEnum, String> qualityStateMapping;
+    private final Map<AirQualityEnum, Object> qualityStateMapping;
 
     public HomekitAirQualitySensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
index d8a099b802f36a1c8147eae59dd7005d11f5ab9d..daef40df3c48d390e092458d7542ed002747a6b1 100644 (file)
@@ -35,7 +35,7 @@ import io.github.hapjava.services.impl.CarbonDioxideSensorService;
  */
 public class HomekitCarbonDioxideSensorImpl extends AbstractHomekitAccessoryImpl
         implements CarbonDioxideSensorAccessory {
-    private final Map<CarbonDioxideDetectedEnum, String> mapping;
+    private final Map<CarbonDioxideDetectedEnum, Object> mapping;
 
     public HomekitCarbonDioxideSensorImpl(HomekitTaggedItem taggedItem,
             List<HomekitTaggedItem> mandatoryCharacteristics, List<Characteristic> mandatoryRawCharacteristics,
index 179c223434f9e8d4440d1d64e9e545ba89a81bf1..51ab51f6eecf9ec61573a530b2ff0dfdb0f5e03c 100644 (file)
@@ -35,7 +35,7 @@ import io.github.hapjava.services.impl.CarbonMonoxideSensorService;
  */
 public class HomekitCarbonMonoxideSensorImpl extends AbstractHomekitAccessoryImpl
         implements CarbonMonoxideSensorAccessory {
-    private final Map<CarbonMonoxideDetectedEnum, String> mapping;
+    private final Map<CarbonMonoxideDetectedEnum, Object> mapping;
 
     public HomekitCarbonMonoxideSensorImpl(HomekitTaggedItem taggedItem,
             List<HomekitTaggedItem> mandatoryCharacteristics, List<Characteristic> mandatoryRawCharacteristics,
index 82bbad359f6e404433e10254ee194dab36685a10..9828ec7c267f9b742b3b1a12b8d4803c984d17e1 100644 (file)
@@ -26,6 +26,7 @@ import java.util.concurrent.CompletableFuture;
 import java.util.function.BiFunction;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
+import java.util.stream.Collectors;
 
 import javax.measure.Quantity;
 import javax.measure.Unit;
@@ -329,9 +330,9 @@ public class HomekitCharacteristicFactory {
      *            associated with, which has already been set.
      * @return
      */
-    public static <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(HomekitTaggedItem item,
+    public static <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(HomekitTaggedItem item,
             Class<T> klazz, @Nullable List<T> customEnumList, boolean inverted) {
-        EnumMap<T, String> map = new EnumMap(klazz);
+        EnumMap<T, Object> map = new EnumMap(klazz);
         var dataTypes = item.getBaseItem().getAcceptedDataTypes();
         boolean switchType = dataTypes.contains(OnOffType.class);
         boolean contactType = dataTypes.contains(OpenClosedType.class);
@@ -379,9 +380,22 @@ public class HomekitCharacteristicFactory {
         }
         if (configuration != null && !configuration.isEmpty()) {
             map.forEach((k, current_value) -> {
-                final Object newValue = configuration.get(k.toString());
-                if (newValue instanceof String || newValue instanceof Number) {
-                    map.put(k, newValue.toString());
+                Object newValue = configuration.get(k.toString());
+                if (newValue instanceof String || newValue instanceof Number || newValue instanceof List) {
+                    if (newValue instanceof Number) {
+                        newValue = newValue.toString();
+                    } else if (newValue instanceof List listValue) {
+                        newValue = listValue.stream().map(v -> {
+                            // they probably put "NULL" in the YAML in MainUI;
+                            // and they meant it as a string to match the UnDefType.NULL
+                            if (v == null) {
+                                return "NULL";
+                            } else {
+                                return v.toString();
+                            }
+                        }).collect(Collectors.toList());
+                    }
+                    map.put(k, Objects.requireNonNull(newValue));
                     if (customEnumList != null) {
                         customEnumList.add(k);
                     }
@@ -402,17 +416,17 @@ public class HomekitCharacteristicFactory {
         return map;
     }
 
-    public static <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(HomekitTaggedItem item,
+    public static <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(HomekitTaggedItem item,
             Class<T> klazz) {
         return createMapping(item, klazz, null, false);
     }
 
-    public static <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(HomekitTaggedItem item,
+    public static <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(HomekitTaggedItem item,
             Class<T> klazz, @Nullable List<T> customEnumList) {
         return createMapping(item, klazz, customEnumList, false);
     }
 
-    public static <T extends Enum<T> & CharacteristicEnum> Map<T, String> createMapping(HomekitTaggedItem item,
+    public static <T extends Enum<T> & CharacteristicEnum> Map<T, Object> createMapping(HomekitTaggedItem item,
             Class<T> klazz, boolean inverted) {
         return createMapping(item, klazz, null, inverted);
     }
@@ -427,7 +441,7 @@ public class HomekitCharacteristicFactory {
      * @param <T> type of the result derived from
      * @return key for the value
      */
-    public static <T> T getKeyFromMapping(HomekitTaggedItem item, State state, Map<T, String> mapping, T defaultValue) {
+    public static <T> T getKeyFromMapping(HomekitTaggedItem item, State state, Map<T, Object> mapping, T defaultValue) {
         LOGGER.trace("getKeyFromMapping: characteristic {}, state {}, mapping {}", item.getAccessoryType().getTag(),
                 state, mapping);
 
@@ -450,14 +464,23 @@ public class HomekitCharacteristicFactory {
             return defaultValue;
         }
 
-        return mapping.entrySet().stream().filter(entry -> value.equalsIgnoreCase(entry.getValue())).findAny()
-                .map(Map.Entry::getKey).orElseGet(() -> {
-                    LOGGER.warn(
-                            "Wrong value {} for {} characteristic of the item {}. Expected one of following {}. Returning {}.",
-                            state.toString(), item.getAccessoryType().getTag(), item.getName(), mapping.values(),
-                            defaultValue);
-                    return defaultValue;
-                });
+        return mapping.entrySet().stream().filter(entry -> {
+            Object mappingValue = entry.getValue();
+            if (mappingValue instanceof String stringValue) {
+                return value.equalsIgnoreCase(stringValue);
+            } else if (mappingValue instanceof List listValue) {
+                return listValue.stream().filter(listEntry -> value.equalsIgnoreCase(listEntry.toString())).findAny()
+                        .isPresent();
+            } else {
+                LOGGER.warn("Found unexpected enum value type {}; this is a bug.", mappingValue.getClass());
+                return false;
+            }
+        }).findAny().map(Map.Entry::getKey).orElseGet(() -> {
+            LOGGER.warn(
+                    "Wrong value {} for {} characteristic of the item {}. Expected one of following {}. Returning {}.",
+                    state.toString(), item.getAccessoryType().getTag(), item.getName(), mapping.values(), defaultValue);
+            return defaultValue;
+        });
     }
 
     // supporting methods
@@ -482,18 +505,31 @@ public class HomekitCharacteristicFactory {
     }
 
     private static <T extends CharacteristicEnum> CompletableFuture<T> getEnumFromItem(HomekitTaggedItem item,
-            Map<T, String> mapping, T defaultValue) {
+            Map<T, Object> mapping, T defaultValue) {
         return CompletableFuture
                 .completedFuture(getKeyFromMapping(item, item.getItem().getState(), mapping, defaultValue));
     }
 
-    public static <T extends Enum<T>> void setValueFromEnum(HomekitTaggedItem taggedItem, T value, Map<T, String> map) {
+    public static <T extends Enum<T>> void setValueFromEnum(HomekitTaggedItem taggedItem, T value, Map<T, Object> map) {
+        Object mapValue = map.get(value);
+        // if the mapping has multiple values for this enum, just use the first one for the command sent to the item
+        if (mapValue instanceof List listValue) {
+            if (listValue.isEmpty()) {
+                mapValue = null;
+            } else {
+                mapValue = listValue.get(0);
+            }
+        }
+        if (mapValue == null) {
+            LOGGER.warn("Unable to find mapping value for {} for item {}", value, taggedItem.getName());
+            return;
+        }
         if (taggedItem.getBaseItem() instanceof NumberItem) {
-            taggedItem.send(new DecimalType(Objects.requireNonNull(map.get(value))));
+            taggedItem.send(new DecimalType(mapValue.toString()));
         } else if (taggedItem.getBaseItem() instanceof SwitchItem) {
-            taggedItem.send(OnOffType.from(Objects.requireNonNull(map.get(value))));
+            taggedItem.send(OnOffType.from(mapValue.toString()));
         } else {
-            taggedItem.send(new StringType(map.get(value)));
+            taggedItem.send(new StringType(mapValue.toString()));
         }
     }
 
@@ -1242,7 +1278,7 @@ public class HomekitCharacteristicFactory {
     private static ProgrammableSwitchEventCharacteristic createProgrammableSwitchEventCharacteristic(
             HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater) {
         // have to build the map custom, since SINGLE_PRESS starts at 0
-        Map<ProgrammableSwitchEnum, String> map = new EnumMap(ProgrammableSwitchEnum.class);
+        Map<ProgrammableSwitchEnum, Object> map = new EnumMap(ProgrammableSwitchEnum.class);
         List<ProgrammableSwitchEnum> validValues = new ArrayList<>();
 
         if (taggedItem.getBaseItem().getAcceptedDataTypes().contains(OnOffType.class)) {
@@ -1264,11 +1300,11 @@ public class HomekitCharacteristicFactory {
     private static class ProgrammableSwitchEventCharacteristicHelper {
         private @Nullable ProgrammableSwitchEnum lastValue = null;
         private final HomekitTaggedItem taggedItem;
-        private final Map<ProgrammableSwitchEnum, String> map;
+        private final Map<ProgrammableSwitchEnum, Object> map;
         private final HomekitAccessoryUpdater updater;
 
         ProgrammableSwitchEventCharacteristicHelper(HomekitTaggedItem taggedItem, HomekitAccessoryUpdater updater,
-                Map<ProgrammableSwitchEnum, String> map) {
+                Map<ProgrammableSwitchEnum, Object> map) {
             this.taggedItem = taggedItem;
             this.map = map;
             this.updater = updater;
index b02d6ad59e5699ab781428dc9b2dd772af34cb64..e0cd02e9ab1ea8f799d08993ff076f40472e5c7f 100644 (file)
@@ -34,7 +34,7 @@ import io.github.hapjava.services.impl.ContactSensorService;
  * @author Philipp Arndt - Initial contribution
  */
 public class HomekitContactSensorImpl extends AbstractHomekitAccessoryImpl implements ContactSensorAccessory {
-    private final Map<ContactStateEnum, String> mapping;
+    private final Map<ContactStateEnum, Object> mapping;
 
     public HomekitContactSensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
index 2dcfcc046e10357caac36a5e77ed770b3d2b65a4..272e4eb3d831b77c6c3119692e2ac836e0966cbd 100644 (file)
@@ -35,7 +35,7 @@ import io.github.hapjava.services.impl.FilterMaintenanceService;
  * @author Eugen Freiter - Initial contribution
  */
 public class HomekitFilterMaintenanceImpl extends AbstractHomekitAccessoryImpl implements FilterMaintenanceAccessory {
-    private final Map<FilterChangeIndicationEnum, String> mapping;
+    private final Map<FilterChangeIndicationEnum, Object> mapping;
 
     public HomekitFilterMaintenanceImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
index 4a84ee72bb9f555a241158256ed582a9b37bba55..3d659a65918558404d3bc23d33b11c5d257fbd3d 100644 (file)
@@ -52,8 +52,8 @@ import io.github.hapjava.services.impl.HeaterCoolerService;
 public class HomekitHeaterCoolerImpl extends AbstractHomekitAccessoryImpl implements HeaterCoolerAccessory {
     private final Logger logger = LoggerFactory.getLogger(HomekitHeaterCoolerImpl.class);
     private final BooleanItemReader activeReader;
-    private final Map<CurrentHeaterCoolerStateEnum, String> currentStateMapping;
-    private final Map<TargetHeaterCoolerStateEnum, String> targetStateMapping;
+    private final Map<CurrentHeaterCoolerStateEnum, Object> currentStateMapping;
+    private final Map<TargetHeaterCoolerStateEnum, Object> targetStateMapping;
 
     private final List<CurrentHeaterCoolerStateEnum> customCurrentStateList = new ArrayList<>();
     private final List<TargetHeaterCoolerStateEnum> customTargetStateList = new ArrayList<>();
index 5b75f2de67543ad12df9103224834e288f891d5c..15ea88a8fae53a73262a511714d55b6abaf91e98 100644 (file)
@@ -46,8 +46,8 @@ import io.github.hapjava.services.impl.ServiceLabelService;
  */
 @NonNullByDefault({})
 public class HomekitIrrigationSystemImpl extends AbstractHomekitAccessoryImpl implements IrrigationSystemAccessory {
-    private Map<InUseEnum, String> inUseMapping;
-    private Map<ProgramModeEnum, String> programModeMap;
+    private Map<InUseEnum, Object> inUseMapping;
+    private Map<ProgramModeEnum, Object> programModeMap;
 
     public HomekitIrrigationSystemImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
index e059e19be1e2a4f8e5cc58f1ae163e5bce0906fd..9bd3c7b0a901d4486687a7e28fc4f2c105d37f7d 100644 (file)
@@ -34,7 +34,7 @@ import io.github.hapjava.services.impl.LeakSensorService;
  * @author Tim Harper - Initial contribution
  */
 public class HomekitLeakSensorImpl extends AbstractHomekitAccessoryImpl implements LeakSensorAccessory {
-    private final Map<LeakDetectedStateEnum, String> mapping;
+    private final Map<LeakDetectedStateEnum, Object> mapping;
 
     public HomekitLeakSensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
index 14e2a05f82d9ec19bd72c63190bc6159a5b231f4..1227744d719681bdd4e78b731480b6b8b9d5c907 100644 (file)
@@ -36,8 +36,8 @@ import io.github.hapjava.services.impl.LockMechanismService;
  *
  */
 public class HomekitLockImpl extends AbstractHomekitAccessoryImpl implements LockMechanismAccessory {
-    final Map<LockCurrentStateEnum, String> currentStateMapping;
-    final Map<LockTargetStateEnum, String> targetStateMapping;
+    final Map<LockCurrentStateEnum, Object> currentStateMapping;
+    final Map<LockTargetStateEnum, Object> targetStateMapping;
 
     public HomekitLockImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater,
index 54fc964b4941033aa92f27a9ff88723514b54621..c91e715de09f55f254dd81d58b832317aa421b5c 100644 (file)
@@ -34,7 +34,7 @@ import io.github.hapjava.services.impl.OccupancySensorService;
  * @author Tim Harper - Initial contribution
  */
 public class HomekitOccupancySensorImpl extends AbstractHomekitAccessoryImpl implements OccupancySensorAccessory {
-    private final Map<OccupancyDetectedEnum, String> mapping;
+    private final Map<OccupancyDetectedEnum, Object> mapping;
 
     public HomekitOccupancySensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)
index 1c4f623ea4149580c2e1f4c11c277bde2211d267..aa768788e364de868614b42c3258353a93f8ba0e 100644 (file)
@@ -43,8 +43,8 @@ import io.github.hapjava.services.impl.SecuritySystemService;
  * @author Cody Cutrer - Initial contribution
  */
 public class HomekitSecuritySystemImpl extends AbstractHomekitAccessoryImpl implements SecuritySystemAccessory {
-    private final Map<CurrentSecuritySystemStateEnum, String> currentStateMapping;
-    private final Map<TargetSecuritySystemStateEnum, String> targetStateMapping;
+    private final Map<CurrentSecuritySystemStateEnum, Object> currentStateMapping;
+    private final Map<TargetSecuritySystemStateEnum, Object> targetStateMapping;
     private final List<CurrentSecuritySystemStateEnum> customCurrentStateList = new ArrayList<>();
     private final List<TargetSecuritySystemStateEnum> customTargetStateList = new ArrayList<>();
 
index a8fe068033acf23cccdcab6765ef872cd26b31a8..1046a874ff5604efc65021a4f6047a07a307727a 100644 (file)
@@ -36,7 +36,7 @@ import io.github.hapjava.services.impl.SlatService;
  */
 public class HomekitSlatImpl extends AbstractHomekitAccessoryImpl implements SlatAccessory {
     private static final String CONFIG_TYPE = "type";
-    private final Map<CurrentSlatStateEnum, String> currentSlatStateMapping;
+    private final Map<CurrentSlatStateEnum, Object> currentSlatStateMapping;
     private final SlatTypeEnum slatType;
 
     public HomekitSlatImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
index 231fcfb3d65b78648d9119b09310abc02bb38099..95f7dda6471b0d1ad91c58217332f67adeffd23c 100644 (file)
@@ -36,8 +36,8 @@ import io.github.hapjava.services.impl.SmartSpeakerService;
  * @author Eugen Freiter - Initial contribution
  */
 public class HomekitSmartSpeakerImpl extends AbstractHomekitAccessoryImpl implements SmartSpeakerAccessory {
-    private final Map<CurrentMediaStateEnum, String> currentMediaState;
-    private final Map<TargetMediaStateEnum, String> targetMediaState;
+    private final Map<CurrentMediaStateEnum, Object> currentMediaState;
+    private final Map<TargetMediaStateEnum, Object> targetMediaState;
 
     public HomekitSmartSpeakerImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater,
index a2f4c02fa915d79fb3ebc3a30d81a416aa9084c1..6dc4de5f079287502ccb35f5f578a65fb40162ca 100644 (file)
@@ -34,7 +34,7 @@ import io.github.hapjava.services.impl.SmokeSensorService;
  * @author Cody Cutrer - Initial contribution
  */
 public class HomekitSmokeSensorImpl extends AbstractHomekitAccessoryImpl implements SmokeSensorAccessory {
-    private final Map<SmokeDetectedStateEnum, String> mapping;
+    private final Map<SmokeDetectedStateEnum, Object> mapping;
 
     public HomekitSmokeSensorImpl(HomekitTaggedItem taggedItem, List<HomekitTaggedItem> mandatoryCharacteristics,
             List<Characteristic> mandatoryRawCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings)