Package io.github.hapjava.accessories
Interface BatteryAccessory
- 
- All Superinterfaces:
- HomekitAccessory
 
 public interface BatteryAccessory extends HomekitAccessory Devices with battery .- Author:
- Gaston Dombiak
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Integer>getBatteryLevel()Retrieves the battery level of the accessory.java.util.concurrent.CompletableFuture<ChargingStateEnum>getChargingState()Retriece the battery charging state.java.util.concurrent.CompletableFuture<StatusLowBatteryEnum>getLowBatteryState()Queries if the device battery level is low; returning a value of true will cause a low-battery status to appear in Home for the device.default java.util.Collection<Service>getServices()The collection of Services this accessory supports.voidsubscribeBatteryChargingState(HomekitCharacteristicChangeCallback callback)Subscribes to changes in the battery level.voidsubscribeBatteryLevel(HomekitCharacteristicChangeCallback callback)Subscribes to changes in the battery level.voidsubscribeLowBatteryState(HomekitCharacteristicChangeCallback callback)Subscribes to changes in the battery level.voidunsubscribeBatteryChargingState()Unsubscribes from changes in the low battery state.voidunsubscribeBatteryLevel()Unsubscribes from changes in the battery level.voidunsubscribeLowBatteryState()Unsubscribes from changes in the low battery state.- 
Methods inherited from interface io.github.hapjava.accessories.HomekitAccessorygetFirmwareRevision, getId, getManufacturer, getModel, getName, getPrimaryService, getSerialNumber, identify
 
- 
 
- 
- 
- 
Method Detail- 
getBatteryLeveljava.util.concurrent.CompletableFuture<java.lang.Integer> getBatteryLevel() Retrieves the battery level of the accessory.- Returns:
- a future that will contain the accessory's battery state
 
 - 
getLowBatteryStatejava.util.concurrent.CompletableFuture<StatusLowBatteryEnum> getLowBatteryState() Queries if the device battery level is low; returning a value of true will cause a low-battery status to appear in Home for the device.- Returns:
- a future that will contain the accessory's low battery state
 
 - 
getChargingStatejava.util.concurrent.CompletableFuture<ChargingStateEnum> getChargingState() Retriece the battery charging state.- Returns:
- a future that will contain the battery charging state
 
 - 
subscribeBatteryLevelvoid subscribeBatteryLevel(HomekitCharacteristicChangeCallback callback) Subscribes to changes in the battery level.- Parameters:
- callback- the function to call when battery level changes.
 
 - 
subscribeLowBatteryStatevoid subscribeLowBatteryState(HomekitCharacteristicChangeCallback callback) Subscribes to changes in the battery level.- Parameters:
- callback- the function to call when low battery state changes.
 
 - 
subscribeBatteryChargingStatevoid subscribeBatteryChargingState(HomekitCharacteristicChangeCallback callback) Subscribes to changes in the battery level.- Parameters:
- callback- the function to call when low battery state changes.
 
 - 
unsubscribeBatteryLevelvoid unsubscribeBatteryLevel() Unsubscribes from changes in the battery level.
 - 
unsubscribeLowBatteryStatevoid unsubscribeLowBatteryState() Unsubscribes from changes in the low battery state.
 - 
unsubscribeBatteryChargingStatevoid unsubscribeBatteryChargingState() Unsubscribes from changes in the low battery state.
 - 
getServicesdefault java.util.Collection<Service> getServices() Description copied from interface:HomekitAccessoryThe 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:
- getServicesin interface- HomekitAccessory
- Returns:
- the collection of services.
 
 
- 
 
-