Interface ContactSensorAccessory

  • All Superinterfaces:
    HomekitAccessory

    public interface ContactSensorAccessory
    extends HomekitAccessory
    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.
    Author:
    Gaston Dombiak
    • Method Detail

      • getCurrentState

        java.util.concurrent.CompletableFuture<ContactStateEnum> getCurrentState()
        Retrieves the state of the contact. This is whether the contact is detected or not. Detected contact means door/window is closed.
        Returns:
        a future that will contain the contact's state
      • subscribeContactState

        void subscribeContactState​(HomekitCharacteristicChangeCallback callback)
        Subscribes to changes in the contact state.
        Parameters:
        callback - the function to call when the state changes.
      • unsubscribeContactState

        void unsubscribeContactState()
        Unsubscribes from changes in the contact 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 interface HomekitAccessory
        Returns:
        the collection of services.