getLowBatteryState();
-
- /**
- * Subscribes to changes in the battery level.
- *
- * @param callback the function to call when low battery state changes.
- */
- void subscribeLowBatteryState(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the low battery state. */
- void unsubscribeLowBatteryState();
-}
diff --git a/src/main/java/io/github/hapjava/impl/accessories/Bridge.java b/src/main/java/io/github/hapjava/accessories/Bridge.java
similarity index 52%
rename from src/main/java/io/github/hapjava/impl/accessories/Bridge.java
rename to src/main/java/io/github/hapjava/accessories/Bridge.java
index 024693823..e53c427f2 100644
--- a/src/main/java/io/github/hapjava/impl/accessories/Bridge.java
+++ b/src/main/java/io/github/hapjava/accessories/Bridge.java
@@ -1,7 +1,6 @@
-package io.github.hapjava.impl.accessories;
-
-import io.github.hapjava.HomekitAccessory;
+package io.github.hapjava.accessories;
+/** HomeKit bridge service. */
public interface Bridge extends HomekitAccessory {
@Override
diff --git a/src/main/java/io/github/hapjava/accessories/CarbonDioxideSensor.java b/src/main/java/io/github/hapjava/accessories/CarbonDioxideSensor.java
deleted file mode 100644
index 27c332471..000000000
--- a/src/main/java/io/github/hapjava/accessories/CarbonDioxideSensor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package io.github.hapjava.accessories;
-
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.CarbonDioxideDetectedState;
-import io.github.hapjava.impl.services.CarbonDioxideSensorService;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * A carbon dioxide sensor reports whether carbon dioxide has been detected or not.
- *
- * Carbon dioxide sensors that run on batteries will need to implement this interface and also
- * implement {@link BatteryStatusAccessory}.
- *
- * @author Eugen Freiter
- */
-public interface CarbonDioxideSensor extends HomekitAccessory {
-
- /**
- * Retrieves the state of the sensor that indicates if carbon dioxide has been detected.
- *
- * @return a future that will contain the carbon dioxide sensor's state
- */
- CompletableFuture getCarbonDioxideDetectedState();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new CarbonDioxideSensorService(this));
- }
-
- /**
- * Subscribes to changes in the carbon dioxide's state.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCarbonDioxideDetectedState(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Retrieves the carbon dioxide level
- *
- * @return a future that will contain the carbon dioxide level as a value between 0 and 100000
- */
- CompletableFuture getCarbonDioxideLevel();
-
- /** Unsubscribes from changes in the carbon dioxide's state. */
- void unsubscribeCarbonDioxideDetectedState();
-
- /**
- * Subscribes to changes in the carbon dioxide level.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCarbonDioxideLevel(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the carbon dioxide level. */
- void unsubscribeCarbonDioxideLevel();
-}
diff --git a/src/main/java/io/github/hapjava/accessories/CarbonDioxideSensorAccessory.java b/src/main/java/io/github/hapjava/accessories/CarbonDioxideSensorAccessory.java
new file mode 100644
index 000000000..185aedd13
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/CarbonDioxideSensorAccessory.java
@@ -0,0 +1,35 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.carbondioxidesensor.CarbonDioxideDetectedEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.CarbonDioxideSensorService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** A carbon dioxide sensor reports carbon dioxide level. */
+public interface CarbonDioxideSensorAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the state of the sensor that indicates if carbon dioxide has been detected.
+ *
+ * @return a future that will contain the carbon dioxide sensor's state
+ */
+ CompletableFuture getCarbonDioxideDetectedState();
+
+ /**
+ * Subscribes to changes in the carbon dioxide's state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCarbonDioxideDetectedState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the carbon dioxide's state. */
+ void unsubscribeCarbonDioxideDetectedState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new CarbonDioxideSensorService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/CarbonMonoxideSensor.java b/src/main/java/io/github/hapjava/accessories/CarbonMonoxideSensorAccessory.java
similarity index 62%
rename from src/main/java/io/github/hapjava/accessories/CarbonMonoxideSensor.java
rename to src/main/java/io/github/hapjava/accessories/CarbonMonoxideSensorAccessory.java
index fd9ed9fef..93cfebbd6 100644
--- a/src/main/java/io/github/hapjava/accessories/CarbonMonoxideSensor.java
+++ b/src/main/java/io/github/hapjava/accessories/CarbonMonoxideSensorAccessory.java
@@ -1,10 +1,9 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.CarbonMonoxideDetectedState;
-import io.github.hapjava.impl.services.CarbonMonoxideSensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.carbonmonoxidesensor.CarbonMonoxideDetectedEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.CarbonMonoxideSensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -12,24 +11,16 @@
/**
* A carbon monoxide sensor reports whether carbon monoxide has been detected or not.
*
- * Carbon monoxide sensors that run on batteries will need to implement this interface and also
- * implement {@link BatteryStatusAccessory}.
- *
* @author Gaston Dombiak
*/
-public interface CarbonMonoxideSensor extends HomekitAccessory {
+public interface CarbonMonoxideSensorAccessory extends HomekitAccessory {
/**
* Retrieves the state of the sensor that indicates if carbon monoxide has been detected.
*
* @return a future that will contain the carbon monoxide sensor's state
*/
- CompletableFuture getCarbonMonoxideDetectedState();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new CarbonMonoxideSensorService(this));
- }
+ CompletableFuture getCarbonMonoxideDetectedState();
/**
* Subscribes to changes in the carbon monoxide's state.
@@ -40,4 +31,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the carbon monoxide's state. */
void unsubscribeCarbonMonoxideDetectedState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new CarbonMonoxideSensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/ContactSensor.java b/src/main/java/io/github/hapjava/accessories/ContactSensorAccessory.java
similarity index 66%
rename from src/main/java/io/github/hapjava/accessories/ContactSensor.java
rename to src/main/java/io/github/hapjava/accessories/ContactSensorAccessory.java
index af85760db..754f6981b 100644
--- a/src/main/java/io/github/hapjava/accessories/ContactSensor.java
+++ b/src/main/java/io/github/hapjava/accessories/ContactSensorAccessory.java
@@ -1,10 +1,9 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.ContactState;
-import io.github.hapjava.impl.services.ContactSensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.contactsensor.ContactStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.ContactSensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -13,12 +12,9 @@
* A contact sensor that reports whether contact is detected or not. Typical contact sensors are
* window/door sensors. When contact is detected it means that the door/window is closed.
*
- * Contact sensors that run on batteries will need to implement this interface and also implement
- * {@link BatteryStatusAccessory}.
- *
* @author Gaston Dombiak
*/
-public interface ContactSensor extends HomekitAccessory {
+public interface ContactSensorAccessory extends HomekitAccessory {
/**
* Retrieves the state of the contact. This is whether the contact is detected or not. Detected
@@ -26,12 +22,7 @@ public interface ContactSensor extends HomekitAccessory {
*
* @return a future that will contain the contact's state
*/
- CompletableFuture getCurrentState();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new ContactSensorService(this));
- }
+ CompletableFuture getCurrentState();
/**
* Subscribes to changes in the contact state.
@@ -42,4 +33,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the contact state. */
void unsubscribeContactState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new ContactSensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/DoorAccessory.java b/src/main/java/io/github/hapjava/accessories/DoorAccessory.java
new file mode 100644
index 000000000..1049c7686
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/DoorAccessory.java
@@ -0,0 +1,78 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.windowcovering.PositionStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.DoorService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** A motorized door with current and target position. */
+public interface DoorAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the position state of the door
+ *
+ * @return a future which will contain the door's position state
+ */
+ CompletableFuture getPositionState();
+
+ /**
+ * Retrieves the current position of the door
+ *
+ * @return a future which will contain the door's current position
+ */
+ CompletableFuture getCurrentPosition();
+
+ /**
+ * Retrieves the target position of the door
+ *
+ * @return a future which will contain the door's target position
+ */
+ CompletableFuture getTargetPosition();
+
+ /**
+ * Sets the targeted state of the door.
+ *
+ * @param position the targeted position
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetPosition(Integer position) throws Exception;
+
+ /**
+ * Subscribes to changes in the door's position state
+ *
+ * @param callback the function to call when the state changes
+ */
+ void subscribePositionState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the door's current position
+ *
+ * @param callback the function to call when the current position changes
+ */
+ void subscribeCurrentPosition(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the door's target position
+ *
+ * @param callback the function to call when the target position changes
+ */
+ void subscribeTargetPosition(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the door's state */
+ void unsubscribePositionState();
+
+ /** Unsubscribes from changes in the door's current position */
+ void unsubscribeCurrentPosition();
+
+ /** Unsubscribes from changes in the door's target position */
+ void unsubscribeTargetPosition();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new DoorService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/DoorbellAccessory.java b/src/main/java/io/github/hapjava/accessories/DoorbellAccessory.java
new file mode 100644
index 000000000..d46d4a00e
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/DoorbellAccessory.java
@@ -0,0 +1,36 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.ProgrammableSwitchEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.DoorbellService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** doorbell accessory with a switch (button push) event. */
+public interface DoorbellAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the last states of the doorbell. Bluetooth device should return the last event, the
+ * IP device should always return null
+ *
+ * @return state of the door bell event
+ */
+ CompletableFuture getSwitchEvent();
+
+ /**
+ * Subscribes to changes in doorbell switch event, i.e. pressing on the door bell button.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeSwitchEvent(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in doorbell switch event. */
+ void unsubscribeSwitchEvent();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new DoorbellService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/Fan.java b/src/main/java/io/github/hapjava/accessories/Fan.java
deleted file mode 100644
index 9d5ac4276..000000000
--- a/src/main/java/io/github/hapjava/accessories/Fan.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package io.github.hapjava.accessories;
-
-import io.github.hapjava.*;
-import io.github.hapjava.accessories.properties.RotationDirection;
-import io.github.hapjava.impl.services.FanService;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * A fan, with power and rotational characteristics.
- *
- * @author Andy Lintner
- */
-public interface Fan extends HomekitAccessory {
-
- /**
- * Retrieves the current binary state of the fan's power.
- *
- * @return a future that will contain the binary state
- */
- CompletableFuture getFanPower();
-
- /**
- * Retrieves the current rotation direction of the fan.
- *
- * @return a future that will contain the direction
- */
- CompletableFuture getRotationDirection();
-
- /**
- * Retrieves the current speed of the fan's rotation
- *
- * @return a future that will contain the speed, expressed as an integer between 0 and 100.
- */
- CompletableFuture getRotationSpeed();
-
- /**
- * Sets the binary state of the fan's power
- *
- * @param state the binary state to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setFanPower(boolean state) throws Exception;
-
- /**
- * Sets the rotation direction of the fan
- *
- * @param direction the direction to set
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setRotationDirection(RotationDirection direction) throws Exception;
-
- /**
- * Sets the speed of the fan's rotation
- *
- * @param speed the speed to set, expressed as an integer between 0 and 100.
- * @return a future that completes when the change is made
- * @throws Exception when the change cannot be made
- */
- CompletableFuture setRotationSpeed(Integer speed) throws Exception;
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new FanService(this));
- }
-
- /**
- * Subscribes to changes in the binary state of the fan's power.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeFanPower(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the rotation direction of the fan.
- *
- * @param callback the function to call when the direction changes.
- */
- void subscribeRotationDirection(HomekitCharacteristicChangeCallback callback);
-
- /**
- * Subscribes to changes in the rotation speed of the fan.
- *
- * @param callback the function to call when the speed changes.
- */
- void subscribeRotationSpeed(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the binary state of the fan's power. */
- void unsubscribeFanPower();
-
- /** Unsubscribes from changes in the rotation direction of the fan. */
- void unsubscribeRotationDirection();
-
- /** Unsubscribes from changes in the fan's rotation speed. */
- void unsubscribeRotationSpeed();
-}
diff --git a/src/main/java/io/github/hapjava/accessories/FanAccessory.java b/src/main/java/io/github/hapjava/accessories/FanAccessory.java
new file mode 100644
index 000000000..641214e76
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/FanAccessory.java
@@ -0,0 +1,46 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.FanService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * A fan with mandatory characteristics.
+ *
+ * @author Andy Lintner
+ */
+public interface FanAccessory extends HomekitAccessory {
+ /**
+ * Mandatory: Retrieves the current active state of the fan'.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture isActive();
+
+ /**
+ * Sets the active state of the fan
+ *
+ * @param state the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setActive(boolean state) throws Exception;
+
+ /**
+ * Subscribes to changes in the active state of the fan.
+ *
+ * @param callback the function to call when the active state changes.
+ */
+ void subscribeActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the active state of the fan. */
+ void unsubscribeActive();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new FanService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/FaucetAccessory.java b/src/main/java/io/github/hapjava/accessories/FaucetAccessory.java
new file mode 100644
index 000000000..7a000fcec
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/FaucetAccessory.java
@@ -0,0 +1,42 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.FaucetService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Faucets or shower heads accessory. */
+public interface FaucetAccessory extends HomekitAccessory {
+ /**
+ * Mandatory: Retrieves the current active state of the faucet.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture isActive();
+
+ /**
+ * Sets the active state of the faucet
+ *
+ * @param state the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setActive(boolean state) throws Exception;
+
+ /**
+ * Subscribes to changes in the active state of the faucet.
+ *
+ * @param callback the function to call when the active state changes.
+ */
+ void subscribeActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the active state of the faucet. */
+ void unsubscribeActive();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new FaucetService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/GarageDoor.java b/src/main/java/io/github/hapjava/accessories/GarageDoorOpenerAccessory.java
similarity index 71%
rename from src/main/java/io/github/hapjava/accessories/GarageDoor.java
rename to src/main/java/io/github/hapjava/accessories/GarageDoorOpenerAccessory.java
index d94c1d071..37bd8a063 100644
--- a/src/main/java/io/github/hapjava/accessories/GarageDoor.java
+++ b/src/main/java/io/github/hapjava/accessories/GarageDoorOpenerAccessory.java
@@ -1,32 +1,34 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.*;
-import io.github.hapjava.accessories.properties.DoorState;
-import io.github.hapjava.impl.services.GarageDoorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.garagedoor.CurrentDoorStateEnum;
+import io.github.hapjava.characteristics.impl.garagedoor.TargetDoorStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.GarageDoorOpenerService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
/**
- * A garage door opener, with control and status of a garage door
+ * garage door opener accessory with control and status of a garage door
*
* @author Andy Lintner
*/
-public interface GarageDoor extends HomekitAccessory {
+public interface GarageDoorOpenerAccessory extends HomekitAccessory {
/**
* Retrieves the current state of the door
*
* @return a future which will contain the door's state
*/
- CompletableFuture getCurrentDoorState();
+ CompletableFuture getCurrentDoorState();
/**
* Retrieves the targeted state of the door
*
* @return a future which will contain the door's targeted state
*/
- CompletableFuture getTargetDoorState();
+ CompletableFuture getTargetDoorState();
/**
* Retrieves an indicator of an obstruction detected by the door
@@ -42,7 +44,7 @@ public interface GarageDoor extends HomekitAccessory {
* @return a future that completes when the change is made
* @throws Exception when the change cannot be made
*/
- CompletableFuture setTargetDoorState(DoorState state) throws Exception;
+ CompletableFuture setTargetDoorState(TargetDoorStateEnum state) throws Exception;
/**
* Subscribes to changes in the door's state
@@ -76,6 +78,6 @@ public interface GarageDoor extends HomekitAccessory {
@Override
default Collection getServices() {
- return Collections.singleton(new GarageDoorService(this));
+ return Collections.singleton(new GarageDoorOpenerService(this));
}
}
diff --git a/src/main/java/io/github/hapjava/accessories/HeaterCoolerAccessory.java b/src/main/java/io/github/hapjava/accessories/HeaterCoolerAccessory.java
new file mode 100644
index 000000000..d403b3839
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/HeaterCoolerAccessory.java
@@ -0,0 +1,103 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.heatercooler.CurrentHeaterCoolerStateEnum;
+import io.github.hapjava.characteristics.impl.heatercooler.TargetHeaterCoolerStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.HeaterCoolerService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Heater Cooler accessory */
+public interface HeaterCoolerAccessory extends HomekitAccessory {
+ /**
+ * Retrieves the current temperature, in celsius degrees.
+ *
+ * @return a future that will contain the temperature.
+ */
+ CompletableFuture getCurrentTemperature();
+
+ /**
+ * Mandatory: Retrieves the current active state of the Heater Cooler.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture isActive();
+
+ /**
+ * Sets the active state of the Heater Cooler
+ *
+ * @param state the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setActive(boolean state) throws Exception;
+
+ /**
+ * Retrieves the heater /cooler current state.
+ *
+ * @return a future that will contain the heater cooler current state .
+ */
+ CompletableFuture getCurrentHeaterCoolerState();
+
+ /**
+ * Retrieves the heater cooler target state.
+ *
+ * @return a future that will contain the heater cooler target state .
+ */
+ CompletableFuture getTargetHeaterCoolerState();
+
+ /**
+ * set heater cooler target state the lock target state.
+ *
+ * @param state heater cooler target state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setTargetHeaterCoolerState(TargetHeaterCoolerStateEnum state);
+
+ /**
+ * Subscribes to changes in the heater cooler current state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentHeaterCoolerState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in heater cooler current state. */
+ void unsubscribeCurrentHeaterCoolerState();
+
+ /**
+ * Subscribes to changes in the heater cooler target state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetHeaterCoolerState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in heater cooler target state. */
+ void unsubscribeTargetHeaterCoolerState();
+
+ /**
+ * Subscribes to changes in the active state of the heater cooler .
+ *
+ * @param callback the function to call when the active state changes.
+ */
+ void subscribeActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the active state of the heater cooler . */
+ void unsubscribeActive();
+
+ /**
+ * Subscribes to changes in the current temperature.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current temperature. */
+ void unsubscribeCurrentTemperature();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new HeaterCoolerService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/HomekitAccessory.java b/src/main/java/io/github/hapjava/accessories/HomekitAccessory.java
similarity index 59%
rename from src/main/java/io/github/hapjava/HomekitAccessory.java
rename to src/main/java/io/github/hapjava/accessories/HomekitAccessory.java
index beb08eac3..f61fd223d 100644
--- a/src/main/java/io/github/hapjava/HomekitAccessory.java
+++ b/src/main/java/io/github/hapjava/accessories/HomekitAccessory.java
@@ -1,9 +1,13 @@
-package io.github.hapjava;
+package io.github.hapjava.accessories;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.AccessoryInformationService;
import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
/**
- * Base interface for all Homekit Accessories. You can implement this interface directly, but most
+ * Base interface for all HomeKit Accessories. You can implement this interface directly, but most
* users will prefer to use the more full featured interfaces in {@link
* io.github.hapjava.accessories} which include a default implementation of {@link #getServices()}.
*
@@ -21,11 +25,11 @@ public interface HomekitAccessory {
int getId();
/**
- * Returns a label to display in iOS.
+ * Returns a name to display in iOS.
*
* @return the label.
*/
- String getLabel();
+ CompletableFuture getName();
/**
* Performs an operation that can be used to identify the accessory. This action can be performed
@@ -38,25 +42,32 @@ public interface HomekitAccessory {
*
* @return the serial number, or null.
*/
- String getSerialNumber();
+ CompletableFuture getSerialNumber();
/**
* Returns a model name to display in iOS.
*
* @return the model name, or null.
*/
- String getModel();
+ CompletableFuture getModel();
/**
* Returns a manufacturer to display in iOS.
*
* @return the manufacturer, or null.
*/
- String getManufacturer();
+ CompletableFuture getManufacturer();
+
+ /**
+ * Returns a firmware revision to display in iOS.
+ *
+ * @return the firmware revision, or null.
+ */
+ CompletableFuture getFirmwareRevision();
/**
* The collection of Services this accessory supports. Services are the primary way to interact
- * with the accessory via Homekit. Besides the Services offered here, the accessory will
+ * with the accessory via HomeKit. Besides the Services offered here, the accessory will
* automatically include the required information service.
*
* This method will only be useful if you're implementing your own accessory type. For the
@@ -65,5 +76,16 @@ public interface HomekitAccessory {
*
* @return the collection of services.
*/
- Collection getServices();
+ default Collection getServices() {
+ return Collections.singleton(new AccessoryInformationService(this));
+ };
+
+ /**
+ * default implementation which is sufficient if accessory has only one services
+ *
+ * @return primary service
+ */
+ default Service getPrimaryService() {
+ return getServices().iterator().next();
+ };
}
diff --git a/src/main/java/io/github/hapjava/accessories/HumidifierDehumidifierAccessory.java b/src/main/java/io/github/hapjava/accessories/HumidifierDehumidifierAccessory.java
new file mode 100644
index 000000000..bc723ce27
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/HumidifierDehumidifierAccessory.java
@@ -0,0 +1,104 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.humidifier.CurrentHumidifierDehumidifierStateEnum;
+import io.github.hapjava.characteristics.impl.humidifier.TargetHumidifierDehumidifierStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.HumidifierDehumidifierService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Humidifier/Dehumidifier accessory */
+public interface HumidifierDehumidifierAccessory extends HomekitAccessory {
+ /**
+ * Retrieves the current relative humidity.
+ *
+ * @return a future that will contain the humidity as a value between 0 and 100.
+ */
+ CompletableFuture getCurrentHumidity();
+
+ /**
+ * Mandatory: Retrieves the current active state of the humidifier/dehumidifier.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture isActive();
+
+ /**
+ * Sets the active state of the humidifier/dehumidifier
+ *
+ * @param state the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setActive(boolean state) throws Exception;
+
+ /**
+ * Retrieves the humidifier/dehumidifier current state.
+ *
+ * @return a future that will contain the humidifier/dehumidifier current state .
+ */
+ CompletableFuture getCurrentHumidifierDehumidifierState();
+
+ /**
+ * Retrieves the humidifier/dehumidifier target state.
+ *
+ * @return a future that will contain the humidifier/dehumidifier target state .
+ */
+ CompletableFuture getTargetHumidifierDehumidifierState();
+
+ /**
+ * set humidifier/dehumidifier target state the lock target state.
+ *
+ * @param state humidifier/dehumidifier target state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setTargetHumidifierDehumidifierState(
+ TargetHumidifierDehumidifierStateEnum state);
+
+ /**
+ * Subscribes to changes in the humidifier/dehumidifier current state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentHumidifierDehumidifierState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in humidifier/dehumidifier current state. */
+ void unsubscribeCurrentHumidifierDehumidifierState();
+
+ /**
+ * Subscribes to changes in the humidifier/dehumidifier target state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetHumidifierDehumidifierState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in humidifier/dehumidifier target state. */
+ void unsubscribeTargetHumidifierDehumidifierState();
+
+ /**
+ * Subscribes to changes in the active state of the humidifier/dehumidifier .
+ *
+ * @param callback the function to call when the active state changes.
+ */
+ void subscribeActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the active state of the humidifier/dehumidifier . */
+ void unsubscribeActive();
+
+ /**
+ * Subscribes to changes in the current humidity.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentHumidity(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current humidity. */
+ void unsubscribeCurrentHumidity();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new HumidifierDehumidifierService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/HumiditySensor.java b/src/main/java/io/github/hapjava/accessories/HumiditySensorAccessory.java
similarity index 78%
rename from src/main/java/io/github/hapjava/accessories/HumiditySensor.java
rename to src/main/java/io/github/hapjava/accessories/HumiditySensorAccessory.java
index dd7335635..07c24be58 100644
--- a/src/main/java/io/github/hapjava/accessories/HumiditySensor.java
+++ b/src/main/java/io/github/hapjava/accessories/HumiditySensorAccessory.java
@@ -1,7 +1,8 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.*;
-import io.github.hapjava.impl.services.HumiditySensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.HumiditySensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -11,7 +12,7 @@
*
* @author Andy Lintner
*/
-public interface HumiditySensor extends HomekitAccessory {
+public interface HumiditySensorAccessory extends HomekitAccessory {
/**
* Retrieves the current relative humidity.
@@ -20,11 +21,6 @@ public interface HumiditySensor extends HomekitAccessory {
*/
CompletableFuture getCurrentRelativeHumidity();
- @Override
- default Collection getServices() {
- return Collections.singleton(new HumiditySensorService(this));
- }
-
/**
* Subscribes to changes in the current relative humidity.
*
@@ -34,4 +30,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the current relative humidity. */
void unsubscribeCurrentRelativeHumidity();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new HumiditySensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/IrrigationSystemAccessory.java b/src/main/java/io/github/hapjava/accessories/IrrigationSystemAccessory.java
new file mode 100644
index 000000000..dffa2e00b
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/IrrigationSystemAccessory.java
@@ -0,0 +1,82 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.ActiveEnum;
+import io.github.hapjava.characteristics.impl.common.InUseEnum;
+import io.github.hapjava.characteristics.impl.common.ProgramModeEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.IrrigationSystemService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** irrigation system accessory that controls several valves. */
+public interface IrrigationSystemAccessory extends HomekitAccessory {
+
+ /**
+ * An irrigation system is set to Active when the system is enabled. When one of the valves is set
+ * to In Use, the irrigation system must be set to in use.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getActive();
+
+ /**
+ * Sets the irrigation active state
+ *
+ * @param active the binary state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setActive(ActiveEnum active) throws Exception;
+
+ /**
+ * Retrieves the program mode status
+ *
+ * @return a future that will contain the valve type.
+ */
+ CompletableFuture getProgramMode();
+
+ /**
+ * Retrieves the current inUse state of the irrigation; InUse means one of the valves is set to In
+ * Use.
+ *
+ * @return a future that will contain the binary state
+ */
+ CompletableFuture getInUse();
+
+ /**
+ * Subscribes to changes in the inUse state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeInUse(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the inUse state. */
+ void unsubscribeInUse();
+
+ /**
+ * Subscribes to changes in the active state of the irrigation.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the irrigation active state. */
+ void unsubscribeActive();
+
+ /**
+ * Subscribes to changes in the program mode of the irrigation system.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeProgramMode(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the program mode. */
+ void unsubscribeProgramMode();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new IrrigationSystemService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/LeakSensor.java b/src/main/java/io/github/hapjava/accessories/LeakSensorAccessory.java
similarity index 65%
rename from src/main/java/io/github/hapjava/accessories/LeakSensor.java
rename to src/main/java/io/github/hapjava/accessories/LeakSensorAccessory.java
index aad2266e9..c36ce278c 100644
--- a/src/main/java/io/github/hapjava/accessories/LeakSensor.java
+++ b/src/main/java/io/github/hapjava/accessories/LeakSensorAccessory.java
@@ -1,9 +1,9 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.impl.services.LeakSensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.leaksensor.LeakDetectedStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.LeakSensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -11,24 +11,16 @@
/**
* A leak sensor that reports whether a leak has been detected.
*
- * Leak sensors that run on batteries will need to implement this interface and also implement
- * {@link BatteryStatusAccessory}.
- *
* @author Tim Harper
*/
-public interface LeakSensor extends HomekitAccessory {
+public interface LeakSensorAccessory extends HomekitAccessory {
/**
* Retrieves the state of the leak sensor. If true then leak has been detected.
*
* @return a future that will contain the leak sensor's state
*/
- CompletableFuture getLeakDetected();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new LeakSensorService(this));
- }
+ CompletableFuture getLeakDetected();
/**
* Subscribes to changes in the leak sensor.
@@ -39,4 +31,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the leak sensor. */
void unsubscribeLeakDetected();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LeakSensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/LightSensor.java b/src/main/java/io/github/hapjava/accessories/LightSensorAccessory.java
similarity index 78%
rename from src/main/java/io/github/hapjava/accessories/LightSensor.java
rename to src/main/java/io/github/hapjava/accessories/LightSensorAccessory.java
index 12b2e05d3..bcdab09c4 100644
--- a/src/main/java/io/github/hapjava/accessories/LightSensor.java
+++ b/src/main/java/io/github/hapjava/accessories/LightSensorAccessory.java
@@ -1,9 +1,8 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.impl.services.LightSensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.LightSensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -13,7 +12,7 @@
*
* @author Gaston Dombiak
*/
-public interface LightSensor extends HomekitAccessory {
+public interface LightSensorAccessory extends HomekitAccessory {
/**
* Retrieves the current ambient light level.
@@ -22,11 +21,6 @@ public interface LightSensor extends HomekitAccessory {
*/
CompletableFuture getCurrentAmbientLightLevel();
- @Override
- default Collection getServices() {
- return Collections.singleton(new LightSensorService(this));
- }
-
/**
* Subscribes to changes in the current ambient light level.
*
@@ -36,4 +30,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the current ambient light level. */
void unsubscribeCurrentAmbientLightLevel();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LightSensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/Lightbulb.java b/src/main/java/io/github/hapjava/accessories/LightbulbAccessory.java
similarity index 83%
rename from src/main/java/io/github/hapjava/accessories/Lightbulb.java
rename to src/main/java/io/github/hapjava/accessories/LightbulbAccessory.java
index c39b659eb..8a6caaed8 100644
--- a/src/main/java/io/github/hapjava/accessories/Lightbulb.java
+++ b/src/main/java/io/github/hapjava/accessories/LightbulbAccessory.java
@@ -1,7 +1,8 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.*;
-import io.github.hapjava.impl.services.LightbulbService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.LightbulbService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -11,7 +12,7 @@
*
* @author Andy Lintner
*/
-public interface Lightbulb extends HomekitAccessory {
+public interface LightbulbAccessory extends HomekitAccessory {
/**
* Retrieves the current binary state of the light.
@@ -29,11 +30,6 @@ public interface Lightbulb extends HomekitAccessory {
*/
CompletableFuture setLightbulbPowerState(boolean powerState) throws Exception;
- @Override
- default Collection getServices() {
- return Collections.singleton(new LightbulbService(this));
- }
-
/**
* Subscribes to changes in the binary state of the light.
*
@@ -43,4 +39,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the binary state of the light. */
void unsubscribeLightbulbPowerState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LightbulbService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/LockMechanism.java b/src/main/java/io/github/hapjava/accessories/LockMechanism.java
deleted file mode 100644
index f1eb051e7..000000000
--- a/src/main/java/io/github/hapjava/accessories/LockMechanism.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.github.hapjava.accessories;
-
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.LockMechanismState;
-import io.github.hapjava.impl.services.LockMechanismService;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * A lock capable of exposing its binary locked state. For a lock that can be locked/unlocked, use
- * {@link LockableLockMechanism}.
- *
- * Locks that run on batteries will need to implement this interface and also implement {@link
- * BatteryStatusAccessory}.
- *
- * @author Andy Lintner
- */
-public interface LockMechanism extends HomekitAccessory {
-
- /**
- * Retrieves the current binary state of the lock.
- *
- * @return a future that will contain the binary state.
- */
- CompletableFuture getCurrentMechanismState();
-
- /**
- * Subscribes to changes in the binary state of the lock.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentMechanismState(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the binary state of the lock. */
- void unsubscribeCurrentMechanismState();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new LockMechanismService(this));
- }
-}
diff --git a/src/main/java/io/github/hapjava/accessories/LockMechanismAccessory.java b/src/main/java/io/github/hapjava/accessories/LockMechanismAccessory.java
new file mode 100644
index 000000000..f12f3e286
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/LockMechanismAccessory.java
@@ -0,0 +1,61 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.lock.LockCurrentStateEnum;
+import io.github.hapjava.characteristics.impl.lock.LockTargetStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.LockMechanismService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Lock mechanism with current and target state. */
+public interface LockMechanismAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the lock current state.
+ *
+ * @return a future that will contain the lock current state .
+ */
+ CompletableFuture getLockCurrentState();
+
+ /**
+ * Retrieves the lock target state.
+ *
+ * @return a future that will contain the lock target state .
+ */
+ CompletableFuture getLockTargetState();
+
+ /**
+ * set lock target state the lock target state.
+ *
+ * @param state lock target state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setLockTargetState(LockTargetStateEnum state);
+
+ /**
+ * Subscribes to changes in the lock current state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeLockCurrentState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in lock current state. */
+ void unsubscribeLockCurrentState();
+
+ /**
+ * Subscribes to changes in the lock target state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeLockTargetState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in lock target state. */
+ void unsubscribeLockTargetState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new LockMechanismService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/LockableLockMechanism.java b/src/main/java/io/github/hapjava/accessories/LockableLockMechanism.java
deleted file mode 100644
index 474c8abd6..000000000
--- a/src/main/java/io/github/hapjava/accessories/LockableLockMechanism.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package io.github.hapjava.accessories;
-
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.accessories.properties.LockMechanismState;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * Extends {@link LockMechanism} with the ability to lock and unlock the mechanism.
- *
- * @author Andy Lintner
- */
-public interface LockableLockMechanism extends LockMechanism {
-
- /**
- * Sets the binary state of the lock mechanism.
- *
- * @param state true for a locked mechanism, false for unlocked.
- * @throws Exception when the change cannot be made.
- */
- void setTargetMechanismState(LockMechanismState state) throws Exception;
-
- /**
- * Retrieves the pending, but not yet completed, state of the lock mechanism.
- *
- * @return the binary state
- */
- CompletableFuture getTargetMechanismState();
-
- /**
- * Subscribes to changes in the pending, but not yet completed, binary state.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeTargetMechanismState(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the pending, but not yet completed, binary state. */
- void unsubscribeTargetMechanismState();
-}
diff --git a/src/main/java/io/github/hapjava/accessories/MicrophoneAccessory.java b/src/main/java/io/github/hapjava/accessories/MicrophoneAccessory.java
new file mode 100644
index 000000000..f63f8b70c
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/MicrophoneAccessory.java
@@ -0,0 +1,43 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.MicrophoneService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Microphone accessory with mute state. */
+public interface MicrophoneAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves mute status.
+ *
+ * @return true if accessory is muted
+ */
+ CompletableFuture isMuted();
+
+ /**
+ * Sets the mute status
+ *
+ * @param mute true if accessory should be muted
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setMute(boolean mute) throws Exception;
+
+ /**
+ * Subscribes to changes in mute state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeMuteState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the mute state. */
+ void unsubscribeMuteState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new MicrophoneService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/MotionSensor.java b/src/main/java/io/github/hapjava/accessories/MotionSensorAccessory.java
similarity index 69%
rename from src/main/java/io/github/hapjava/accessories/MotionSensor.java
rename to src/main/java/io/github/hapjava/accessories/MotionSensorAccessory.java
index dc424625b..e843068b1 100644
--- a/src/main/java/io/github/hapjava/accessories/MotionSensor.java
+++ b/src/main/java/io/github/hapjava/accessories/MotionSensorAccessory.java
@@ -1,9 +1,8 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.impl.services.MotionSensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.MotionSensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -11,12 +10,9 @@
/**
* A motion sensor that reports whether motion has been detected.
*
- * Motion sensors that run on batteries will need to implement this interface and also implement
- * {@link BatteryStatusAccessory}.
- *
* @author Gaston Dombiak
*/
-public interface MotionSensor extends HomekitAccessory {
+public interface MotionSensorAccessory extends HomekitAccessory {
/**
* Retrieves the state of the motion sensor. If true then motion has been detected.
@@ -25,11 +21,6 @@ public interface MotionSensor extends HomekitAccessory {
*/
CompletableFuture getMotionDetected();
- @Override
- default Collection getServices() {
- return Collections.singleton(new MotionSensorService(this));
- }
-
/**
* Subscribes to changes in the motion sensor.
*
@@ -39,4 +30,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the motion sensor. */
void unsubscribeMotionDetected();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new MotionSensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/OccupancySensor.java b/src/main/java/io/github/hapjava/accessories/OccupancySensorAccessory.java
similarity index 65%
rename from src/main/java/io/github/hapjava/accessories/OccupancySensor.java
rename to src/main/java/io/github/hapjava/accessories/OccupancySensorAccessory.java
index 0148a6f9f..5fc3cff1e 100644
--- a/src/main/java/io/github/hapjava/accessories/OccupancySensor.java
+++ b/src/main/java/io/github/hapjava/accessories/OccupancySensorAccessory.java
@@ -1,9 +1,9 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.impl.services.OccupancySensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.occupancysensor.OccupancyDetectedEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.OccupancySensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -11,23 +11,15 @@
/**
* An occupancy sensor that reports whether occupancy has been detected.
*
- * Occupancy sensors that run on batteries will need to implement this interface and also
- * implement {@link BatteryStatusAccessory}.
- *
* @author Tim Harper
*/
-public interface OccupancySensor extends HomekitAccessory {
+public interface OccupancySensorAccessory extends HomekitAccessory {
/**
* Retrieves the state of the occupancy sensor. If true then occupancy has been detected.
*
* @return a future that will contain the occupancy sensor's state
*/
- CompletableFuture getOccupancyDetected();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new OccupancySensorService(this));
- }
+ CompletableFuture getOccupancyDetected();
/**
* Subscribes to changes in the occupancy sensor.
@@ -38,4 +30,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the occupancy sensor. */
void unsubscribeOccupancyDetected();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new OccupancySensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/Outlet.java b/src/main/java/io/github/hapjava/accessories/OutletAccessory.java
similarity index 88%
rename from src/main/java/io/github/hapjava/accessories/Outlet.java
rename to src/main/java/io/github/hapjava/accessories/OutletAccessory.java
index 4578bfea4..213f673b7 100644
--- a/src/main/java/io/github/hapjava/accessories/Outlet.java
+++ b/src/main/java/io/github/hapjava/accessories/OutletAccessory.java
@@ -1,7 +1,8 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.*;
-import io.github.hapjava.impl.services.OutletService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.OutletService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -11,12 +12,7 @@
*
* @author Andy Lintner
*/
-public interface Outlet extends HomekitAccessory {
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new OutletService(this));
- }
+public interface OutletAccessory extends HomekitAccessory {
/**
* Retrieves the current binary state of the outlet's power.
@@ -60,4 +56,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the binary state indicating whether hte outlet is in use. */
void unsubscribeOutletInUse();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new OutletService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/SecuritySystem.java b/src/main/java/io/github/hapjava/accessories/SecuritySystemAccessory.java
similarity index 59%
rename from src/main/java/io/github/hapjava/accessories/SecuritySystem.java
rename to src/main/java/io/github/hapjava/accessories/SecuritySystemAccessory.java
index fcf1d1f6f..93f59fa1b 100644
--- a/src/main/java/io/github/hapjava/accessories/SecuritySystem.java
+++ b/src/main/java/io/github/hapjava/accessories/SecuritySystemAccessory.java
@@ -1,12 +1,10 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.CurrentSecuritySystemState;
-import io.github.hapjava.accessories.properties.SecuritySystemAlarmType;
-import io.github.hapjava.accessories.properties.TargetSecuritySystemState;
-import io.github.hapjava.impl.services.SecuritySystemService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.securitysystem.CurrentSecuritySystemStateEnum;
+import io.github.hapjava.characteristics.impl.securitysystem.TargetSecuritySystemStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.SecuritySystemService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -14,11 +12,11 @@
/**
* A security system that can be armed so that when a contact sensor is opened or a motion sensor
* detects movement, then a siren could be fired off. There are different modes for arming the
- * system. See {@link TargetSecuritySystemState} for more information.
+ * system. See {@link TargetSecuritySystemStateEnum} for more information.
*
* @author Gaston Dombiak
*/
-public interface SecuritySystem extends HomekitAccessory {
+public interface SecuritySystemAccessory extends HomekitAccessory {
/**
* Retrieves the current state of the security system. The state describes if the system is armed
@@ -26,7 +24,7 @@ public interface SecuritySystem extends HomekitAccessory {
*
* @return current state of the security system.
*/
- CompletableFuture getCurrentSecuritySystemState();
+ CompletableFuture getCurrentSecuritySystemState();
/**
* Subscribes to changes to the state of the security system.
@@ -45,14 +43,14 @@ public interface SecuritySystem extends HomekitAccessory {
* @param state target state of the security system.
* @throws Exception when the change cannot be made.
*/
- void setTargetSecuritySystemState(TargetSecuritySystemState state) throws Exception;
+ void setTargetSecuritySystemState(TargetSecuritySystemStateEnum state) throws Exception;
/**
* Retrieves the pending, but not yet completed, state of the security system.
*
* @return target state of the security system.
*/
- CompletableFuture getTargetSecuritySystemState();
+ CompletableFuture getTargetSecuritySystemState();
/**
* Subscribes to changes in the pending, but not yet completed, state of the security system.
@@ -66,23 +64,6 @@ public interface SecuritySystem extends HomekitAccessory {
*/
void unsubscribeTargetSecuritySystemState();
- /**
- * Retrieves the alarm type of the security system.
- *
- * @return alarm type of the security system.
- */
- CompletableFuture getAlarmTypeState();
-
- /**
- * Subscribes to changes to the alarm type of the security system.
- *
- * @param callback the function to call when the alarm type changes.
- */
- void subscribeAlarmTypeState(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the alarm type of the security system. */
- void unsubscribeAlarmTypeState();
-
@Override
default Collection getServices() {
return Collections.singleton(new SecuritySystemService(this));
diff --git a/src/main/java/io/github/hapjava/accessories/SlatAccessory.java b/src/main/java/io/github/hapjava/accessories/SlatAccessory.java
new file mode 100644
index 000000000..62888ab60
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/SlatAccessory.java
@@ -0,0 +1,43 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.slat.CurrentSlatStateEnum;
+import io.github.hapjava.characteristics.impl.slat.SlatTypeEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.SlatService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** A slat accessory which tilts on a vertical or a horizontal axis. */
+public interface SlatAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the current state of the slat
+ *
+ * @return a future that will contain the state
+ */
+ CompletableFuture getSlatState();
+
+ /**
+ * Subscribes to changes in the state of the slat.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeSlatState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the state of the slat. */
+ void unsubscribeSlatState();
+
+ /**
+ * Retrieves the slat type.
+ *
+ * @return a future that will slat type.
+ */
+ CompletableFuture getSlatType();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SlatService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/SmokeSensor.java b/src/main/java/io/github/hapjava/accessories/SmokeSensorAccessory.java
similarity index 62%
rename from src/main/java/io/github/hapjava/accessories/SmokeSensor.java
rename to src/main/java/io/github/hapjava/accessories/SmokeSensorAccessory.java
index 68f43d1a7..b6a8b1054 100644
--- a/src/main/java/io/github/hapjava/accessories/SmokeSensor.java
+++ b/src/main/java/io/github/hapjava/accessories/SmokeSensorAccessory.java
@@ -1,10 +1,9 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.SmokeDetectedState;
-import io.github.hapjava.impl.services.SmokeSensorService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.smokesensor.SmokeDetectedStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.SmokeSensorService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -12,24 +11,16 @@
/**
* A smoke sensor reports whether smoke has been detected or not.
*
- * Smoke sensors that run on batteries will need to implement this interface and also implement
- * {@link BatteryStatusAccessory}.
- *
* @author Gaston Dombiak
*/
-public interface SmokeSensor extends HomekitAccessory {
+public interface SmokeSensorAccessory extends HomekitAccessory {
/**
* Retrieves the state of the smoke sensor. This is whether smoke has been detected or not.
*
* @return a future that will contain the smoke sensor's state
*/
- CompletableFuture getSmokeDetectedState();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new SmokeSensorService(this));
- }
+ CompletableFuture getSmokeDetectedState();
/**
* Subscribes to changes in the smoke sensor's state.
@@ -40,4 +31,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the smoke sensor's state. */
void unsubscribeSmokeDetectedState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SmokeSensorService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/SpeakerAccessory.java b/src/main/java/io/github/hapjava/accessories/SpeakerAccessory.java
new file mode 100644
index 000000000..661607a30
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/SpeakerAccessory.java
@@ -0,0 +1,43 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.SpeakerService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Speaker accessory. */
+public interface SpeakerAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves mute status.
+ *
+ * @return true if accessory is muted
+ */
+ CompletableFuture isMuted();
+
+ /**
+ * Sets the mute status
+ *
+ * @param mute true if accessory should be muted
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setMute(boolean mute) throws Exception;
+
+ /**
+ * Subscribes to changes in mute state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeMuteState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the mute state. */
+ void unsubscribeMuteState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SpeakerService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/StatelessProgrammableSwitchAccessory.java b/src/main/java/io/github/hapjava/accessories/StatelessProgrammableSwitchAccessory.java
new file mode 100644
index 000000000..354c36587
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/StatelessProgrammableSwitchAccessory.java
@@ -0,0 +1,36 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.ProgrammableSwitchEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.StatelessProgrammableSwitchService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** The Stateless Programmable Switch accessory */
+public interface StatelessProgrammableSwitchAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the last states of the switch. Bluetooth device should return the last event, the IP
+ * device should always return null
+ *
+ * @return state of the switch event
+ */
+ CompletableFuture getSwitchEvent();
+
+ /**
+ * Subscribes to changes in switch event, i.e. pressing on the button.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeSwitchEvent(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in switch event. */
+ void unsubscribeSwitchEvent();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new StatelessProgrammableSwitchService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/Switch.java b/src/main/java/io/github/hapjava/accessories/SwitchAccessory.java
similarity index 82%
rename from src/main/java/io/github/hapjava/accessories/Switch.java
rename to src/main/java/io/github/hapjava/accessories/SwitchAccessory.java
index 682d758c2..aae442f90 100644
--- a/src/main/java/io/github/hapjava/accessories/Switch.java
+++ b/src/main/java/io/github/hapjava/accessories/SwitchAccessory.java
@@ -1,7 +1,8 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.*;
-import io.github.hapjava.impl.services.SwitchService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.SwitchService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -11,7 +12,7 @@
*
* @author Andy Lintner
*/
-public interface Switch extends HomekitAccessory {
+public interface SwitchAccessory extends HomekitAccessory {
/**
* Retrieves the current binary state of the switch.
@@ -29,11 +30,6 @@ public interface Switch extends HomekitAccessory {
*/
CompletableFuture setSwitchState(boolean state) throws Exception;
- @Override
- default Collection getServices() {
- return Collections.singleton(new SwitchService(this));
- }
-
/**
* Subscribes to changes in the binary state of the switch.
*
@@ -43,4 +39,9 @@ default Collection getServices() {
/** Unsubscribes from changes in the binary state of the switch. */
void unsubscribeSwitchState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SwitchService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/TemperatureSensor.java b/src/main/java/io/github/hapjava/accessories/TemperatureSensor.java
deleted file mode 100644
index a53b40a00..000000000
--- a/src/main/java/io/github/hapjava/accessories/TemperatureSensor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package io.github.hapjava.accessories;
-
-import io.github.hapjava.*;
-import io.github.hapjava.accessories.properties.TemperatureUnit;
-import io.github.hapjava.impl.services.TemperatureSensorService;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * A temperature sensor that reports the current temperature
- *
- * @author Andy Lintner
- */
-public interface TemperatureSensor extends HomekitAccessory {
-
- /**
- * Retrieves the current temperature, in celsius degrees.
- *
- * @return a future that will contain the temperature.
- */
- CompletableFuture getCurrentTemperature();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new TemperatureSensorService(this));
- }
-
- /**
- * Subscribes to changes in the current temperature.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentTemperature(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the current temperature. */
- void unsubscribeCurrentTemperature();
-
- /**
- * Retrieves the minimum temperature, in celsius degrees, the thermostat can be set to.
- *
- * @return the minimum temperature.
- */
- double getMinimumTemperature();
-
- /**
- * Retrieves the maximum temperature, in celsius degrees, the thermostat can be set to.
- *
- * @return the maximum temperature.
- */
- double getMaximumTemperature();
-
- /**
- * Retrieves the temperature unit of the thermostat. The impact of this is unclear, as the actual
- * temperature is always communicated in celsius degrees, and the iOS device uses the user's
- * locale to determine the unit to convert to.
- *
- * @return the temperature unit of the thermostat.
- */
- default TemperatureUnit getTemperatureUnit() {
- return TemperatureUnit.CELSIUS;
- }
-
- /**
- * set default temperature unit of the thermostat. this is the unit thermostat use to display
- * temprature. the homekit interface uses celsius.
- *
- * @param unit the temperature unit of the thermostat.
- */
- default void setTemperatureUnit(TemperatureUnit unit) {
- // override depending on the thermostat if required.
- }
-
- /**
- * subscribe to unit changes.
- *
- * @param callback callback
- */
- default void subscribeTemperatureUnit(final HomekitCharacteristicChangeCallback callback) {}
-
- /** unsubscribe from unit changes. */
- default void unsubscribeTemperatureUnit() {}
-}
diff --git a/src/main/java/io/github/hapjava/accessories/TemperatureSensorAccessory.java b/src/main/java/io/github/hapjava/accessories/TemperatureSensorAccessory.java
new file mode 100644
index 000000000..4f9184926
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/TemperatureSensorAccessory.java
@@ -0,0 +1,68 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.TemperatureSensorService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * A temperature sensor that reports the current temperature
+ *
+ * @author Andy Lintner
+ */
+public interface TemperatureSensorAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the current temperature, in celsius degrees.
+ *
+ * @return a future that will contain the temperature.
+ */
+ CompletableFuture getCurrentTemperature();
+
+ /**
+ * return the min value for current temperature. overwrite if you want to change the default
+ * value.
+ *
+ * @return min current temperature
+ */
+ default double getMinCurrentTemperature() {
+ return 0;
+ }
+
+ /**
+ * return the max value for current temperature. overwrite if you want to change the default
+ * value.
+ *
+ * @return max current temperature
+ */
+ default double getMaxCurrentTemperature() {
+ return 100;
+ }
+
+ /**
+ * return the min step value for current temperature. overwrite if you want to change the default
+ * value.
+ *
+ * @return min step current temperature
+ */
+ default double getMinStepCurrentTemperature() {
+ return 0.1;
+ }
+
+ /**
+ * Subscribes to changes in the current temperature.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current temperature. */
+ void unsubscribeCurrentTemperature();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new TemperatureSensorService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/Thermostat.java b/src/main/java/io/github/hapjava/accessories/Thermostat.java
deleted file mode 100644
index 54b1ca625..000000000
--- a/src/main/java/io/github/hapjava/accessories/Thermostat.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package io.github.hapjava.accessories;
-
-import io.github.hapjava.accessories.thermostat.*;
-
-/**
- * A thermostat with heating and cooling controls.
- *
- * @author Andy Lintner
- * @deprecated Use {@link BasicThermostat}, {@link HeatingThermostat}, and {@link CoolingThermostat}
- * instead
- */
-@Deprecated
-public interface Thermostat extends BasicThermostat, HeatingThermostat, CoolingThermostat {}
diff --git a/src/main/java/io/github/hapjava/accessories/ThermostatAccessory.java b/src/main/java/io/github/hapjava/accessories/ThermostatAccessory.java
new file mode 100644
index 000000000..f55ed7a63
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/ThermostatAccessory.java
@@ -0,0 +1,196 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.thermostat.CurrentHeatingCoolingStateEnum;
+import io.github.hapjava.characteristics.impl.thermostat.TargetHeatingCoolingStateEnum;
+import io.github.hapjava.characteristics.impl.thermostat.TemperatureDisplayUnitEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.ThermostatService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * A thermostat with heating and cooling controls.
+ *
+ * @author Andy Lintner
+ */
+public interface ThermostatAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the current temperature, in celsius degrees.
+ *
+ * @return a future that will contain the temperature.
+ */
+ CompletableFuture getCurrentTemperature();
+
+ /**
+ * return the min value for current temperature. overwrite if you want to change the default
+ * value.
+ *
+ * @return min current temperature
+ */
+ default double getMinCurrentTemperature() {
+ return 0;
+ }
+
+ /**
+ * return the max value for current temperature. overwrite if you want to change the default
+ * value.
+ *
+ * @return max current temperature
+ */
+ default double getMaxCurrentTemperature() {
+ return 100;
+ }
+
+ /**
+ * return the min step value for current temperature. overwrite if you want to change the default
+ * value.
+ *
+ * @return min step current temperature
+ */
+ default double getMinStepCurrentTemperature() {
+ return 0.1;
+ }
+
+ /**
+ * Retrieves the target temperature, in celsius degrees.
+ *
+ * @return a future that will contain the target temperature.
+ */
+ CompletableFuture getTargetTemperature();
+
+ /**
+ * Sets the target temperature.
+ *
+ * @param value the target temperature, in celsius degrees.
+ * @throws Exception when the temperature cannot be changed.
+ */
+ void setTargetTemperature(Double value) throws Exception;
+
+ /**
+ * return the min value for target temperature. overwrite if you want to change the default value.
+ *
+ * @return min target temperature
+ */
+ default double getMinTargetTemperature() {
+ return 10;
+ }
+
+ /**
+ * return the max value for target temperature. overwrite if you want to change the default value.
+ *
+ * @return max target temperature
+ */
+ default double getMaxTargetTemperature() {
+ return 38;
+ }
+
+ /**
+ * return the min step value for target temperature. overwrite if you want to change the default
+ * value.
+ *
+ * @return min step target temperature
+ */
+ default double getMinStepTargetTemperature() {
+ return 0.1;
+ }
+
+ /**
+ * Retrieves the current {@link CurrentHeatingCoolingStateEnum} of the thermostat.
+ *
+ * @return a future that will contain the mode.
+ */
+ CompletableFuture getCurrentState();
+
+ /**
+ * Sets the {@link TargetHeatingCoolingStateEnum} of the thermostat.
+ *
+ * @param mode The {@link TargetHeatingCoolingStateEnum} to set.
+ * @throws Exception when the change cannot be made.
+ */
+ void setTargetState(TargetHeatingCoolingStateEnum mode) throws Exception;
+
+ /**
+ * Retrieves the pending, but not yet complete, {@link TargetHeatingCoolingStateEnum} of the
+ * thermostat.
+ *
+ * @return a future that will contain the target mode.
+ */
+ CompletableFuture getTargetState();
+
+ /**
+ * Retrieves the temperture display units, e.g. C or F.
+ *
+ * @return a future that will contain the temperature unit.
+ */
+ CompletableFuture getTemperatureDisplayUnit();
+
+ /**
+ * Sets the temperature unit.
+ *
+ * @param value the temperature display unit.
+ * @throws Exception when the temperature cannot be changed.
+ */
+ void setTemperatureDisplayUnit(TemperatureDisplayUnitEnum value) throws Exception;
+
+ /**
+ * Subscribes to changes in the pending, but not yet complete, {@link
+ * TargetHeatingCoolingStateEnum} of the thermostat.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the target temperature.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the temperature display unit.
+ *
+ * @param callback the function to call when the uni changes.
+ */
+ void subscribeTemperatureDisplayUnit(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the current temperature.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the {@link CurrentHeatingCoolingStateEnum} of the thermostat.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the mode of the thermostat. */
+ void unsubscribeCurrentState();
+
+ /**
+ * Unsubscribes from changes in the pending, but not yet complete, {@link
+ * TargetHeatingCoolingStateEnum} of the thermostat.
+ */
+ void unsubscribeTargetState();
+
+ /** Unsubscribes from changes in the current temperature. */
+ void unsubscribeCurrentTemperature();
+
+ /** Unsubscribes from changes in temperature display unit */
+ void unsubscribeTemperatureDisplayUnit();
+
+ /** Unsubscribes from changes in the target temperature. */
+ void unsubscribeTargetTemperature();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new ThermostatService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/Valve.java b/src/main/java/io/github/hapjava/accessories/ValveAccessory.java
similarity index 73%
rename from src/main/java/io/github/hapjava/accessories/Valve.java
rename to src/main/java/io/github/hapjava/accessories/ValveAccessory.java
index 8a62f0772..3db17e41f 100644
--- a/src/main/java/io/github/hapjava/accessories/Valve.java
+++ b/src/main/java/io/github/hapjava/accessories/ValveAccessory.java
@@ -1,10 +1,11 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.ValveType;
-import io.github.hapjava.impl.services.ValveService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.ActiveEnum;
+import io.github.hapjava.characteristics.impl.common.InUseEnum;
+import io.github.hapjava.characteristics.impl.valve.ValveTypeEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.ValveService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
@@ -14,12 +15,7 @@
*
* @author Tim Harper
*/
-public interface Valve extends HomekitAccessory {
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new ValveService(this));
- }
+public interface ValveAccessory extends HomekitAccessory {
/**
* Retrieves the current active state of the valve; Active could mean the valve is open (but not
@@ -30,7 +26,7 @@ default Collection getServices() {
*
* @return a future that will contain the binary state
*/
- CompletableFuture getValveActive();
+ CompletableFuture getValveActive();
/**
* Sets the valve active state
@@ -39,7 +35,7 @@ default Collection getServices() {
* @return a future that completes when the change is made
* @throws Exception when the change cannot be made
*/
- CompletableFuture setValveActive(boolean active) throws Exception;
+ CompletableFuture setValveActive(ActiveEnum active) throws Exception;
/**
* Subscribes to changes in the active state of the valve.
@@ -59,7 +55,7 @@ default Collection getServices() {
*
* @return a future that will contain the binary state
*/
- CompletableFuture getValveInUse();
+ CompletableFuture getValveInUse();
/**
* Subscribes to changes in the inUse state of the valve.
@@ -74,11 +70,9 @@ default Collection getServices() {
/**
* Retrieves the valve type.
*
- * To communicate water is flowing through a valve, inUse should be used.
- *
- * @return a future that will contain the binary state
+ * @return a future that will contain the valve type.
*/
- CompletableFuture getValveType();
+ CompletableFuture getValveType();
/**
* Subscribes to changes in the valveType state of the valve.
@@ -87,6 +81,11 @@ default Collection getServices() {
*/
void subscribeValveType(HomekitCharacteristicChangeCallback callback);
- /** Unsubscribes from changes in the valveType state light. */
+ /** Unsubscribes from changes in the valveType state. */
void unsubscribeValveType();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new ValveService(this));
+ }
}
diff --git a/src/main/java/io/github/hapjava/accessories/ValveWithTimer.java b/src/main/java/io/github/hapjava/accessories/ValveWithTimer.java
deleted file mode 100644
index 5ed2ee048..000000000
--- a/src/main/java/io/github/hapjava/accessories/ValveWithTimer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package io.github.hapjava.accessories;
-
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * Extends {@link Valve} with timer values.
- *
- * @author Tim Harper
- */
-public interface ValveWithTimer extends Valve {
-
- /**
- * Retrieves the current duration for which the valve will run
- *
- * @return a future with the value
- */
- CompletableFuture getRemainingDuration();
-
- /**
- * Subscribes to changes in the duration; note it is not necessary to emit a change every second,
- * homekit infers the countdown progress clientside.
- *
- * @param callback the function when the existing duration has been replaced with a new one.
- */
- void subscribeRemainingDuration(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes */
- void unsubscribeRemainingDuration();
-
- /**
- * Retrieves the current set duration for which the valve will be scheduled to run; this is
- * usually used as the duration to use when the valve is set to active.
- *
- * @return a future with the value
- */
- CompletableFuture getSetDuration();
-
- /**
- * Sets the duration for which the valve will be scheduled to run; this is usually used as the
- * duration to use when the valve is set to active.
- *
- * If the valve is currently running, then Homekit assumes that changing this value affects the
- * current remaining duration.
- *
- * @return a future with the value
- */
- CompletableFuture setSetDuration(int value);
-
- /**
- * Subscribes to changes in the set duration
- *
- * @param callback the function when the value has changed
- */
- void subscribeSetDuration(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes */
- void unsubscribeSetDuration();
-}
diff --git a/src/main/java/io/github/hapjava/accessories/WindowAccessory.java b/src/main/java/io/github/hapjava/accessories/WindowAccessory.java
new file mode 100644
index 000000000..6cc52322b
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/WindowAccessory.java
@@ -0,0 +1,78 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.windowcovering.PositionStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.WindowService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** motorized window accessory. */
+public interface WindowAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the position state of the door
+ *
+ * @return a future which will contain the door's position state
+ */
+ CompletableFuture getPositionState();
+
+ /**
+ * Retrieves the current position of the door
+ *
+ * @return a future which will contain the door's current position
+ */
+ CompletableFuture getCurrentPosition();
+
+ /**
+ * Retrieves the target position of the door
+ *
+ * @return a future which will contain the door's target position
+ */
+ CompletableFuture getTargetPosition();
+
+ /**
+ * Sets the targeted state of the door.
+ *
+ * @param position the targeted position
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetPosition(Integer position) throws Exception;
+
+ /**
+ * Subscribes to changes in the door's position state
+ *
+ * @param callback the function to call when the state changes
+ */
+ void subscribePositionState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the door's current position
+ *
+ * @param callback the function to call when the current position changes
+ */
+ void subscribeCurrentPosition(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the door's target position
+ *
+ * @param callback the function to call when the target position changes
+ */
+ void subscribeTargetPosition(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the door's state */
+ void unsubscribePositionState();
+
+ /** Unsubscribes from changes in the door's current position */
+ void unsubscribeCurrentPosition();
+
+ /** Unsubscribes from changes in the door's target position */
+ void unsubscribeTargetPosition();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new WindowService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/WindowCovering.java b/src/main/java/io/github/hapjava/accessories/WindowCovering.java
deleted file mode 100644
index afabbf097..000000000
--- a/src/main/java/io/github/hapjava/accessories/WindowCovering.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package io.github.hapjava.accessories;
-
-/**
- * A window covering, like blinds, which can be remotely controlled.
- *
- * @author Andy Lintner
- * @deprecated In 1.2.x, this interface will become replaced with BasicWindowCovering. Update your
- * code to use that interface for now, and include the HoldPositionWindowCovering and
- * ObstructionDetectedWindowCovering interfaces respectively
- */
-@Deprecated
-public interface WindowCovering
- extends BasicWindowCovering, HoldPositionWindowCovering, ObstructionDetectedWindowCovering {
- /*
- * TODO - 1.2.x: Replace this interface with BasicWindowCovering */
-}
diff --git a/src/main/java/io/github/hapjava/accessories/BasicWindowCovering.java b/src/main/java/io/github/hapjava/accessories/WindowCoveringAccessory.java
similarity index 81%
rename from src/main/java/io/github/hapjava/accessories/BasicWindowCovering.java
rename to src/main/java/io/github/hapjava/accessories/WindowCoveringAccessory.java
index 7d58b2b2d..1b618d66f 100644
--- a/src/main/java/io/github/hapjava/accessories/BasicWindowCovering.java
+++ b/src/main/java/io/github/hapjava/accessories/WindowCoveringAccessory.java
@@ -1,16 +1,15 @@
package io.github.hapjava.accessories;
-import io.github.hapjava.HomekitAccessory;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
-import io.github.hapjava.Service;
-import io.github.hapjava.accessories.properties.WindowCoveringPositionState;
-import io.github.hapjava.impl.services.WindowCoveringService;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.windowcovering.PositionStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.WindowCoveringService;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
-public interface BasicWindowCovering extends HomekitAccessory {
-
+/** A window covering, like blinds, which can be remotely controlled. */
+public interface WindowCoveringAccessory extends HomekitAccessory {
/**
* Retrieves the current position
*
@@ -30,7 +29,7 @@ public interface BasicWindowCovering extends HomekitAccessory {
*
* @return a future that will contain the current state
*/
- CompletableFuture getPositionState();
+ CompletableFuture getPositionState();
/**
* Sets the target position
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithAccessoryFlags.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithAccessoryFlags.java
new file mode 100644
index 000000000..27d9c2e18
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithAccessoryFlags.java
@@ -0,0 +1,26 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.accessoryinformation.AccessoryFlagsEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with accessory flags, which indicates that additional setup is required */
+public interface AccessoryWithAccessoryFlags {
+
+ /**
+ * When set indicates accessory requires additional setup.
+ *
+ * @return a future that will contain the accessory flags
+ */
+ CompletableFuture getAccessoryFlags();
+
+ /**
+ * Subscribes to changes in accessory flags
+ *
+ * @param callback the function to call when the accessory flags changes.
+ */
+ void subscribeAccessoryFlags(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the accessory flags . */
+ void unsubscribeAccessoryFlags();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/DimmableLightbulb.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithBrightness.java
similarity index 81%
rename from src/main/java/io/github/hapjava/accessories/DimmableLightbulb.java
rename to src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithBrightness.java
index 2eea5abdb..4fa4557c2 100644
--- a/src/main/java/io/github/hapjava/accessories/DimmableLightbulb.java
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithBrightness.java
@@ -1,14 +1,14 @@
-package io.github.hapjava.accessories;
+package io.github.hapjava.accessories.optionalcharacteristic;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import java.util.concurrent.CompletableFuture;
/**
- * Extends {@link Lightbulb} with brightness values.
+ * Accessory with brightness values.
*
* @author Andy Lintner
*/
-public interface DimmableLightbulb extends Lightbulb {
+public interface AccessoryWithBrightness {
/**
* Retrieves the current brightness of the light
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonDioxideLevel.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonDioxideLevel.java
new file mode 100644
index 000000000..bd4bb3afc
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonDioxideLevel.java
@@ -0,0 +1,42 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with carbon dioxide level and peak level characteristic. */
+public interface AccessoryWithCarbonDioxideLevel {
+
+ /**
+ * Retrieves the carbon dioxide peak level
+ *
+ * @return a future that will contain the carbon dioxide level as a value between 0 and 100000
+ */
+ CompletableFuture getCarbonDioxidePeakLevel();
+
+ /**
+ * Retrieves the carbon dioxide level
+ *
+ * @return a future that will contain the carbon dioxide level as a value between 0 and 100000
+ */
+ CompletableFuture getCarbonDioxideLevel();
+
+ /**
+ * Subscribes to changes in the carbon dioxide level.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCarbonDioxideLevel(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the carbon dioxide level. */
+ void unsubscribeCarbonDioxideLevel();
+
+ /**
+ * Subscribes to changes in the carbon dioxide level.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCarbonDioxidePeakLevel(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the carbon dioxide level. */
+ void unsubscribeCarbonDioxidePeakLevel();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonMonoxideLevel.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonMonoxideLevel.java
new file mode 100644
index 000000000..a3946c40b
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonMonoxideLevel.java
@@ -0,0 +1,42 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with carbon dioxide level and peak level characteristic. */
+public interface AccessoryWithCarbonMonoxideLevel {
+
+ /**
+ * Retrieves the carbon monoxide peak level
+ *
+ * @return a future that will contain the carbon monoxide level as a value between 0 and 100000
+ */
+ CompletableFuture getCarbonMonoxidePeakLevel();
+
+ /**
+ * Retrieves the carbon monoxide level
+ *
+ * @return a future that will contain the carbon monoxide level as a value between 0 and 100000
+ */
+ CompletableFuture getCarbonMonoxideLevel();
+
+ /**
+ * Subscribes to changes in the carbon monoxide level.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCarbonMonoxideLevel(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the carbon monoxide level. */
+ void unsubscribeCarbonMonoxideLevel();
+
+ /**
+ * Subscribes to changes in the carbon monoxide level.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCarbonMonoxidePeakLevel(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the carbon monoxide level. */
+ void unsubscribeCarbonMonoxidePeakLevel();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/ColorfulLightbulb.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithColor.java
similarity index 85%
rename from src/main/java/io/github/hapjava/accessories/ColorfulLightbulb.java
rename to src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithColor.java
index 32ed8d294..e8f2dd66a 100644
--- a/src/main/java/io/github/hapjava/accessories/ColorfulLightbulb.java
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithColor.java
@@ -1,15 +1,14 @@
-package io.github.hapjava.accessories;
+package io.github.hapjava.accessories.optionalcharacteristic;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import java.util.concurrent.CompletableFuture;
/**
- * Extends {@link Lightbulb} with color settings. This will usually be implemented along with {@link
- * DimmableLightbulb}, but not necessarily so.
+ * Accessory with Color
*
* @author Andy Lintner
*/
-public interface ColorfulLightbulb extends Lightbulb {
+public interface AccessoryWithColor {
/**
* Retrieves the current hue of the light.
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithColorTemperature.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithColorTemperature.java
new file mode 100644
index 000000000..fee36884d
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithColorTemperature.java
@@ -0,0 +1,34 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with color temperature. */
+public interface AccessoryWithColorTemperature {
+
+ /**
+ * Retrieves the color temperature
+ *
+ * @return a future that will contain the brightness, expressed as an integer between 0 and 100.
+ */
+ CompletableFuture getColorTemperature();
+
+ /**
+ * Sets the color temperature
+ *
+ * @param value the brightness, on a scale of 0 to 100, to set
+ * @return a future that completes when the brightness is changed
+ * @throws Exception when the brightness cannot be set
+ */
+ CompletableFuture setColorTemperature(Integer value) throws Exception;
+
+ /**
+ * Subscribes to changes in color temperature.
+ *
+ * @param callback the function to call when the color temperature changes.
+ */
+ void subscribeColorTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the color temperature. */
+ void unsubscribeColorTemperature();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCoolingThresholdTemperature.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCoolingThresholdTemperature.java
new file mode 100644
index 000000000..c42398a10
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCoolingThresholdTemperature.java
@@ -0,0 +1,63 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with cooling threshold temperature. */
+public interface AccessoryWithCoolingThresholdTemperature {
+
+ /**
+ * Retrieves the temperature above which the thermostat should begin cooling.
+ *
+ * @return a future that will contain the threshold temperature, in celsius degrees.
+ */
+ CompletableFuture getCoolingThresholdTemperature();
+
+ /**
+ * Sets the temperature above which the thermostat should begin cooling.
+ *
+ * @param value the threshold temperature, in celsius degrees.
+ * @throws Exception when the threshold temperature cannot be changed.
+ */
+ void setCoolingThresholdTemperature(Double value) throws Exception;
+
+ /**
+ * return the min value for cooling threshold temperature. overwrite if you want to change the
+ * default value.
+ *
+ * @return min threshold temperature
+ */
+ default double getMinCoolingThresholdTemperature() {
+ return 10;
+ }
+
+ /**
+ * return the max value for cooling threshold temperature. overwrite if you want to change the
+ * default value.
+ *
+ * @return max threshold temperature
+ */
+ default double getMaxCoolingThresholdTemperature() {
+ return 35;
+ }
+
+ /**
+ * return the min step value for cooling threshold temperature. overwrite if you want to change
+ * the default value.
+ *
+ * @return step for threshold temperature
+ */
+ default double getStepCoolingThresholdTemperature() {
+ return 0.1;
+ }
+
+ /**
+ * Subscribes to changes in the cooling threshold.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCoolingThresholdTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the cooling threshold. */
+ void unsubscribeCoolingThresholdTemperature();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentHorizontalTilting.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentHorizontalTilting.java
new file mode 100644
index 000000000..b5ce298bf
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentHorizontalTilting.java
@@ -0,0 +1,29 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with current horizontal tilting characteristic.
+ *
+ * @author Andy Lintner
+ */
+public interface AccessoryWithCurrentHorizontalTilting {
+
+ /**
+ * Retrieves the current horizontal tilt angle
+ *
+ * @return a future that will contain the position as a value between -90 and 90
+ */
+ CompletableFuture getCurrentHorizontalTiltAngle();
+
+ /**
+ * Subscribes to changes in the current horizontal tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentHorizontalTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current horizontal tilt angle */
+ void unsubscribeCurrentHorizontalTiltAngle();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentRelativeHumidity.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentRelativeHumidity.java
new file mode 100644
index 000000000..562e42649
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentRelativeHumidity.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** accessory with current relative humidity. */
+public interface AccessoryWithCurrentRelativeHumidity {
+
+ /**
+ * Retrieves the current relative humidity.
+ *
+ * @return a future that will contain the current relative humidity.
+ */
+ CompletableFuture getCurrentRelativeHumidity();
+
+ /**
+ * Subscribes to changes in current relative humidity.
+ *
+ * @param callback the function to call when the current relative humidity changes.
+ */
+ void subscribeCurrentRelativeHumidity(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current relative humidity. */
+ void unsubscribeCurrentRelativeHumidity();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentTilting.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentTilting.java
new file mode 100644
index 000000000..54a558491
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentTilting.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with current tilting characteristic. */
+public interface AccessoryWithCurrentTilting {
+
+ /**
+ * Retrieves the current tilt angle
+ *
+ * @return a future that will contain the position as a value between -90 and 90
+ */
+ CompletableFuture getCurrentTiltAngle();
+
+ /**
+ * Subscribes to changes in the current tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current tilt angle */
+ void unsubscribeCurrentTiltAngle();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentVerticalTilting.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentVerticalTilting.java
new file mode 100644
index 000000000..3b996c925
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentVerticalTilting.java
@@ -0,0 +1,24 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with current vertical tilting characteristic. */
+public interface AccessoryWithCurrentVerticalTilting {
+ /**
+ * Retrieves the current vertical tilt angle
+ *
+ * @return a future that will contain the position as a value between -90 and 90
+ */
+ CompletableFuture getCurrentVerticalTiltAngle();
+
+ /**
+ * Subscribes to changes in the current vertical tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentVerticalTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current vertical tilt angle */
+ void unsubscribeCurrentVerticalTiltAngle();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithDuration.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithDuration.java
new file mode 100644
index 000000000..e3d310dfd
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithDuration.java
@@ -0,0 +1,33 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with duration characteristic. */
+public interface AccessoryWithDuration {
+
+ /**
+ * Retrieves the current set duration;
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getSetDuration();
+
+ /**
+ * Sets the duration for which the service should run.
+ *
+ * @param value duration in seconds
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setSetDuration(int value);
+
+ /**
+ * Subscribes to changes in the set duration
+ *
+ * @param callback the function when the duration has changed
+ */
+ void subscribeSetDuration(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeSetDuration();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithFanState.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithFanState.java
new file mode 100644
index 000000000..75be61e8c
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithFanState.java
@@ -0,0 +1,56 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.fan.CurrentFanStateEnum;
+import io.github.hapjava.characteristics.impl.fan.TargetFanStateEnum;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * An accessory with current and target fan states.
+ *
+ * @author Andy Lintner
+ */
+public interface AccessoryWithFanState {
+
+ /**
+ * Retrieves the current state of the fan (INACTIVE, IDLE, BLOWING AIR).
+ *
+ * @return a future that will contain the state
+ */
+ CompletableFuture getCurrentFanState();
+
+ /**
+ * Retrieves the target state of the fan (MANUAL, AUTO).
+ *
+ * @return a future that will contain the state
+ */
+ CompletableFuture getTargetFanState();
+
+ /**
+ * Set the target state of the fan (MANUAL, AUTO).
+ *
+ * @param targetState target state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setTargetFanState(TargetFanStateEnum targetState);
+
+ /**
+ * Subscribes to changes in the current fan state.
+ *
+ * @param callback the function to call when the direction changes.
+ */
+ void subscribeCurrentFanState(HomekitCharacteristicChangeCallback callback);
+
+ /**
+ * Subscribes to changes in the target fan state.
+ *
+ * @param callback the function to call when the direction changes.
+ */
+ void subscribeTargetFanState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current state of the fan. */
+ void unsubscribeCurrentFanState();
+
+ /** Unsubscribes from changes in the target state of the fan. */
+ void unsubscribeTargetFanState();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHardwareRevision.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHardwareRevision.java
new file mode 100644
index 000000000..866921817
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHardwareRevision.java
@@ -0,0 +1,14 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with hardware revision. */
+public interface AccessoryWithHardwareRevision {
+
+ /**
+ * Returns a hardware revision to display in iOS.
+ *
+ * @return the hardware revision, or null.
+ */
+ CompletableFuture getHardwareRevision();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHeatingThresholdTemperature.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHeatingThresholdTemperature.java
new file mode 100644
index 000000000..02cb3f819
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHeatingThresholdTemperature.java
@@ -0,0 +1,62 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+public interface AccessoryWithHeatingThresholdTemperature {
+
+ /**
+ * Retrieves the temperature below which the thermostat should begin heating.
+ *
+ * @return a future that will contain the threshold temperature, in celsius degrees.
+ */
+ CompletableFuture getHeatingThresholdTemperature();
+
+ /**
+ * Sets the temperature below which the thermostat should begin heating.
+ *
+ * @param value the threshold temperature, in celsius degrees.
+ * @throws Exception when the threshold temperature cannot be changed.
+ */
+ void setHeatingThresholdTemperature(Double value) throws Exception;
+
+ /**
+ * return the min value for heating threshold temperature. overwrite if you want to change the
+ * default value.
+ *
+ * @return min threshold temperature
+ */
+ default double getMinHeatingThresholdTemperature() {
+ return 0;
+ }
+
+ /**
+ * return the max value for heating threshold temperature. overwrite if you want to change the
+ * default value.
+ *
+ * @return max threshold temperature
+ */
+ default double getMaxHeatingThresholdTemperature() {
+ return 25;
+ }
+
+ /**
+ * return the min step value for heating threshold temperature. overwrite if you want to change
+ * the default value.
+ *
+ * @return step for threshold temperature
+ */
+ default double getStepHeatingThresholdTemperature() {
+ return 0.1;
+ }
+
+ /**
+ * Subscribes to changes in the heating threshold.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeHeatingThresholdTemperature(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the heating threshold. */
+ void unsubscribeHeatingThresholdTemperature();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/HoldPositionWindowCovering.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHoldPosition.java
similarity index 71%
rename from src/main/java/io/github/hapjava/accessories/HoldPositionWindowCovering.java
rename to src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHoldPosition.java
index f5cfe0c80..b1d0d65fa 100644
--- a/src/main/java/io/github/hapjava/accessories/HoldPositionWindowCovering.java
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHoldPosition.java
@@ -1,8 +1,9 @@
-package io.github.hapjava.accessories;
+package io.github.hapjava.accessories.optionalcharacteristic;
import java.util.concurrent.CompletableFuture;
-public interface HoldPositionWindowCovering {
+/** Accessory with hold position */
+public interface AccessoryWithHoldPosition {
/**
* Sets the hold position state
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHumidityDehumidifierThreshold.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHumidityDehumidifierThreshold.java
new file mode 100644
index 000000000..4dff49352
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHumidityDehumidifierThreshold.java
@@ -0,0 +1,33 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Dehumidifier with humidity threshold. */
+public interface AccessoryWithHumidityDehumidifierThreshold {
+
+ /**
+ * Retrieves the humidity threshold.
+ *
+ * @return a future that will contain the humidity threshold.
+ */
+ CompletableFuture getHumidityThreshold();
+
+ /**
+ * Sets the humidity threshold above which the dehumidifier should be turned on.
+ *
+ * @param value the humidity threshold, in celsius degrees.
+ * @throws Exception when the threshold cannot be changed.
+ */
+ void setHumidityThreshold(Double value) throws Exception;
+
+ /**
+ * Subscribes to changes in the humidity threshold.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeHumidityThreshold(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the humidity threshold. */
+ void unsubscribeHumidityThreshold();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHumidityHumidifierThreshold.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHumidityHumidifierThreshold.java
new file mode 100644
index 000000000..f783a3039
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithHumidityHumidifierThreshold.java
@@ -0,0 +1,33 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Humidifier with humidity threshold. */
+public interface AccessoryWithHumidityHumidifierThreshold {
+
+ /**
+ * Retrieves the humidity threshold.
+ *
+ * @return a future that will contain the humidity threshold.
+ */
+ CompletableFuture getHumidityThreshold();
+
+ /**
+ * Sets the humidity threshold above which the humidifier should be turned on.
+ *
+ * @param value the humidity threshold, in celsius degrees.
+ * @throws Exception when the threshold cannot be changed.
+ */
+ void setHumidityThreshold(Double value) throws Exception;
+
+ /**
+ * Subscribes to changes in the humidity threshold.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeHumidityThreshold(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the humidity threshold. */
+ void unsubscribeHumidityThreshold();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithIsConfigured.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithIsConfigured.java
new file mode 100644
index 000000000..017fdce5f
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithIsConfigured.java
@@ -0,0 +1,38 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.IsConfiguredEnum;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with isConfigured characteristics. This characteristic describes if the service is
+ * configured for use. For example, all of the valves in an irrigation system may not be configured
+ * depending on physical wire connection.
+ */
+public interface AccessoryWithIsConfigured {
+
+ /**
+ * isConfigured state
+ *
+ * @return a future that will contain the isConfigured state
+ */
+ CompletableFuture getIsConfigured();
+
+ /**
+ * Set the isConfigured (NOT_CONFIGURED, CONFIGURED).
+ *
+ * @param isConfigured isConfigured state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setIsConfigured(IsConfiguredEnum isConfigured);
+
+ /**
+ * Subscribes to changes in isConfigured state
+ *
+ * @param callback the function to call when the isConfigured state changes.
+ */
+ void subscribeIsConfigured(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the isConfigured state. */
+ void unsubscribeIsConfigured();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithLockCurrentState.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithLockCurrentState.java
new file mode 100644
index 000000000..f3f9782ca
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithLockCurrentState.java
@@ -0,0 +1,26 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.lock.LockCurrentStateEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with current lock state. */
+public interface AccessoryWithLockCurrentState {
+
+ /**
+ * Retrieves the lock states. The current state of the physical security mechanism (e.g. deadbolt)
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getLockCurrentState();
+
+ /**
+ * Subscribes to changes in lock current state.
+ *
+ * @param callback the function when the lock current state changes
+ */
+ void subscribeLockCurrentState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeLockCurrentState();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithLockTargetState.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithLockTargetState.java
new file mode 100644
index 000000000..41ef0d3ed
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithLockTargetState.java
@@ -0,0 +1,35 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.lock.LockTargetStateEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with lock target state. */
+public interface AccessoryWithLockTargetState {
+
+ /**
+ * Retrieves the lock states. The target state of the physical security mechanism (e.g. deadbolt)
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getLockTargetState();
+
+ /**
+ * Sets the lock target state
+ *
+ * @param state the target state to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setLockTargetState(LockTargetStateEnum state) throws Exception;
+
+ /**
+ * Subscribes to changes in lock target state.
+ *
+ * @param callback the function when the lock target state changes
+ */
+ void subscribeLockTargetState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeLockTargetState();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithName.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithName.java
new file mode 100644
index 000000000..626429124
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithName.java
@@ -0,0 +1,14 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with name. */
+public interface AccessoryWithName {
+
+ /**
+ * Retrieves the name of service.
+ *
+ * @return a future with the name
+ */
+ CompletableFuture getName();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithNitrogenDioxideDensity.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithNitrogenDioxideDensity.java
new file mode 100644
index 000000000..685edfb5c
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithNitrogenDioxideDensity.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with nitrogen dioxide density characteristic. */
+public interface AccessoryWithNitrogenDioxideDensity {
+
+ /**
+ * Retrieves the nitrogen dioxide density.
+ *
+ * @return a future with the nitrogen dioxide density
+ */
+ CompletableFuture getNitrogenDioxideDensity();
+
+ /**
+ * Subscribes to changes in nitrogen dioxide density.
+ *
+ * @param callback the function when nitrogen dioxide density changes
+ */
+ void subscribeNitrogenDioxideDensity(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeNitrogenDioxideDensity();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/ObstructionDetectedWindowCovering.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithObstructionDetection.java
similarity index 66%
rename from src/main/java/io/github/hapjava/accessories/ObstructionDetectedWindowCovering.java
rename to src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithObstructionDetection.java
index 6dea4ec63..859379cd0 100644
--- a/src/main/java/io/github/hapjava/accessories/ObstructionDetectedWindowCovering.java
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithObstructionDetection.java
@@ -1,12 +1,13 @@
-package io.github.hapjava.accessories;
+package io.github.hapjava.accessories.optionalcharacteristic;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import java.util.concurrent.CompletableFuture;
-public interface ObstructionDetectedWindowCovering {
+/** Accessory with hold position */
+public interface AccessoryWithObstructionDetection {
/**
- * Retrieves an indication that the window covering is obstructed from moving
+ * Retrieves an indication obstructed is detected
*
* @return a future that will contain a boolean indicating whether an obstruction is present
*/
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithOzoneDensity.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithOzoneDensity.java
new file mode 100644
index 000000000..87bb8fa74
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithOzoneDensity.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with Ozone Density characteristic. */
+public interface AccessoryWithOzoneDensity {
+
+ /**
+ * Retrieves the ozone density.
+ *
+ * @return a future with the ozone density
+ */
+ CompletableFuture getOzoneDensity();
+
+ /**
+ * Subscribes to changes in ozone density.
+ *
+ * @param callback the function when ozone density changes
+ */
+ void subscribeOzoneDensity(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeOzoneDensity();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPM10Density.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPM10Density.java
new file mode 100644
index 000000000..2bfad14ac
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPM10Density.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with PM10 Density characteristic. */
+public interface AccessoryWithPM10Density {
+
+ /**
+ * Retrieves the PM10 density.
+ *
+ * @return a future with the PM10 density
+ */
+ CompletableFuture getPM10Density();
+
+ /**
+ * Subscribes to changes in PM10 density.
+ *
+ * @param callback the function when PM10 density changes
+ */
+ void subscribePM10Density(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribePM10Density();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPM25Density.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPM25Density.java
new file mode 100644
index 000000000..11ad2a12e
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPM25Density.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with PM25 Density characteristic. */
+public interface AccessoryWithPM25Density {
+
+ /**
+ * Retrieves the PM25 density.
+ *
+ * @return a future with the PM25 density
+ */
+ CompletableFuture getPM25Density();
+
+ /**
+ * Subscribes to changes in PM25 density.
+ *
+ * @param callback the function when PM25 density changes
+ */
+ void subscribePM25Density(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribePM25Density();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPhysicalControlsLock.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPhysicalControlsLock.java
new file mode 100644
index 000000000..2e1e3cd87
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithPhysicalControlsLock.java
@@ -0,0 +1,34 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.fan.LockPhysicalControlsEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with physical controls which can be locked, e.g. child lock */
+public interface AccessoryWithPhysicalControlsLock {
+
+ /**
+ * OPTIONAL: Retrieves the lock controls.
+ *
+ * @return a future that will contain the lock controls
+ */
+ CompletableFuture getLockControls();
+
+ /**
+ * Set the lock controls (DISABLED, ENABLED).
+ *
+ * @param lockControls lock controls mode
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setLockControls(LockPhysicalControlsEnum lockControls);
+
+ /**
+ * Subscribes to changes in the lock controls.
+ *
+ * @param callback the function to call when the lock controls changes.
+ */
+ void subscribeLockControls(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the lock controls. */
+ void unsubscribeLockControls();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRemainingDuration.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRemainingDuration.java
new file mode 100644
index 000000000..b949b413e
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRemainingDuration.java
@@ -0,0 +1,30 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with remaining duration characteristic.
+ *
+ * @author Tim Harper
+ */
+public interface AccessoryWithRemainingDuration {
+
+ /**
+ * Retrieves the remaining duration
+ *
+ * @return a future with the duration in seconds
+ */
+ CompletableFuture getRemainingDuration();
+
+ /**
+ * Subscribes to changes in the duration; note it is not necessary to emit a change every second,
+ * homekit infers the countdown progress client side.
+ *
+ * @param callback the function when the existing duration has been replaced with a new one.
+ */
+ void subscribeRemainingDuration(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeRemainingDuration();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRotationDirection.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRotationDirection.java
new file mode 100644
index 000000000..91acf9afa
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRotationDirection.java
@@ -0,0 +1,35 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.fan.RotationDirectionEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** accessory with rotation direction characteristics. */
+public interface AccessoryWithRotationDirection {
+
+ /**
+ * Retrieves the current rotation direction.
+ *
+ * @return a future that will contain the direction
+ */
+ CompletableFuture getRotationDirection();
+
+ /**
+ * Sets the rotation direction
+ *
+ * @param direction the direction to set
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setRotationDirection(RotationDirectionEnum direction) throws Exception;
+
+ /**
+ * Subscribes to changes in the rotation direction.
+ *
+ * @param callback the function to call when the direction changes.
+ */
+ void subscribeRotationDirection(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the rotation direction. */
+ void unsubscribeRotationDirection();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRotationSpeed.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRotationSpeed.java
new file mode 100644
index 000000000..8b00e3350
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithRotationSpeed.java
@@ -0,0 +1,34 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** accessory with rotation speed characteristics. */
+public interface AccessoryWithRotationSpeed {
+
+ /**
+ * Retrieves the current speed of the rotation
+ *
+ * @return a future that will contain the speed, expressed as an integer between 0 and 100.
+ */
+ CompletableFuture getRotationSpeed();
+
+ /**
+ * Sets the speed of the rotation
+ *
+ * @param speed the speed to set, expressed as an integer between 0 and 100.
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setRotationSpeed(Integer speed) throws Exception;
+
+ /**
+ * Subscribes to changes in the rotation speed.
+ *
+ * @param callback the function to call when the speed changes.
+ */
+ void subscribeRotationSpeed(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the rotation speed. */
+ void unsubscribeRotationSpeed();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSecurityAlarmType.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSecurityAlarmType.java
new file mode 100644
index 000000000..036fd35b3
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSecurityAlarmType.java
@@ -0,0 +1,26 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.securitysystem.SecuritySystemAlarmTypeEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** This characteristic describes the type of alarm triggered by a security system. */
+public interface AccessoryWithSecurityAlarmType {
+
+ /**
+ * return alarm type See {@link SecuritySystemAlarmTypeEnum} for possible values
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getSecurityAlarmType();
+
+ /**
+ * Subscribes to changes in status alarm type
+ *
+ * @param callback the function when the alarm type changes
+ */
+ void subscribeSecurityAlarmType(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeSecurityAlarmType();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithServiceLabelIndex.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithServiceLabelIndex.java
new file mode 100644
index 000000000..07cb17fc7
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithServiceLabelIndex.java
@@ -0,0 +1,14 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with service label index. T */
+public interface AccessoryWithServiceLabelIndex {
+
+ /**
+ * Retrieves the service label index.
+ *
+ * @return a future with the service label index
+ */
+ CompletableFuture getServiceLabelIndex();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusActive.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusActive.java
new file mode 100644
index 000000000..6bd7a18b5
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusActive.java
@@ -0,0 +1,26 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with status active. */
+public interface AccessoryWithStatusActive {
+
+ /**
+ * Retrieves the status active. A value of true indicates that the accessory is active and is
+ * functioning without any errors.
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getStatusActive();
+
+ /**
+ * Subscribes to changes in status active.
+ *
+ * @param callback the function when the status active changes
+ */
+ void subscribeStatusActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeStatusActive();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusFault.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusFault.java
new file mode 100644
index 000000000..b6b0aebdf
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusFault.java
@@ -0,0 +1,28 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.StatusFaultEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with characteristic that describes an accessory which has a fault. */
+public interface AccessoryWithStatusFault {
+
+ /**
+ * Retrieves the status fault. A non-zero value indicates that the accessory has experienced a
+ * fault that may be interfering with its intended functionality. A value of 0 indicates that
+ * there is no fault.
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getStatusFault();
+
+ /**
+ * Subscribes to changes in status fault.
+ *
+ * @param callback the function when the status fault changes
+ */
+ void subscribeStatusFault(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeStatusFault();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusLowBattery.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusLowBattery.java
new file mode 100644
index 000000000..def16df5d
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusLowBattery.java
@@ -0,0 +1,27 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.battery.StatusLowBatteryEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** This characteristic describes an accessoryʼs battery status. */
+public interface AccessoryWithStatusLowBattery {
+
+ /**
+ * A status of 1 indicates that the battery level of the accessory is low. Value should return to
+ * 0 when the battery charges to a level thats above the low threshold.
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getStatusLowBattery();
+
+ /**
+ * Subscribes to changes in status low battery.
+ *
+ * @param callback the function when the status low batter changes
+ */
+ void subscribeStatusLowBattery(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeStatusLowBattery();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusTampered.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusTampered.java
new file mode 100644
index 000000000..fe25d2f44
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithStatusTampered.java
@@ -0,0 +1,26 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.StatusTamperedEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** This characteristic describes an accessory which has been tampered with. */
+public interface AccessoryWithStatusTampered {
+
+ /**
+ * Retrieves the status tampered.
+ *
+ * @return a future with the value
+ */
+ CompletableFuture getStatusTampered();
+
+ /**
+ * Subscribes to changes in status tampered.
+ *
+ * @param callback the function when the status tampered changes
+ */
+ void subscribeStatusTampered(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeStatusTampered();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSulphurDioxideDensity.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSulphurDioxideDensity.java
new file mode 100644
index 000000000..94fad0be4
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSulphurDioxideDensity.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with sulphur dioxide density characteristic. */
+public interface AccessoryWithSulphurDioxideDensity {
+
+ /**
+ * Retrieves the sulphur dioxide density.
+ *
+ * @return a future with the sulphur dioxide density
+ */
+ CompletableFuture getSulphurDioxideDensity();
+
+ /**
+ * Subscribes to changes in sulphur dioxide density.
+ *
+ * @param callback the function when sulphur dioxide density changes
+ */
+ void subscribeSulphurDioxideDensity(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes */
+ void unsubscribeSulphurDioxideDensity();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSwingMode.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSwingMode.java
new file mode 100644
index 000000000..ae49ffee6
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithSwingMode.java
@@ -0,0 +1,34 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.fan.SwingModeEnum;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with Swing Mode characteristics. */
+public interface AccessoryWithSwingMode {
+
+ /**
+ * Retrieves the swing mode.
+ *
+ * @return a future that will contain the swing mode
+ */
+ CompletableFuture getSwingMode();
+
+ /**
+ * Set the swing mode (DISABLED, ENABLED).
+ *
+ * @param swingMode swing mode
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setSwingMode(SwingModeEnum swingMode);
+
+ /**
+ * Subscribes to changes in the swing mode.
+ *
+ * @param callback the function to call when the swing mode changes.
+ */
+ void subscribeSwingMode(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the swing mode. */
+ void unsubscribeSwingMode();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/HorizontalTiltingWindowCovering.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetHorizontalTilting.java
similarity index 54%
rename from src/main/java/io/github/hapjava/accessories/HorizontalTiltingWindowCovering.java
rename to src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetHorizontalTilting.java
index 623291f02..cc154520d 100644
--- a/src/main/java/io/github/hapjava/accessories/HorizontalTiltingWindowCovering.java
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetHorizontalTilting.java
@@ -1,21 +1,14 @@
-package io.github.hapjava.accessories;
+package io.github.hapjava.accessories.optionalcharacteristic;
-import io.github.hapjava.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
import java.util.concurrent.CompletableFuture;
/**
- * Extends WindowCovering with the ability to control horizontal tilt angles
+ * Accessory with target horizontal tilting characteristic.
*
* @author Andy Lintner
*/
-public interface HorizontalTiltingWindowCovering extends WindowCovering {
-
- /**
- * Retrieves the current horizontal tilt angle
- *
- * @return a future that will contain the position as a value between -90 and 90
- */
- CompletableFuture getCurrentHorizontalTiltAngle();
+public interface AccessoryWithTargetHorizontalTilting {
/**
* Retrieves the target horizontal tilt angle
@@ -33,13 +26,6 @@ public interface HorizontalTiltingWindowCovering extends WindowCovering {
*/
CompletableFuture setTargetHorizontalTiltAngle(int angle) throws Exception;
- /**
- * Subscribes to changes in the current horizontal tilt angle.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentHorizontalTiltAngle(HomekitCharacteristicChangeCallback callback);
-
/**
* Subscribes to changes in the target horizontal tilt angle.
*
@@ -47,9 +33,6 @@ public interface HorizontalTiltingWindowCovering extends WindowCovering {
*/
void subscribeTargetHorizontalTiltAngle(HomekitCharacteristicChangeCallback callback);
- /** Unsubscribes from changes in the current horizontal tilt angle */
- void unsubscribeCurrentHorizontalTiltAngle();
-
/** Unsubscribes from changes in the target horizontal tilt angle */
void unsubscribeTargetHorizontalTiltAngle();
}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetRelativeHumidity.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetRelativeHumidity.java
new file mode 100644
index 000000000..23ac5fd97
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetRelativeHumidity.java
@@ -0,0 +1,33 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** accessory with target relative humidity. */
+public interface AccessoryWithTargetRelativeHumidity {
+
+ /**
+ * Retrieves the target relative humidity.
+ *
+ * @return a future that will contain the target relative humidity.
+ */
+ CompletableFuture getTargetRelativeHumidity();
+
+ /**
+ * Sets the target relative humidity.
+ *
+ * @param value the target relative humidity.
+ * @throws Exception when the target relative humidity cannot be changed.
+ */
+ void setTargetRelativeHumidity(Double value) throws Exception;
+
+ /**
+ * Subscribes to changes in the target relative humidity.
+ *
+ * @param callback the function to call when the target relative humidity changes.
+ */
+ void subscribeTargetRelativeHumidity(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the target relative humidity. */
+ void unsubscribeTargetRelativeHumidity();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetTilting.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetTilting.java
new file mode 100644
index 000000000..9c2bc8009
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetTilting.java
@@ -0,0 +1,34 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with target tilting characteristic. */
+public interface AccessoryWithTargetTilting {
+
+ /**
+ * Retrieves the target tilt angle
+ *
+ * @return a future that will contain the target position as a value between -90 and 90
+ */
+ CompletableFuture getTargetTiltAngle();
+
+ /**
+ * Sets the target tilt angle
+ *
+ * @param angle the target angle to set, as a value between -90 and 90
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetTiltAngle(int angle) throws Exception;
+
+ /**
+ * Subscribes to changes in the target tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the target tilt angle */
+ void unsubscribeTargetTiltAngle();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetVerticalTilting.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetVerticalTilting.java
new file mode 100644
index 000000000..e87607204
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTargetVerticalTilting.java
@@ -0,0 +1,34 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with target vertical tilting characteristic. */
+public interface AccessoryWithTargetVerticalTilting {
+
+ /**
+ * Retrieves the target vertical tilt angle
+ *
+ * @return a future that will contain the target position as a value between -90 and 90
+ */
+ CompletableFuture getTargetVerticalTiltAngle();
+
+ /**
+ * Sets the target position
+ *
+ * @param angle the target angle to set, as a value between -90 and 90
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTargetVerticalTiltAngle(int angle) throws Exception;
+
+ /**
+ * Subscribes to changes in the target vertical tilt angle.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeTargetVerticalTiltAngle(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the target vertical tilt angle */
+ void unsubscribeTargetVerticalTiltAngle();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTemperatureDisplayUnits.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTemperatureDisplayUnits.java
new file mode 100644
index 000000000..b9407b34b
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithTemperatureDisplayUnits.java
@@ -0,0 +1,39 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.thermostat.TemperatureDisplayUnitEnum;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with characteristic that describes units of temperature used for presentation purposes
+ * (e.g. the units of temperature displayed on the screen).
+ */
+public interface AccessoryWithTemperatureDisplayUnits {
+
+ /**
+ * Retrieves temperature display units
+ *
+ * @return a future that will contain temperature display units
+ */
+ CompletableFuture getTemperatureDisplayUnits();
+
+ /**
+ * Sets the temperature display units
+ *
+ * @param units the target temperature display units
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setTemperatureDisplayUnits(TemperatureDisplayUnitEnum units)
+ throws Exception;
+
+ /**
+ * Subscribes to changes in the temperature display units
+ *
+ * @param callback the function to call when temperature display units changes.
+ */
+ void subscribeTemperatureDisplayUnits(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the temperature display units */
+ void unsubscribeTemperatureDisplayUnits();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithVOCDensity.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithVOCDensity.java
new file mode 100644
index 000000000..b41cc43b7
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithVOCDensity.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with VOC Density characteristic. */
+public interface AccessoryWithVOCDensity {
+
+ /**
+ * Retrieves the VOC density.
+ *
+ * @return a future with the VOC density
+ */
+ CompletableFuture