Package io.github.hapjava.accessories
Interface OutletAccessory
-
- All Superinterfaces:
HomekitAccessory
public interface OutletAccessory extends HomekitAccessory
A power outlet with boolean power and usage states.- Author:
- Andy Lintner
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Boolean>
getOutletInUse()
Retrieves the current binary state indicating whether the outlet is in use.java.util.concurrent.CompletableFuture<java.lang.Boolean>
getPowerState()
Retrieves the current binary state of the outlet's power.default java.util.Collection<Service>
getServices()
The collection of Services this accessory supports.java.util.concurrent.CompletableFuture<java.lang.Void>
setPowerState(boolean state)
Sets the binary state of the outlet's power.void
subscribeOutletInUse(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the binary state indicating whether the outlet is in use.void
subscribePowerState(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the binary state of the outlet's power.void
unsubscribeOutletInUse()
Unsubscribes from changes in the binary state indicating whether hte outlet is in use.void
unsubscribePowerState()
Unsubscribes from changes in the binary state of the outlet's power.-
Methods inherited from interface io.github.hapjava.accessories.HomekitAccessory
getFirmwareRevision, getId, getManufacturer, getModel, getName, getPrimaryService, getSerialNumber, identify
-
-
-
-
Method Detail
-
getPowerState
java.util.concurrent.CompletableFuture<java.lang.Boolean> getPowerState()
Retrieves the current binary state of the outlet's power.- Returns:
- a future that will contain the binary state
-
getOutletInUse
java.util.concurrent.CompletableFuture<java.lang.Boolean> getOutletInUse()
Retrieves the current binary state indicating whether the outlet is in use.- Returns:
- a future that will contain the binary state
-
setPowerState
java.util.concurrent.CompletableFuture<java.lang.Void> setPowerState(boolean state) throws java.lang.Exception
Sets the binary state of the outlet's power.- Parameters:
state
- the binary state to set- Returns:
- a future that completes when the change is made
- Throws:
java.lang.Exception
- when the change cannot be made
-
subscribePowerState
void subscribePowerState(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the binary state of the outlet's power.- Parameters:
callback
- the function to call when the state changes.
-
subscribeOutletInUse
void subscribeOutletInUse(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the binary state indicating whether the outlet is in use.- Parameters:
callback
- the function to call when the state changes.
-
unsubscribePowerState
void unsubscribePowerState()
Unsubscribes from changes in the binary state of the outlet's power.
-
unsubscribeOutletInUse
void unsubscribeOutletInUse()
Unsubscribes from changes in the binary state indicating whether hte outlet is in use.
-
getServices
default java.util.Collection<Service> getServices()
Description copied from interface:HomekitAccessory
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 automatically include the required information service.This method will only be useful if you're implementing your own accessory type. For the standard accessories, use the default implementation provided by the interfaces in
io.github.hapjava.accessories
.- Specified by:
getServices
in interfaceHomekitAccessory
- Returns:
- the collection of services.
-
-