diff --git a/bundles/org.openhab.io.homekit/README.md b/bundles/org.openhab.io.homekit/README.md index 763688c0129ae..4edf7b2f2eaf4 100644 --- a/bundles/org.openhab.io.homekit/README.md +++ b/bundles/org.openhab.io.homekit/README.md @@ -421,6 +421,9 @@ Following table summarizes the optional characteristics supported by sensors. | TamperedStatus | Switch, Contact | Accessory tampered status. "ON"/"OPEN" indicates that the accessory has been tampered. Value should return to "OFF"/"CLOSED" when the accessory has been reset to a non-tampered state. | | BatteryLowStatus | Switch, Contact | Accessory battery status. "ON"/"OPEN" indicates that the battery level of the accessory is low. Value should return to "OFF"/"CLOSED" when the battery charges to a level thats above the low threshold. | +Switch and Contact items support inversion of the state mapping, e.g. by default the openHAB switch state "ON" is mapped to HomeKit contact sensor state "Open", and "OFF" to "Closed". +The configuration "inverted='true'" inverts this mapping, so that "ON" will be mapped to "Closed" and "OFF" to "Open". + Examples of sensor definitions. Sensors without optional characteristics: @@ -429,6 +432,8 @@ Switch leaksensor_single "Leak Sensor" {homekit="LeakSenso Number light_sensor "Light Sensor" {homekit="LightSensor"} Number temperature_sensor "Temperature Sensor [%.1f C]" {homekit="TemperatureSensor"} Contact contact_sensor "Contact Sensor" {homekit="ContactSensor"} +Contact contact_sensor "Contact Sensor" {homekit="ContactSensor" [inverted="true"]} + Switch occupancy_sensor "Occupancy Sensor" {homekit="OccupancyDetectedState"} Switch motion_sensor "Motion Sensor" {homekit="MotionSensor"} Number humidity_sensor "Humidity Sensor" {homekit="HumiditySensor"} @@ -439,19 +444,24 @@ Sensors with optional characteristics: ```xtend Group gLeakSensor "Leak Sensor" {homekit="LeakSensor"} Switch leaksensor "Leak Sensor State" (gLeakSensor) {homekit="LeakDetectedState"} -Switch leaksensor_bat "Leak Sensor Battery" (gLeakSensor) {homekit="BatteryLowStatus"} -Switch leaksensor_active "Leak Sensor Active" (gLeakSensor) {homekit="ActiveStatus"} +Switch leaksensor_bat "Leak Sensor Battery" (gLeakSensor) {homekit="BatteryLowStatus" } +Switch leaksensor_active "Leak Sensor Active" (gLeakSensor) {homekit="ActiveStatus" [inverted="true"]} Switch leaksensor_fault "Leak Sensor Fault" (gLeakSensor) {homekit="FaultStatus"} Switch leaksensor_tampered "Leak Sensor Tampered" (gLeakSensor) {homekit="TamperedStatus"} Group gMotionSensor "Motion Sensor" {homekit="MotionSensor"} Switch motionsensor "Motion Sensor State" (gMotionSensor) {homekit="MotionDetectedState"} -Switch motionsensor_bat "Motion Sensor Battery" (gMotionSensor) {homekit="BatteryLowStatus"} +Switch motionsensor_bat "Motion Sensor Battery" (gMotionSensor) {homekit="BatteryLowStatus" [inverted="true"]} Switch motionsensor_active "Motion Sensor Active" (gMotionSensor) {homekit="ActiveStatus"} Switch motionsensor_fault "Motion Sensor Fault" (gMotionSensor) {homekit="FaultStatus"} Switch motionsensor_tampered "Motion Sensor Tampered" (gMotionSensor) {homekit="TamperedStatus"} ``` +or using UI + +![sensor_ui_config.png](doc/sensor_ui_config.png) + + ## Supported accessory type | Accessory Tag | Mandatory Characteristics | Optional Characteristics | Supported OH items | Description | @@ -490,7 +500,7 @@ Switch motionsensor_tampered "Motion Sensor Tampered" | | | FaultStatus | Switch, Contact | Fault status | | | | TamperedStatus | Switch, Contact | Tampered status | | | | BatteryLowStatus | Switch, Contact | Battery status | -| ContactSensor | | | | Contact Sensor,An accessory with on/off state that can be viewed in HomeKit but not changed such as a contact sensor for a door or window | +| ContactSensor | | | | Contact Sensor, An accessory with on/off state that can be viewed in HomeKit but not changed such as a contact sensor for a door or window | | | ContactSensorState | | Switch, Contact | Contact sensor state (ON=open, OFF=closed) | | | | Name | String | Name of the sensor | | | | ActiveStatus | Switch, Contact | Working status | diff --git a/bundles/org.openhab.io.homekit/doc/sensor_ui_config.png b/bundles/org.openhab.io.homekit/doc/sensor_ui_config.png new file mode 100644 index 0000000000000..ffd05c1ae5162 Binary files /dev/null and b/bundles/org.openhab.io.homekit/doc/sensor_ui_config.png differ diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java index cdcc6259fa716..52820f1c00d55 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java @@ -210,6 +210,16 @@ public T getConfiguration(String key, T defaultValue) { return defaultValue; } + /** + * returns true if inverted flag is set, i.e. item has the configuration "inverted=true" + * + * @return true if inverted flag is set to true + */ + public boolean isInverted() { + final String invertedConfig = getConfiguration(HomekitTaggedItem.INVERTED, "false"); + return invertedConfig.equalsIgnoreCase("yes") || invertedConfig.equalsIgnoreCase("true"); + } + /** * return configuration as double if exists otherwise return defaultValue * 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 9791afcf074c7..cad68e734e589 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 @@ -300,6 +300,15 @@ protected double convertFromCelsius(double degrees) { ImperialUnits.FAHRENHEIT); } + /** + * create boolean reader with ON state mapped to trueOnOffValue or trueOpenClosedValue depending of item type + * + * @param characteristicType characteristic id + * @param trueOnOffValue ON value for switch + * @param trueOpenClosedValue ON value for contact + * @return boolean readed + * @throws IncompleteAccessoryException + */ @NonNullByDefault protected BooleanItemReader createBooleanReader(HomekitCharacteristicType characteristicType, OnOffType trueOnOffValue, OpenClosedType trueOpenClosedValue) throws IncompleteAccessoryException { @@ -308,4 +317,20 @@ protected BooleanItemReader createBooleanReader(HomekitCharacteristicType charac .orElseThrow(() -> new IncompleteAccessoryException(characteristicType)), trueOnOffValue, trueOpenClosedValue); } + + /** + * create boolean reader with default ON/OFF mapping considering inverted flag + * + * @param characteristicType characteristic id + * @return boolean reader + * @throws IncompleteAccessoryException + */ + @NonNullByDefault + protected BooleanItemReader createBooleanReader(HomekitCharacteristicType characteristicType) + throws IncompleteAccessoryException { + final HomekitTaggedItem taggedItem = getCharacteristic(characteristicType) + .orElseThrow(() -> new IncompleteAccessoryException(characteristicType)); + return new BooleanItemReader(taggedItem.getItem(), taggedItem.isInverted() ? OnOffType.OFF : OnOffType.ON, + taggedItem.isInverted() ? OpenClosedType.CLOSED : OpenClosedType.OPEN); + } } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonDioxideSensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonDioxideSensorImpl.java index 4bfdf2d9feea3..59602829ae5d8 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonDioxideSensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonDioxideSensorImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -40,8 +38,7 @@ public HomekitCarbonDioxideSensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - carbonDioxideDetectedReader = createBooleanReader(CARBON_DIOXIDE_DETECTED_STATE, OnOffType.ON, - OpenClosedType.OPEN); + carbonDioxideDetectedReader = createBooleanReader(CARBON_DIOXIDE_DETECTED_STATE); getServices().add(new CarbonDioxideSensorService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonMonoxideSensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonMonoxideSensorImpl.java index dd0d92cfc0003..560456decc869 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonMonoxideSensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCarbonMonoxideSensorImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -40,8 +38,7 @@ public HomekitCarbonMonoxideSensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - carbonMonoxideDetectedReader = createBooleanReader(CARBON_MONOXIDE_DETECTED_STATE, OnOffType.ON, - OpenClosedType.OPEN); + carbonMonoxideDetectedReader = createBooleanReader(CARBON_MONOXIDE_DETECTED_STATE); getServices().add(new CarbonMonoxideSensorService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java index 85eec94e13ca4..4cbeb311fe324 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitCharacteristicFactory.java @@ -164,9 +164,11 @@ private static CompletableFuture getEnumFromIt T offEnum, T onEnum, T defaultEnum) { final State state = item.getItem().getState(); if (state instanceof OnOffType) { - return CompletableFuture.completedFuture(state.equals(OnOffType.OFF) ? offEnum : onEnum); + return CompletableFuture + .completedFuture(state.equals(item.isInverted() ? OnOffType.ON : OnOffType.OFF) ? offEnum : onEnum); } else if (state instanceof OpenClosedType) { - return CompletableFuture.completedFuture(state.equals(OpenClosedType.CLOSED) ? offEnum : onEnum); + return CompletableFuture.completedFuture( + state.equals(item.isInverted() ? OpenClosedType.OPEN : OpenClosedType.CLOSED) ? offEnum : onEnum); } else if (state instanceof DecimalType) { return CompletableFuture.completedFuture(((DecimalType) state).intValue() == 0 ? offEnum : onEnum); } else if (state instanceof UnDefType) { @@ -182,9 +184,9 @@ private static void setValueFromEnum(HomekitTaggedItem taggedItem, Characteristi CharacteristicEnum offEnum, CharacteristicEnum onEnum) { if (taggedItem.getItem() instanceof SwitchItem) { if (value.equals(offEnum)) { - ((SwitchItem) taggedItem.getItem()).send(OnOffType.OFF); + ((SwitchItem) taggedItem.getItem()).send(taggedItem.isInverted() ? OnOffType.ON : OnOffType.OFF); } else if (value.equals(onEnum)) { - ((SwitchItem) taggedItem.getItem()).send(OnOffType.ON); + ((SwitchItem) taggedItem.getItem()).send(taggedItem.isInverted() ? OnOffType.OFF : OnOffType.ON); } else { logger.warn("Enum value {} is not supported. Only following values are supported: {},{}", value, offEnum, onEnum); diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitContactSensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitContactSensorImpl.java index aa7ea4f4da6a6..bdc3bb613f614 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitContactSensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitContactSensorImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -38,7 +36,7 @@ public class HomekitContactSensorImpl extends AbstractHomekitAccessoryImpl imple public HomekitContactSensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - contactSensedReader = createBooleanReader(CONTACT_SENSOR_STATE, OnOffType.ON, OpenClosedType.OPEN); + contactSensedReader = createBooleanReader(CONTACT_SENSOR_STATE); getServices().add(new ContactSensorService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitFanImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitFanImpl.java index 709692ecc5f19..6fdc67128f652 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitFanImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitFanImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -38,7 +36,7 @@ class HomekitFanImpl extends AbstractHomekitAccessoryImpl implements FanAccessor public HomekitFanImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - activeReader = createBooleanReader(ACTIVE_STATUS, OnOffType.ON, OpenClosedType.OPEN); + activeReader = createBooleanReader(ACTIVE_STATUS); this.getServices().add(new FanService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitGarageDoorOpenerImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitGarageDoorOpenerImpl.java index 648426fb80e23..6c7995836635c 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitGarageDoorOpenerImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitGarageDoorOpenerImpl.java @@ -24,7 +24,6 @@ import org.openhab.core.library.items.StringItem; import org.openhab.core.library.items.SwitchItem; import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.core.library.types.StringType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; @@ -50,7 +49,7 @@ public class HomekitGarageDoorOpenerImpl extends AbstractHomekitAccessoryImpl im public HomekitGarageDoorOpenerImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - obstructionReader = createBooleanReader(OBSTRUCTION_STATUS, OnOffType.ON, OpenClosedType.OPEN); + obstructionReader = createBooleanReader(OBSTRUCTION_STATUS); getServices().add(new GarageDoorOpenerService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLeakSensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLeakSensorImpl.java index 2c872b516bbfe..4a5ef923f91ff 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLeakSensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLeakSensorImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -38,7 +36,7 @@ public class HomekitLeakSensorImpl extends AbstractHomekitAccessoryImpl implemen public HomekitLeakSensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - leakDetectedReader = createBooleanReader(LEAK_DETECTED_STATE, OnOffType.ON, OpenClosedType.OPEN); + leakDetectedReader = createBooleanReader(LEAK_DETECTED_STATE); getServices().add(new LeakSensorService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLockImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLockImpl.java index add1698d5a6f4..de9379334a301 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLockImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitLockImpl.java @@ -46,10 +46,8 @@ public class HomekitLockImpl extends AbstractHomekitAccessoryImpl implements Loc public HomekitLockImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) { super(taggedItem, mandatoryCharacteristics, updater, settings); - final String invertedConfig = getAccessoryConfiguration(HomekitTaggedItem.INVERTED, "false"); - final boolean inverted = invertedConfig.equalsIgnoreCase("yes") || invertedConfig.equalsIgnoreCase("true"); - securedState = inverted ? OnOffType.OFF : OnOffType.ON; - unsecuredState = inverted ? OnOffType.ON : OnOffType.OFF; + securedState = taggedItem.isInverted() ? OnOffType.OFF : OnOffType.ON; + unsecuredState = taggedItem.isInverted() ? OnOffType.ON : OnOffType.OFF; getServices().add(new LockMechanismService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitMotionSensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitMotionSensorImpl.java index 8ea96bedc42bf..37340823e250c 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitMotionSensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitMotionSensorImpl.java @@ -15,8 +15,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitCharacteristicType; import org.openhab.io.homekit.internal.HomekitSettings; @@ -36,8 +34,7 @@ public class HomekitMotionSensorImpl extends AbstractHomekitAccessoryImpl implem public HomekitMotionSensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - motionSensedReader = createBooleanReader(HomekitCharacteristicType.MOTION_DETECTED_STATE, OnOffType.ON, - OpenClosedType.OPEN); + motionSensedReader = createBooleanReader(HomekitCharacteristicType.MOTION_DETECTED_STATE); getServices().add(new MotionSensorService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOccupancySensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOccupancySensorImpl.java index 0904bf8428ce1..bbdcabdf133b9 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOccupancySensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOccupancySensorImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -38,7 +36,7 @@ public class HomekitOccupancySensorImpl extends AbstractHomekitAccessoryImpl imp public HomekitOccupancySensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - occupancySensedReader = createBooleanReader(OCCUPANCY_DETECTED_STATE, OnOffType.ON, OpenClosedType.OPEN); + occupancySensedReader = createBooleanReader(OCCUPANCY_DETECTED_STATE); getServices().add(new OccupancySensorService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOutletImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOutletImpl.java index a37582883075a..370d56ec2c40b 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOutletImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitOutletImpl.java @@ -15,8 +15,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitCharacteristicType; import org.openhab.io.homekit.internal.HomekitSettings; @@ -37,8 +35,8 @@ public class HomekitOutletImpl extends AbstractHomekitAccessoryImpl implements O public HomekitOutletImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - inUseReader = createBooleanReader(HomekitCharacteristicType.INUSE_STATUS, OnOffType.ON, OpenClosedType.OPEN); - onReader = createBooleanReader(HomekitCharacteristicType.ON_STATE, OnOffType.ON, OpenClosedType.OPEN); + inUseReader = createBooleanReader(HomekitCharacteristicType.INUSE_STATUS); + onReader = createBooleanReader(HomekitCharacteristicType.ON_STATE); getServices().add(new OutletService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmokeSensorImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmokeSensorImpl.java index 9cf9e522d2152..bc03411ba89f4 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmokeSensorImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSmokeSensorImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -38,7 +36,7 @@ public class HomekitSmokeSensorImpl extends AbstractHomekitAccessoryImpl impleme public HomekitSmokeSensorImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - smokeDetectedReader = createBooleanReader(SMOKE_DETECTED_STATE, OnOffType.ON, OpenClosedType.OPEN); + smokeDetectedReader = createBooleanReader(SMOKE_DETECTED_STATE); this.getServices().add(new SmokeSensorService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSpeakerImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSpeakerImpl.java index e4245dbee8f79..604c43002db4a 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSpeakerImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSpeakerImpl.java @@ -15,8 +15,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitCharacteristicType; import org.openhab.io.homekit.internal.HomekitSettings; @@ -37,7 +35,7 @@ public class HomekitSpeakerImpl extends AbstractHomekitAccessoryImpl implements public HomekitSpeakerImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - muteReader = createBooleanReader(HomekitCharacteristicType.MUTE, OnOffType.ON, OpenClosedType.OPEN); + muteReader = createBooleanReader(HomekitCharacteristicType.MUTE); getServices().add(new SpeakerService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSwitchImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSwitchImpl.java index be2a99418e92f..4b82df58a8012 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSwitchImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitSwitchImpl.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitSettings; import org.openhab.io.homekit.internal.HomekitTaggedItem; @@ -38,7 +36,7 @@ public class HomekitSwitchImpl extends AbstractHomekitAccessoryImpl implements S public HomekitSwitchImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - onReader = createBooleanReader(ON_STATE, OnOffType.ON, OpenClosedType.OPEN); + onReader = createBooleanReader(ON_STATE); getServices().add(new SwitchService(this)); } diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitValveImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitValveImpl.java index 4f8394b62dcae..d54e0814c7b19 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitValveImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/accessories/HomekitValveImpl.java @@ -30,7 +30,6 @@ import org.openhab.core.library.items.SwitchItem; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.OpenClosedType; import org.openhab.core.types.RefreshType; import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; import org.openhab.io.homekit.internal.HomekitCharacteristicType; @@ -75,8 +74,8 @@ public class HomekitValveImpl extends AbstractHomekitAccessoryImpl implements Va public HomekitValveImpl(HomekitTaggedItem taggedItem, List mandatoryCharacteristics, HomekitAccessoryUpdater updater, HomekitSettings settings) throws IncompleteAccessoryException { super(taggedItem, mandatoryCharacteristics, updater, settings); - inUseReader = createBooleanReader(INUSE_STATUS, OnOffType.ON, OpenClosedType.OPEN); - activeReader = createBooleanReader(ACTIVE_STATUS, OnOffType.ON, OpenClosedType.OPEN); + inUseReader = createBooleanReader(INUSE_STATUS); + activeReader = createBooleanReader(ACTIVE_STATUS); ValveService service = new ValveService(this); getServices().add(service); final String timerConfig = getAccessoryConfiguration(CONFIG_TIMER, "");