
io.github.hapjava.accessories.LeakSensorAccessory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hap Show documentation
Show all versions of hap Show documentation
Homekit Accessory Protocol for Java
package io.github.hapjava.accessories;
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;
/**
* A leak sensor that reports whether a leak has been detected.
*
* @author Tim Harper
*/
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();
/**
* Subscribes to changes in the leak sensor.
*
* @param callback the function to call when the state changes.
*/
void subscribeLeakDetected(HomekitCharacteristicChangeCallback callback);
/** Unsubscribes from changes in the leak sensor. */
void unsubscribeLeakDetected();
@Override
default Collection getServices() {
return Collections.singleton(new LeakSensorService(this));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy