Dirigera Client API: Java written client API to interface IKEA's new smarthome hub DIRIGERA
Unofficial client API for IKEA's new Smarthome Hub DIRIGERA. The client API uses DIRIGERA's REST interface at port 8443. The vast majority of interfaces have been implemented. However, most are barely tested, and some are known as inoperable.
Device Type | API | Home-Assistant Integration | Tested Devices |
---|---|---|---|
Gateway | ✓ | X |
|
Repeater | ✓ | X |
|
Light | ✓ | ✓ |
|
Outlet | ✓ | ✓ |
|
Air Purifier | ? | X |
|
Blinds | ✓ | ? |
|
Light-Controller | ✓ | X |
|
Blinds-Controller | ✓ | X |
|
Sound-Controller | ? | X |
|
Shortcut-Controller | ✓ | X |
|
Motion-Sensor | ✓ | X |
|
Speaker | ? | X |
|
Legend: ✓ fully functional ? implemented but not tested X not implemented
The package dirigera-client-examples
provides several example
applications, which essentially cover the aforementioned points.
However, to give you a glimpse of the look and feel of the library,
here's an example:
@SpringBootApplication
@ComponentScan(basePackageClasses = {DirigeraClientApi.class})
public class MyApplication {
@Bean
public CommandLineRunner run(final DirigeraApi api) {
return (String... args) -> {
api.device.light.all() // fetch all light devices from hub
.flatMapMany(Flux::fromIterable)
.flatMap(d -> api.device.light.turnOn(d)) // turn on lights
.flatMap(d -> api.device.light.setLevel(d, 100)) // set light level to 100%
.flatMap(d -> api.device.light.setTemperature(d, d.attributes.state.color.temperatureMax)) // set color temperature
.blockLast();
};
}
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args).close();
}
}
The API cannot catch any button presses from controllers or status changes from motion detectors to process them programmatically. However, both device types may be paired with actuators (e.g., lights or outlets) that will process the inputs directly (see example LinkDevices). As a workaround, controllers can be used to some extent as triggers for scenes whose status change can be intercepted as an event from the WebSocket stream SceneTriggers).
Prerequisites:
JAVA_HOME
to your environment variables with the following path <PATH_TO_UNPACKED_ZIP_FILE>
%JAVA_HOME%\bin
to your path variablejava -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
java -jar dirigera-client-dump.jar
If the autodiscovery fails and no DIRIGERA is found in your Network, you may pass the DIRIGERA's connection details
by the parameters --dirigera.hostname=<ip address of DIRIGERA Gateway>
and
--dirigera.port=8443
.Lights and sockets can be integrated into Home Assistant via MQTT (more devices will follow). Home Assistant will create entities for supported devices, based on its MQTT auto discovery approach.
Add https://github.com/TheMrBooyah/hassio-repository
to your home assistant.
Update the configuration to your setup.
In order to get your 'Token', run the Dump Application. This will ask you to pair your gateway. After successfully pairing the gateway a file 'dirigera_access_token' will be created. Open the file with your favourite text editor and copy everything into the 'Token' field.
Start the addon, watch the logs for any errors and if everything went as expected, home assistant should have some new devices/entities from your IKEA Smart Hub.