-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first version of the LightControllerAPI
- Loading branch information
0 parents
commit 7fc0c1f
Showing
74 changed files
with
3,278 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name-template: 'v$NEXT_PATCH_VERSION' | ||
tag-template: 'v$NEXT_PATCH_VERSION' | ||
categories: | ||
- title: 'Features' | ||
labels: | ||
- 'enhancement' | ||
- title: 'Fixes' | ||
labels: | ||
- 'bug' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
template: | | ||
## Changes | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Release Drafter 🪧 | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
update_release_draft: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Ignore IntelliJ related stuff | ||
.idea | ||
*.iml | ||
/out | ||
/docs | ||
|
||
# Gradle related stuff | ||
.gradle | ||
/build/ | ||
*/build/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<a href="https://playlegend.net"><img src="assets/light-api.png" width="100%"></a> | ||
|
||
[![LightController](https://jitpack.io/v/IBims1ckoky/LightControllerAPI.svg)](https://jitpack.io/#IBims1ckoky/LightControllerAPI) | ||
[![MissingFeature](https://img.shields.io/badge/Missing%20Feature-Open%20an%20Issue-blueviolet?style=flat-square&logo=appveyor)](https://github.com/IBims1ckoky/LightControllerAPI/issues) | ||
|
||
# LightControllerAPI | ||
|
||
This is an easy to use **LightControllerAPI** in for Java to control Lights from [PhillipsHue](https://www.philips-hue.com/). | ||
|
||
|
||
# How to get started | ||
|
||
Gradle (Default): | ||
```gradle | ||
repositories { | ||
maven { url 'https://jitpack.io' } | ||
} | ||
dependencies { | ||
implementation 'com.github.IBims1ckoky:LightControllerAPI:master-SNAPSHOT' | ||
} | ||
``` | ||
|
||
Maven: | ||
```maven | ||
<repositories> | ||
<repository> | ||
<id>jitpack.io</id> | ||
<url>https://jitpack.io</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.IBims1ckoky</groupId> | ||
<artifactId>LightControllerAPI</artifactId> | ||
<version>master-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
``` | ||
|
||
## Visit the Wiki! | ||
|
||
### How to get started | ||
* [Hardware Requirements](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Hardware-Requirements) | ||
* [Maven & Gradle](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Maven-&-Gradle) | ||
* [Important Information](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Important-Information) | ||
### BridgeAPI | ||
* [BridgeIP](https://github.com/IBims1ckoky/LightControllerAPI/wiki/BridgeIP) | ||
* [Username & Clientkey](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Username-&-Clientkey) | ||
* [Bridge Informations](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Bridge-Informations) | ||
* [Bridge Scanner](https://github.com/IBims1ckoky/LightControllerAPI/wiki/BridgeScanner-(Credentials)) | ||
### LampAPI | ||
* [Get All Lamps](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Get-All-Lamps) | ||
* [Lamp by Name](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Lamp-by-Name) | ||
* [Lamp Brightness](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Lamp-Brightness) | ||
* [Turn Lamps On & Off](https://github.com/IBims1ckoky/LightControllerAPI/wiki/Turn-Lamps-On-&-Off) | ||
* [Other Updates]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
group = "de.maxizink" | ||
version = "1.0-SNAPSHOT" | ||
|
||
description = "LightController-api" | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
dependencies { | ||
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.1") | ||
implementation("io.reactivex.rxjava3:rxjava:3.1.3") | ||
implementation("com.google.code.gson:gson:2.8.9") | ||
implementation("org.apache.httpcomponents:httpclient:4.5.13") | ||
|
||
api ("ch.qos.logback:logback-core:1.2.10") | ||
api ("ch.qos.logback:logback-classic:1.2.6") | ||
} |
5 changes: 5 additions & 0 deletions
5
api/src/main/java/de/maxizink/lightcontroller/body/HueRequestBody.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package de.maxizink.lightcontroller.body; | ||
|
||
public interface HueRequestBody { | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
api/src/main/java/de/maxizink/lightcontroller/discovery/ResourceType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package de.maxizink.lightcontroller.discovery; | ||
|
||
public enum ResourceType { | ||
|
||
DEVICE, | ||
BRIDGE_HOME, | ||
ROOM, | ||
ZONE, | ||
LIGHT, | ||
BUTTON, | ||
TEMPERATURE, | ||
LIGHT_LEVEL, | ||
MOTION, | ||
ENTERTAINMENT, | ||
GROUPED_LIGHT, | ||
DEVICE_POWER, | ||
ZIGBEE_BRIDGE_CONNECTIVITY, | ||
ZIGBEE_CONNECTIVITY, | ||
ZGP_CONNECTIVITY, | ||
BRIDGE, | ||
HOMEKIT, | ||
SCENE, | ||
ENTERTAINMENT_CONFIGURATION, | ||
PUBLIC_IMAGE, | ||
AUTH_V1, | ||
BEHAVIOR_SCRIPT, | ||
BEHAVIOR_INSTANCE, | ||
GEOFENCE, | ||
GEOFENCE_CLIENT, | ||
GEOLOCATION; | ||
|
||
public static ResourceType getResourceType(final String name) { | ||
return ResourceType.valueOf(name.toUpperCase()); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...ain/java/de/maxizink/lightcontroller/discovery/bridge/api/BridgeCredentialsDiscovery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.api; | ||
|
||
import de.maxizink.lightcontroller.discovery.bridge.response.HueBridgeCredentialsResponse; | ||
import de.maxizink.lightcontroller.injection.Service; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface BridgeCredentialsDiscovery extends Service { | ||
|
||
HueBridgeCredentialsResponse generateHueBridgeCredentials(final String bridgeIp); | ||
|
||
CompletableFuture<HueBridgeCredentialsResponse> generateHueBridgeCredentialsAsync(final String bridgeIp); | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
api/src/main/java/de/maxizink/lightcontroller/discovery/bridge/api/BridgeIpDiscovery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.api; | ||
|
||
import de.maxizink.lightcontroller.discovery.bridge.exception.HueBridgeIpDiscoveryException; | ||
import de.maxizink.lightcontroller.injection.Service; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface BridgeIpDiscovery extends Service { | ||
|
||
String discoverBridgeIP() throws HueBridgeIpDiscoveryException; | ||
|
||
List<String> discoverAllBridgeIPs() throws HueBridgeIpDiscoveryException; | ||
|
||
CompletableFuture<String> discoveryBridgeIPAsync(); | ||
|
||
CompletableFuture<List<String>> discoverAllBridgeIPsAsync(); | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
api/src/main/java/de/maxizink/lightcontroller/discovery/bridge/api/HueBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.api; | ||
|
||
import de.maxizink.lightcontroller.discovery.bridge.models.BridgeInfo; | ||
import de.maxizink.lightcontroller.discovery.bridge.models.HueBridgeCredentials; | ||
import de.maxizink.lightcontroller.discovery.lamp.api.HueLamp; | ||
import de.maxizink.lightcontroller.discovery.room.api.HueRoom; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
public interface HueBridge { | ||
|
||
//Lamps | ||
List<HueLamp> getLamps(); | ||
|
||
Optional<HueLamp> getLampById(final UUID uniqueId); | ||
|
||
Optional<HueLamp> getLampByName(final String name); | ||
|
||
//Rooms | ||
List<HueRoom> getRooms(); | ||
|
||
Optional<HueRoom> getHueRoomById(final UUID uniqueId); | ||
|
||
Optional<HueRoom> getHueRoomByName(final String name); | ||
|
||
//Information | ||
BridgeInfo getBridgeInfo(); | ||
|
||
HueBridgeCredentials getHueBridgeCredentials(); | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
api/src/main/java/de/maxizink/lightcontroller/discovery/bridge/api/HueBridgeDiscovery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.api; | ||
|
||
import de.maxizink.lightcontroller.discovery.bridge.models.HueBridgeCredentials; | ||
import de.maxizink.lightcontroller.injection.Service; | ||
|
||
public interface HueBridgeDiscovery extends Service { | ||
|
||
HueBridge discoverHueBridge(final HueBridgeCredentials hueBridgeCredentials); | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...rc/main/java/de/maxizink/lightcontroller/discovery/bridge/body/GenerateHueBridgeBody.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.body; | ||
|
||
import de.maxizink.lightcontroller.body.HueRequestBody; | ||
import lombok.AllArgsConstructor; | ||
import lombok.NoArgsConstructor; | ||
|
||
@AllArgsConstructor(staticName = "of") | ||
@NoArgsConstructor | ||
public class GenerateHueBridgeBody implements HueRequestBody { | ||
|
||
private String devicetype; | ||
private boolean generateclientkey; | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...nk/lightcontroller/discovery/bridge/exception/HueBridgeInformationDiscoveryException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.exception; | ||
|
||
public class HueBridgeInformationDiscoveryException extends RuntimeException{ | ||
|
||
public HueBridgeInformationDiscoveryException(final String message) { | ||
super(message); | ||
} | ||
|
||
public HueBridgeInformationDiscoveryException(final String message, final Throwable throwable) { | ||
super(message, throwable); | ||
} | ||
|
||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...de/maxizink/lightcontroller/discovery/bridge/exception/HueBridgeIpDiscoveryException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.exception; | ||
|
||
public class HueBridgeIpDiscoveryException extends RuntimeException { | ||
|
||
public HueBridgeIpDiscoveryException(final String message) { | ||
super(message); | ||
} | ||
|
||
public HueBridgeIpDiscoveryException(final String message, final Throwable throwable) { | ||
super(message, throwable); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
api/src/main/java/de/maxizink/lightcontroller/discovery/bridge/models/BridgeInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.models; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class BridgeInfo { | ||
|
||
private String name; | ||
private String datastoreversion; | ||
private String swversion; | ||
private String apiversion; | ||
private String mac; | ||
private String bridgeid; | ||
private boolean factorynew; | ||
private @Nullable String replacesbridgeid; | ||
private String modelid; | ||
private String startkitid; | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...c/main/java/de/maxizink/lightcontroller/discovery/bridge/models/HueBridgeCredentials.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package de.maxizink.lightcontroller.discovery.bridge.models; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class HueBridgeCredentials { | ||
|
||
private final String userName; | ||
private final String clientKey; | ||
|
||
private String ipAddress; | ||
|
||
} |
Oops, something went wrong.