-
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.
- Loading branch information
1 parent
993e39e
commit 0654483
Showing
14 changed files
with
171 additions
and
25 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
37 changes: 37 additions & 0 deletions
37
src/main/java/ch/akop/homesystem/models/devices/sensor/AqaraCube.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,37 @@ | ||
package ch.akop.homesystem.models.devices.sensor; | ||
|
||
import ch.akop.homesystem.deconz.rest.State; | ||
import io.reactivex.rxjava3.subjects.PublishSubject; | ||
import io.reactivex.rxjava3.subjects.ReplaySubject; | ||
import io.reactivex.rxjava3.subjects.Subject; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
public class AqaraCube extends Sensor<AqaraCube> { | ||
|
||
@Getter | ||
private final Subject<Integer> activeSide$ = ReplaySubject.createWithSize(1); | ||
|
||
private final Subject<EMPTY> shacked$ = PublishSubject.create(); | ||
|
||
public enum EMPTY {INSTANCE} | ||
|
||
@Override | ||
public Sensor<AqaraCube> consumeUpdate(State update) { | ||
if (update.getButtonevent() != null) { | ||
if (update.getButtonevent() < 7000) { | ||
var firstNumber = update.getButtonevent() / 1000; | ||
activeSide$.onNext(firstNumber); | ||
} else if (update.getButtonevent() == 7007) { | ||
shacked$.onNext(EMPTY.INSTANCE); | ||
} | ||
} | ||
return this; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/ch/akop/homesystem/models/events/CubeEvent.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,9 @@ | ||
package ch.akop.homesystem.models.events; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class CubeEvent { | ||
private final String cubeName; | ||
private final CubeEventType eventType; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/ch/akop/homesystem/models/events/CubeEventType.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,11 @@ | ||
package ch.akop.homesystem.models.events; | ||
|
||
public enum CubeEventType { | ||
FLIPPED_TO_SIDE_1, | ||
FLIPPED_TO_SIDE_2, | ||
FLIPPED_TO_SIDE_3, | ||
FLIPPED_TO_SIDE_4, | ||
FLIPPED_TO_SIDE_5, | ||
FLIPPED_TO_SIDE_6, | ||
SHAKED | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/ch/akop/homesystem/persistence/model/config/CubeConfig.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,26 @@ | ||
package ch.akop.homesystem.persistence.model.config; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Entity | ||
@Table(name = "config_cube") | ||
@Getter | ||
@Setter | ||
public class CubeConfig { | ||
|
||
@Id | ||
private String name; | ||
|
||
private String sceneNameOnSide_1; | ||
private String sceneNameOnSide_2; | ||
private String sceneNameOnSide_3; | ||
private String sceneNameOnSide_4; | ||
private String sceneNameOnSide_5; | ||
private String sceneNameOnSide_6; | ||
private String sceneNameOnShake; | ||
|
||
} |
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
9 changes: 9 additions & 0 deletions
9
src/main/java/ch/akop/homesystem/persistence/repository/config/CubeConfigRepository.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,9 @@ | ||
package ch.akop.homesystem.persistence.repository.config; | ||
|
||
import ch.akop.homesystem.persistence.model.config.CubeConfig; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface CubeConfigRepository extends JpaRepository<CubeConfig, String> { | ||
} |
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 |
---|---|---|
|
@@ -21,4 +21,6 @@ public interface DeviceService { | |
|
||
boolean isAnyLightOn(); | ||
|
||
void activeSceneForAllGroups(String sceneName); | ||
|
||
} |
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
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
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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
application.yaml | ||
application.y*ml |
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