Package io.github.hapjava.accessories
Interface ValveAccessory
-
- All Superinterfaces:
HomekitAccessory
public interface ValveAccessory extends HomekitAccessory
A Valve (sprinkler head, faucet, etc.)- Author:
- Tim Harper
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.Collection<Service>
getServices()
The collection of Services this accessory supports.java.util.concurrent.CompletableFuture<ActiveEnum>
getValveActive()
Retrieves the current active state of the valve; Active could mean the valve is open (but not necessarily running), or that the valve is associated with an active watering program (like a watering program) but is not currently running.java.util.concurrent.CompletableFuture<InUseEnum>
getValveInUse()
Retrieves the current inUse state of the valve; InUse usually means water is flowing through the valve.java.util.concurrent.CompletableFuture<ValveTypeEnum>
getValveType()
Retrieves the valve type.java.util.concurrent.CompletableFuture<java.lang.Void>
setValveActive(ActiveEnum active)
Sets the valve active statevoid
subscribeValveActive(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the active state of the valve.void
subscribeValveInUse(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the inUse state of the valve.void
subscribeValveType(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the valveType state of the valve.void
unsubscribeValveActive()
Unsubscribes from changes in the valve active state.void
unsubscribeValveInUse()
Unsubscribes from changes in the valve inUse state.void
unsubscribeValveType()
Unsubscribes from changes in the valveType state.-
Methods inherited from interface io.github.hapjava.accessories.HomekitAccessory
getFirmwareRevision, getId, getManufacturer, getModel, getName, getPrimaryService, getSerialNumber, identify
-
-
-
-
Method Detail
-
getValveActive
java.util.concurrent.CompletableFuture<ActiveEnum> getValveActive()
Retrieves the current active state of the valve; Active could mean the valve is open (but not necessarily running), or that the valve is associated with an active watering program (like a watering program) but is not currently running.To communicate water is flowing through a valve, inUse should be used.
- Returns:
- a future that will contain the binary state
-
setValveActive
java.util.concurrent.CompletableFuture<java.lang.Void> setValveActive(ActiveEnum active) throws java.lang.Exception
Sets the valve active state- Parameters:
active
- 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
-
subscribeValveActive
void subscribeValveActive(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the active state of the valve.- Parameters:
callback
- the function to call when the state changes.
-
unsubscribeValveActive
void unsubscribeValveActive()
Unsubscribes from changes in the valve active state.
-
getValveInUse
java.util.concurrent.CompletableFuture<InUseEnum> getValveInUse()
Retrieves the current inUse state of the valve; InUse usually means water is flowing through the valve.To communicate water is flowing through a valve, inUse should be used.
- Returns:
- a future that will contain the binary state
-
subscribeValveInUse
void subscribeValveInUse(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the inUse state of the valve.- Parameters:
callback
- the function to call when the state changes.
-
unsubscribeValveInUse
void unsubscribeValveInUse()
Unsubscribes from changes in the valve inUse state.
-
getValveType
java.util.concurrent.CompletableFuture<ValveTypeEnum> getValveType()
Retrieves the valve type.- Returns:
- a future that will contain the valve type.
-
subscribeValveType
void subscribeValveType(HomekitCharacteristicChangeCallback callback)
Subscribes to changes in the valveType state of the valve.- Parameters:
callback
- the function to call when the state changes.
-
unsubscribeValveType
void unsubscribeValveType()
Unsubscribes from changes in the valveType state.
-
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.
-
-