Skip to content
forked from dfrommi/rehaktor

Wrapper around HAP-Java for easy integration into Kotlin and Project Reactor

Notifications You must be signed in to change notification settings

XhosaS/rehaktor

 
 

Repository files navigation

Rehaktor

This library is a wrapper around the excellent HAP-Java to simplify the integration in projects using Kotlin and Project Reactor.

Usage

Accessories are built from a list of services, each service having a fixed list of possible characteristics.

A few sample scripts are available

To run the sample scripts, just make sure that a recent version of the Kotlin compiler is available, then just execute them as a script. Shortly afterwards, the bridge will show up in the home up and can be added using the PIN printed in the console.

Gradle

To add the library to a gradle build, you need to...

  1. add the Jitpack-repo:
    maven("https://jitpack.io")
    
  2. add dependency
    dependencies {
      implementation("io.github.dfrommi:rehaktor:master-SNAPSHOT")
    } 
    

Services and Characteristics

Characteristics and services are generated from Apple's definition file shipped with HAS (Homekit Accessory Simulator) plus a hand-crafted definition for TV accessory. This approach was heavily inspired by HAP-NodeJS.

The list of all services is here and characteristics here.

Design Principles

The goal of this project is to simplify the usage of HAP-Java in projects using Kotlin and Project Reactor. To achieve this, it has the following underlying design principles:

  • Optional characteristics are expressed by optional nullable constructor parameters rather than parameters of type Optional
  • Flux is used as event stream for value changes, as opposed to CompletableFuture
  • Lambdas are used to trigger actions from Homekit. They subscribe automatically if they resolve to Mono

On top of that, a few simple wrapper classes are available to define new accessories in a fluent way without the need to implement interfaces.

About

Wrapper around HAP-Java for easy integration into Kotlin and Project Reactor

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 100.0%