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/FilterMaintenanceAccessory.java b/src/main/java/io/github/hapjava/accessories/FilterMaintenanceAccessory.java
new file mode 100644
index 000000000..2ebee5495
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/FilterMaintenanceAccessory.java
@@ -0,0 +1,40 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.filtermaintenance.FilterChangeIndicationEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.FilterMaintenanceService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * A Filter maintenance with mandatory characteristics.
+ *
+ * The HomeKit app doesn't support a separate FilterMaintenance, but as a linked service to
+ * AirPurifier.
+ */
+public interface FilterMaintenanceAccessory extends HomekitAccessory {
+
+ /**
+ * The filter change indictaion. It's either yes or no.
+ *
+ * @return FilterChangeIndicationEnum
+ */
+ CompletableFuture getFilterChangeIndication();
+
+ /**
+ * Subscribes to changes in the filter change indication.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeFilterChangeIndication(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the filter change indication. */
+ void unsubscribeFilterChangeIndication();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new FilterMaintenanceService(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..d72af203a
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/HeaterCoolerAccessory.java
@@ -0,0 +1,121 @@
+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();
+
+ /**
+ * Valid values for current state.
+ *
+ * @return array of valid current states
+ */
+ default CurrentHeaterCoolerStateEnum[] getCurrentHeaterCoolerStateValidValues() {
+ return CurrentHeaterCoolerStateEnum.values();
+ }
+
+ /**
+ * Valid values for target state.
+ *
+ * @return array of valid target states
+ */
+ default TargetHeaterCoolerStateEnum[] getTargetHeaterCoolerStateValidValues() {
+ return TargetHeaterCoolerStateEnum.values();
+ }
+
+ @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 55%
rename from src/main/java/io/github/hapjava/HomekitAccessory.java
rename to src/main/java/io/github/hapjava/accessories/HomekitAccessory.java
index beb08eac3..64c406492 100644
--- a/src/main/java/io/github/hapjava/HomekitAccessory.java
+++ b/src/main/java/io/github/hapjava/accessories/HomekitAccessory.java
@@ -1,9 +1,14 @@
-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.Iterator;
+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 +26,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 +43,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 +77,23 @@ 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 service
+ *
+ * @return primary service
+ */
+ default Service getPrimaryService() {
+ Iterator iterator = getServices().iterator();
+ while (iterator.hasNext()) {
+ Service service = iterator.next();
+ if (!(service instanceof AccessoryInformationService)) {
+ return service;
+ }
+ }
+ return null;
+ };
}
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..63a460526
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/HumidifierDehumidifierAccessory.java
@@ -0,0 +1,114 @@
+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);
+
+ /**
+ * Valid values for target state.
+ *
+ * @return array of valid target states.
+ */
+ default TargetHumidifierDehumidifierStateEnum[]
+ getTargetHumidifierDehumidifierStateValidValues() {
+ return TargetHumidifierDehumidifierStateEnum.values();
+ }
+
+ /**
+ * 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/InputSourceAccessory.java b/src/main/java/io/github/hapjava/accessories/InputSourceAccessory.java
new file mode 100644
index 000000000..cfa5ae3d6
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/InputSourceAccessory.java
@@ -0,0 +1,104 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.IsConfiguredEnum;
+import io.github.hapjava.characteristics.impl.inputsource.CurrentVisibilityStateEnum;
+import io.github.hapjava.characteristics.impl.inputsource.InputSourceTypeEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.InputSourceService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Input Source accessory. */
+public interface InputSourceAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves configured name of input source.
+ *
+ * @return configured name of input source
+ */
+ CompletableFuture getConfiguredName();
+
+ /**
+ * Sets the configured name.
+ *
+ * @param name configured name
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setConfiguredName(String name) throws Exception;
+
+ /**
+ * Subscribes to changes in configured name.
+ *
+ * @param callback the function to call when the configured name changes.
+ */
+ void subscribeConfiguredName(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the configured name. */
+ void unsubscribeConfiguredName();
+
+ /**
+ * Retrieves the flag whether input source is configured.
+ *
+ * @return a future that will contain the flag .
+ */
+ CompletableFuture isConfigured();
+ /**
+ * set the flag whether input source is configured.
+ *
+ * @param state is configured state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setIsConfigured(IsConfiguredEnum state);
+
+ /**
+ * Subscribes to changes in isConfigured.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeIsConfigured(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in isConfigured. */
+ void unsubscribeIsConfigured();
+
+ /**
+ * Retrieves the input source type.
+ *
+ * @return a future that will contain the input source type.
+ */
+ CompletableFuture getInputSourceType();
+
+ /**
+ * Subscribes to changes in input source type.
+ *
+ * @param callback the function to call when the type changes.
+ */
+ void subscribeInputSourceType(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the input source type. */
+ void unsubscribeInputSourceType();
+
+ /**
+ * Retrieves the current visibility state.
+ *
+ * @return a future that will contain the current visibility state.
+ */
+ CompletableFuture getCurrentVisibilityState();
+
+ /**
+ * Subscribes to changes in current visibility state.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentVisibilityState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current visibility state. */
+ void unsubscribeCurrentVisibilityState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new InputSourceService(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/LightSensor.java
deleted file mode 100644
index 12b2e05d3..000000000
--- a/src/main/java/io/github/hapjava/accessories/LightSensor.java
+++ /dev/null
@@ -1,39 +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.impl.services.LightSensorService;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.CompletableFuture;
-
-/**
- * A light sensor that reports current ambient light level.
- *
- * @author Gaston Dombiak
- */
-public interface LightSensor extends HomekitAccessory {
-
- /**
- * Retrieves the current ambient light level.
- *
- * @return a future that will contain the luminance level expressed in LUX.
- */
- CompletableFuture getCurrentAmbientLightLevel();
-
- @Override
- default Collection getServices() {
- return Collections.singleton(new LightSensorService(this));
- }
-
- /**
- * Subscribes to changes in the current ambient light level.
- *
- * @param callback the function to call when the state changes.
- */
- void subscribeCurrentAmbientLightLevel(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the current ambient light level. */
- void unsubscribeCurrentAmbientLightLevel();
-}
diff --git a/src/main/java/io/github/hapjava/accessories/LightSensorAccessory.java b/src/main/java/io/github/hapjava/accessories/LightSensorAccessory.java
new file mode 100644
index 000000000..2087b1e99
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/LightSensorAccessory.java
@@ -0,0 +1,69 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.lightsensor.CurrentAmbientLightLevelCharacteristic;
+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;
+
+/**
+ * A light sensor that reports current ambient light level.
+ *
+ * @author Gaston Dombiak
+ */
+public interface LightSensorAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the current ambient light level.
+ *
+ * @return a future that will contain the luminance level expressed in LUX.
+ */
+ CompletableFuture getCurrentAmbientLightLevel();
+
+ /**
+ * Subscribes to changes in the current ambient light level.
+ *
+ * @param callback the function to call when the state changes.
+ */
+ void subscribeCurrentAmbientLightLevel(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current ambient light level. */
+ void unsubscribeCurrentAmbientLightLevel();
+
+ /**
+ * return the min value for current ambient light level. overwrite if you want to change the
+ * default value.
+ *
+ * @return min current ambient light level
+ */
+ default double getMinCurrentAmbientLightLevel() {
+ return CurrentAmbientLightLevelCharacteristic.DEFAULT_MIN_VALUE;
+ }
+
+ /**
+ * return the max value for current ambient light level. overwrite if you want to change the
+ * default value.
+ *
+ * @return max current ambient light level
+ */
+ default double getMaxCurrentAmbientLightLevel() {
+ return CurrentAmbientLightLevelCharacteristic.DEFAULT_MAX_VALUE;
+ }
+
+ /**
+ * return the min step value for current ambient light level. overwrite if you want to change the
+ * default value.
+ *
+ * @return min step current ambient light level
+ */
+ default double getMinStepCurrentAmbientLightLevel() {
+ return CurrentAmbientLightLevelCharacteristic.DEFAULT_STEP;
+ }
+
+ @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 60%
rename from src/main/java/io/github/hapjava/accessories/SecuritySystem.java
rename to src/main/java/io/github/hapjava/accessories/SecuritySystemAccessory.java
index fcf1d1f6f..43c12acd2 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.
@@ -67,21 +65,22 @@ public interface SecuritySystem extends HomekitAccessory {
void unsubscribeTargetSecuritySystemState();
/**
- * Retrieves the alarm type of the security system.
+ * Valid values for current state.
*
- * @return alarm type of the security system.
+ * @return array of valid current states.
*/
- CompletableFuture getAlarmTypeState();
+ default CurrentSecuritySystemStateEnum[] getCurrentSecuritySystemStateValidValues() {
+ return CurrentSecuritySystemStateEnum.values();
+ }
/**
- * Subscribes to changes to the alarm type of the security system.
+ * Valid values for target state.
*
- * @param callback the function to call when the alarm type changes.
+ * @return array of valid targe states.
*/
- void subscribeAlarmTypeState(HomekitCharacteristicChangeCallback callback);
-
- /** Unsubscribes from changes in the alarm type of the security system. */
- void unsubscribeAlarmTypeState();
+ default TargetSecuritySystemStateEnum[] getTargetSecuritySystemStateValidValues() {
+ return TargetSecuritySystemStateEnum.values();
+ }
@Override
default Collection getServices() {
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/SmartSpeakerAccessory.java b/src/main/java/io/github/hapjava/accessories/SmartSpeakerAccessory.java
new file mode 100644
index 000000000..9f70af2be
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/SmartSpeakerAccessory.java
@@ -0,0 +1,62 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.television.CurrentMediaStateEnum;
+import io.github.hapjava.characteristics.impl.television.TargetMediaStateEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.SmartSpeakerService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Smart Speaker accessory. */
+public interface SmartSpeakerAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the current media state (see {@link
+ * io.github.hapjava.characteristics.impl.television.CurrentMediaStateEnum} for supported values).
+ *
+ * @return a future that will contain the current media state
+ */
+ CompletableFuture getCurrentMediaState();
+
+ /**
+ * Subscribes to changes in the current media state.
+ *
+ * @param callback the function to call when the current media state changes.
+ */
+ void subscribeCurrentMediaState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current media state. */
+ void unsubscribeCurrentMediaState();
+
+ /**
+ * Retrieves the target media state (see {@link TargetMediaStateEnum} for supported values).
+ *
+ * @return a future that will contain the target media state
+ */
+ CompletableFuture getTargetMediaState();
+
+ /**
+ * Set the target media state (see {@link TargetMediaStateEnum} for supported values).
+ *
+ * @param targetMediaState target media state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setTargetMediaState(TargetMediaStateEnum targetMediaState);
+
+ /**
+ * Subscribes to changes in the target media state.
+ *
+ * @param callback the function to call when the target media state changes.
+ */
+ void subscribeTargetMediaState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the target media state. */
+ void unsubscribeTargetMediaState();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new SmartSpeakerService(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/TelevisionAccessory.java b/src/main/java/io/github/hapjava/accessories/TelevisionAccessory.java
new file mode 100644
index 000000000..b51efe319
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/TelevisionAccessory.java
@@ -0,0 +1,123 @@
+package io.github.hapjava.accessories;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.television.RemoteKeyEnum;
+import io.github.hapjava.characteristics.impl.television.SleepDiscoveryModeEnum;
+import io.github.hapjava.services.Service;
+import io.github.hapjava.services.impl.TelevisionService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Television accessory. */
+public interface TelevisionAccessory extends HomekitAccessory {
+
+ /**
+ * Retrieves the current active state of the TV.
+ *
+ * @return a future that will contain the state
+ */
+ CompletableFuture isActive();
+
+ /**
+ * Sets the active state of the TV
+ *
+ * @param state the 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 TV .
+ *
+ * @param callback the function to call when the active state changes.
+ */
+ void subscribeActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the active state of the TV. */
+ void unsubscribeActive();
+
+ /**
+ * Retrieves the active identifier
+ *
+ * @return a future that will contain the active identifier.
+ */
+ CompletableFuture getActiveIdentifier();
+
+ /**
+ * Sets the active identifier
+ *
+ * @param identifier the active identifier
+ * @return a future that completes when the active identifier is changed
+ * @throws Exception when the active identifier cannot be set
+ */
+ CompletableFuture setActiveIdentifier(Integer identifier) throws Exception;
+
+ /**
+ * Subscribes to changes in the active identifier.
+ *
+ * @param callback the function to call when the active identifier changes.
+ */
+ void subscribeActiveIdentifier(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the active identifier. */
+ void unsubscribeActiveIdentifier();
+
+ /**
+ * Retrieves configured name.
+ *
+ * @return configured name
+ */
+ CompletableFuture getConfiguredName();
+
+ /**
+ * Sets the configured name
+ *
+ * @param name configured name
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setConfiguredName(String name) throws Exception;
+
+ /**
+ * Subscribes to changes in configured name.
+ *
+ * @param callback the function to call when the configureed name changes.
+ */
+ void subscribeConfiguredName(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the configured name state. */
+ void unsubscribeConfiguredName();
+
+ /**
+ * Sends the remote key.
+ *
+ * @param key remote key
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setRemoteKey(RemoteKeyEnum key) throws Exception;
+
+ /**
+ * Retrieves the sleep discovery mode.
+ *
+ * @return a future that will contain the sleep discovery mode .
+ */
+ CompletableFuture getSleepDiscoveryMode();
+
+ /**
+ * Subscribes to changes in sleep discovery mode.
+ *
+ * @param callback the function to call when the sleep discovery mode changes.
+ */
+ void subscribeSleepDiscoveryMode(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the sleep discovery mode. */
+ void unsubscribeSleepDiscoveryMode();
+
+ @Override
+ default Collection getServices() {
+ return Collections.singleton(new TelevisionService(this));
+ }
+}
diff --git a/src/main/java/io/github/hapjava/accessories/TelevisionSpeakerAccessory.java b/src/main/java/io/github/hapjava/accessories/TelevisionSpeakerAccessory.java
new file mode 100644
index 000000000..28df1437d
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/TelevisionSpeakerAccessory.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.TelevisionSpeakerService;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+
+/** Television speaker accessory. */
+public interface TelevisionSpeakerAccessory 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 TelevisionSpeakerService(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..837993853
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/ThermostatAccessory.java
@@ -0,0 +1,214 @@
+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();
+
+ /**
+ * Valid values for current state.
+ *
+ * @return array of valid current states.
+ */
+ default CurrentHeatingCoolingStateEnum[] getCurrentHeatingCoolingStateValidValues() {
+ return CurrentHeatingCoolingStateEnum.values();
+ }
+
+ /**
+ * Valid values for target state.
+ *
+ * @return array of valid targe states.
+ */
+ default TargetHeatingCoolingStateEnum[] getTargetHeatingCoolingStateValidValues() {
+ return TargetHeatingCoolingStateEnum.values();
+ }
+
+ @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/optionalcharacteristic/AccessoryWithActive.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithActive.java
new file mode 100644
index 000000000..4ad11be63
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithActive.java
@@ -0,0 +1,38 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.common.ActiveEnum;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with active characteristic {@link
+ * io.github.hapjava.characteristics.impl.common.ActiveCharacteristic}.
+ */
+public interface AccessoryWithActive {
+
+ /**
+ * Retrieves the active state (see {@link
+ * io.github.hapjava.characteristics.impl.common.ActiveEnum} for supported values).
+ *
+ * @return a future that will contain the active state
+ */
+ CompletableFuture getActive();
+
+ /**
+ * Set the active state (see {@link ActiveEnum} for supported values).
+ *
+ * @param active active state
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setActive(ActiveEnum active);
+
+ /**
+ * Subscribes to changes in the active state.
+ *
+ * @param callback the function to call when the active state changes.
+ */
+ void subscribeActive(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the active state. */
+ void unsubscribeActive();
+}
diff --git a/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithAirPlayEnable.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithAirPlayEnable.java
new file mode 100644
index 000000000..76b90b43f
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithAirPlayEnable.java
@@ -0,0 +1,37 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with AirPlay enable characteristic {@link
+ * io.github.hapjava.characteristics.impl.common.AirPlayEnableCharacteristic}.
+ */
+public interface AccessoryWithAirPlayEnable {
+
+ /**
+ * Retrieves the AirPlay enable state
+ *
+ * @return a future that will contain the AirPlay enable state.
+ */
+ CompletableFuture getAirPlayEnable();
+
+ /**
+ * Sets the AirPlay enable state
+ *
+ * @param state AirPlay enable state
+ * @return a future that completes when the AirPlay enable is changed
+ * @throws Exception when the AirPlay enable cannot be set
+ */
+ CompletableFuture setAirPlayEnable(Integer state) throws Exception;
+
+ /**
+ * Subscribes to changes in the AirPlay enable state.
+ *
+ * @param callback the function to call when the AirPlay enable state changes.
+ */
+ void subscribeAirPlayEnable(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the AirPlay enable state. */
+ void unsubscribeAirPlayEnable();
+}
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..bd143b22f
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonDioxideLevel.java
@@ -0,0 +1,104 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.carbondioxidesensor.CarbonDioxideLevelCharacteristic;
+import io.github.hapjava.characteristics.impl.carbondioxidesensor.CarbonDioxidePeakLevelCharacteristic;
+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();
+
+ /**
+ * return the min value for carbon dioxide level. overwrite if you want to change the default
+ * value.
+ *
+ * @return min carbon dioxide level
+ */
+ default double getMinCarbonDioxideLevel() {
+ return CarbonDioxideLevelCharacteristic.DEFAULT_MIN_VALUE;
+ }
+
+ /**
+ * return the max value for carbon dioxide level. overwrite if you want to change the default
+ * value.
+ *
+ * @return max carbon dioxide level
+ */
+ default double getMaxCarbonDioxideLevel() {
+ return CarbonDioxideLevelCharacteristic.DEFAULT_MAX_VALUE;
+ }
+
+ /**
+ * return the min step value for carbon dioxide level. overwrite if you want to change the default
+ * value.
+ *
+ * @return min step carbon dioxide level
+ */
+ default double getMinStepCarbonDioxideLevel() {
+ return CarbonDioxideLevelCharacteristic.DEFAULT_STEP;
+ }
+
+ /**
+ * return the min value for carbon dioxide peak level. overwrite if you want to change the default
+ * value.
+ *
+ * @return min carbon dioxide peak level
+ */
+ default double getMinCarbonDioxidePeakLevel() {
+ return CarbonDioxidePeakLevelCharacteristic.DEFAULT_MIN_VALUE;
+ }
+
+ /**
+ * return the max value for carbon dioxide peak level. overwrite if you want to change the default
+ * value.
+ *
+ * @return max carbon dioxide peak level
+ */
+ default double getMaxCarbonDioxidePeakLevel() {
+ return CarbonDioxidePeakLevelCharacteristic.DEFAULT_MAX_VALUE;
+ }
+
+ /**
+ * return the min step value for carbon dioxide peak level. overwrite if you want to change the
+ * default value.
+ *
+ * @return min step carbon dioxide peak level
+ */
+ default double getMinStepCarbonDioxidePeakLevel() {
+ return CarbonDioxidePeakLevelCharacteristic.DEFAULT_STEP;
+ }
+
+ /**
+ * 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..cbccd9647
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCarbonMonoxideLevel.java
@@ -0,0 +1,104 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.carbonmonoxidesensor.CarbonMonoxideLevelCharacteristic;
+import io.github.hapjava.characteristics.impl.carbonmonoxidesensor.CarbonMonoxidePeakLevelCharacteristic;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with carbon monoxide 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();
+
+ /**
+ * return the min value for carbon monoxide level. overwrite if you want to change the default
+ * value.
+ *
+ * @return min carbon monoxide level
+ */
+ default double getMinCarbonMonoxideLevel() {
+ return CarbonMonoxideLevelCharacteristic.DEFAULT_MIN_VALUE;
+ }
+
+ /**
+ * return the max value for carbon monoxide level. overwrite if you want to change the default
+ * value.
+ *
+ * @return max carbon monoxide level
+ */
+ default double getMaxCarbonMonoxideLevel() {
+ return CarbonMonoxideLevelCharacteristic.DEFAULT_MAX_VALUE;
+ }
+
+ /**
+ * return the min step value for carbon monoxide level. overwrite if you want to change the
+ * default value.
+ *
+ * @return min step carbon monoxide level
+ */
+ default double getMinStepCarbonMonoxideLevel() {
+ return CarbonMonoxideLevelCharacteristic.DEFAULT_STEP;
+ }
+
+ /**
+ * return the min value for carbon monoxide peak level. overwrite if you want to change the
+ * default value.
+ *
+ * @return min carbon monoxide peak level
+ */
+ default double getMinCarbonMonoxidePeakLevel() {
+ return CarbonMonoxidePeakLevelCharacteristic.DEFAULT_MIN_VALUE;
+ }
+
+ /**
+ * return the max value for carbon monoxide peak level. overwrite if you want to change the
+ * default value.
+ *
+ * @return max carbon monoxide peak level
+ */
+ default double getMaxCarbonMonoxidePeakLevel() {
+ return CarbonMonoxidePeakLevelCharacteristic.DEFAULT_MAX_VALUE;
+ }
+
+ /**
+ * return the min step value for carbon monoxide peak level. overwrite if you want to change the
+ * default value.
+ *
+ * @return min step carbon monoxide peak level
+ */
+ default double getMinStepCarbonMonoxidePeakLevel() {
+ return CarbonMonoxidePeakLevelCharacteristic.DEFAULT_STEP;
+ }
+
+ /**
+ * 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/optionalcharacteristic/AccessoryWithClosedCaptions.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithClosedCaptions.java
new file mode 100644
index 000000000..c13da3289
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithClosedCaptions.java
@@ -0,0 +1,37 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.television.ClosedCaptionsEnum;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with closed captions characteristic {@link
+ * io.github.hapjava.characteristics.impl.television.ClosedCaptionsCharacteristic}.
+ */
+public interface AccessoryWithClosedCaptions {
+
+ /**
+ * Retrieves the closed captions state (see {@link ClosedCaptionsEnum} for supported values).
+ *
+ * @return a future that will contain the closed captions
+ */
+ CompletableFuture getClosedCaptions();
+
+ /**
+ * Set the closed captions state (see {@link ClosedCaptionsEnum} for supported values).
+ *
+ * @param closedCaptions closed captions
+ * @return a future that completes when the change is made
+ */
+ CompletableFuture setClosedCaptions(ClosedCaptionsEnum closedCaptions);
+
+ /**
+ * Subscribes to changes in the closed captions.
+ *
+ * @param callback the function to call when the closed captions changes.
+ */
+ void subscribeClosedCaptions(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the closed captions. */
+ void unsubscribeClosedCaptions();
+}
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..ecf74ba63
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithColorTemperature.java
@@ -0,0 +1,53 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.lightbulb.ColorTemperatureCharacteristic;
+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;
+
+ /**
+ * return the min value for color temperature. overwrite if you want to change the default value.
+ *
+ * @return min color temperature
+ */
+ default int getMinColorTemperature() {
+ return ColorTemperatureCharacteristic.DEFAULT_MIN_VALUE;
+ }
+
+ /**
+ * return the max value for color temperature. overwrite if you want to change the default value.
+ *
+ * @return max color temperature
+ */
+ default int getMaxColorTemperature() {
+ return ColorTemperatureCharacteristic.DEFAULT_MAX_VALUE;
+ }
+
+ /**
+ * 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/AccessoryWithConfiguredName.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithConfiguredName.java
new file mode 100644
index 000000000..0c9528130
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithConfiguredName.java
@@ -0,0 +1,34 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with configured name. */
+public interface AccessoryWithConfiguredName {
+
+ /**
+ * Retrieves configured name.
+ *
+ * @return configured name
+ */
+ CompletableFuture getConfiguredName();
+
+ /**
+ * Sets the configured name
+ *
+ * @param name configured name
+ * @return a future that completes when the change is made
+ * @throws Exception when the change cannot be made
+ */
+ CompletableFuture setConfiguredName(String name) throws Exception;
+
+ /**
+ * Subscribes to changes in configured name.
+ *
+ * @param callback the function to call when the configureed name changes.
+ */
+ void subscribeConfiguredName(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the configured name state. */
+ void unsubscribeConfiguredName();
+}
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/AccessoryWithCurrentMediaState.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentMediaState.java
new file mode 100644
index 000000000..22350d9b4
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithCurrentMediaState.java
@@ -0,0 +1,30 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.television.CurrentMediaStateEnum;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with current media state characteristic {@link
+ * io.github.hapjava.characteristics.impl.television.CurrentMediaStateCharacteristic}.
+ */
+public interface AccessoryWithCurrentMediaState {
+
+ /**
+ * Retrieves the current media state (see {@link
+ * io.github.hapjava.characteristics.impl.television.CurrentMediaStateEnum} for supported values).
+ *
+ * @return a future that will contain the current media state
+ */
+ CompletableFuture getCurrentMediaState();
+
+ /**
+ * Subscribes to changes in the current media state.
+ *
+ * @param callback the function to call when the current media state changes.
+ */
+ void subscribeCurrentMediaState(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current media state. */
+ void unsubscribeCurrentMediaState();
+}
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..a5cebf97c
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithDuration.java
@@ -0,0 +1,52 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import io.github.hapjava.characteristics.impl.valve.SetDurationCharacteristic;
+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();
+
+ /**
+ * return the min value for duration. overwrite if you want to change the default value.
+ *
+ * @return min remaining duration
+ */
+ default int getMinDuration() {
+ return SetDurationCharacteristic.DEFAULT_MIN_VALUE;
+ }
+
+ /**
+ * return the max value for duration. overwrite if you want to change the default value.
+ *
+ * @return max duration
+ */
+ default int getMaxDuration() {
+ return SetDurationCharacteristic.DEFAULT_MAX_VALUE;
+ }
+
+ /**
+ * 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/AccessoryWithFilterLifeLevel.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithFilterLifeLevel.java
new file mode 100644
index 000000000..2b94d4ec9
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithFilterLifeLevel.java
@@ -0,0 +1,25 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import io.github.hapjava.characteristics.HomekitCharacteristicChangeCallback;
+import java.util.concurrent.CompletableFuture;
+
+/** Accessory with filter level characteristics */
+public interface AccessoryWithFilterLifeLevel {
+
+ /**
+ * what's the filter life level, percentage wise
+ *
+ * @return filter life level
+ */
+ CompletableFuture getFilterLifeLevel();
+
+ /**
+ * Subscribes to changes in the filter life level.
+ *
+ * @param callback the function to call when the level changes.
+ */
+ void subscribeFilterLifeLevel(HomekitCharacteristicChangeCallback callback);
+
+ /** Unsubscribes from changes in the current filter life level. */
+ void unsubscribeFilterLifeLevel();
+}
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/AccessoryWithIdentifier.java b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithIdentifier.java
new file mode 100644
index 000000000..b181d4d99
--- /dev/null
+++ b/src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithIdentifier.java
@@ -0,0 +1,17 @@
+package io.github.hapjava.accessories.optionalcharacteristic;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Accessory with identifier characteristic {@link
+ * io.github.hapjava.characteristics.impl.common.IdentifierCharacteristic}.
+ */
+public interface AccessoryWithIdentifier {
+
+ /**
+ * Retrieves the identifier of service.
+ *
+ * @return a future with the identifier
+ */
+ CompletableFuture