Skip to content

Commit 3f844c2

Browse files
author
Eugen
committed
Drop slat tilt angle characteristics from custom min/max
The Home app shows no control for the Slat service, so a custom range cannot be verified there.
1 parent a2a6bff commit 3f844c2

4 files changed

Lines changed: 5 additions & 42 deletions

File tree

‎CHANGES.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# HAP-Java 2.0.10
2-
* Add constructors with custom min/max to the tilt angle characteristics [#162](https://github.com/hap-java/HAP-Java/issues/162)
2+
* Add constructors with custom min/max to the window covering tilt angle characteristics [#162](https://github.com/hap-java/HAP-Java/issues/162)
33

44
# HAP-Java 2.0.9
55
* Fix Set Duration and Remaining Duration characteristics to advertise format `uint32` instead of `int` [#202](https://github.com/hap-java/HAP-Java/issues/202)

‎src/main/java/io/github/hapjava/characteristics/impl/slat/CurrentTiltAngleCharacteristic.java‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,20 @@
1111
/** This characteristic describe current tilt angle (between -90 and 90) */
1212
public class CurrentTiltAngleCharacteristic extends IntegerCharacteristic
1313
implements EventableCharacteristic {
14-
public static final int DEFAULT_MIN_VALUE = -90;
15-
public static final int DEFAULT_MAX_VALUE = 90;
1614

1715
public CurrentTiltAngleCharacteristic(
18-
int minValue,
19-
int maxValue,
2016
Supplier<CompletableFuture<Integer>> getter,
2117
Consumer<HomekitCharacteristicChangeCallback> subscriber,
2218
Runnable unsubscriber) {
2319
super(
2420
"000000C1-0000-1000-8000-0026BB765291",
2521
"current tilt angle",
26-
minValue,
27-
maxValue,
22+
-90,
23+
90,
2824
"arcdegrees",
2925
Optional.of(getter),
3026
Optional.empty(),
3127
Optional.of(subscriber),
3228
Optional.of(unsubscriber));
3329
}
34-
35-
public CurrentTiltAngleCharacteristic(
36-
Supplier<CompletableFuture<Integer>> getter,
37-
Consumer<HomekitCharacteristicChangeCallback> subscriber,
38-
Runnable unsubscriber) {
39-
this(DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, getter, subscriber, unsubscriber);
40-
}
4130
}

‎src/main/java/io/github/hapjava/characteristics/impl/slat/TargetTiltAngleCharacteristic.java‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,21 @@
1212
/** This characteristic describes the target angle of slats. */
1313
public class TargetTiltAngleCharacteristic extends IntegerCharacteristic
1414
implements EventableCharacteristic {
15-
public static final int DEFAULT_MIN_VALUE = -90;
16-
public static final int DEFAULT_MAX_VALUE = 90;
1715

1816
public TargetTiltAngleCharacteristic(
19-
int minValue,
20-
int maxValue,
2117
Supplier<CompletableFuture<Integer>> getter,
2218
ExceptionalConsumer<Integer> setter,
2319
Consumer<HomekitCharacteristicChangeCallback> subscriber,
2420
Runnable unsubscriber) {
2521
super(
2622
"000000C2-0000-1000-8000-0026BB765291",
2723
"target tilt angle",
28-
minValue,
29-
maxValue,
24+
-90,
25+
90,
3026
"arcdegrees",
3127
Optional.of(getter),
3228
Optional.of(setter),
3329
Optional.of(subscriber),
3430
Optional.of(unsubscriber));
3531
}
36-
37-
public TargetTiltAngleCharacteristic(
38-
Supplier<CompletableFuture<Integer>> getter,
39-
ExceptionalConsumer<Integer> setter,
40-
Consumer<HomekitCharacteristicChangeCallback> subscriber,
41-
Runnable unsubscriber) {
42-
this(DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE, getter, setter, subscriber, unsubscriber);
43-
}
4432
}

‎src/test/java/io/github/hapjava/characteristics/impl/CustomTiltAngleRangeTest.java‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import static org.assertj.core.api.Assertions.assertThat;
44

55
import io.github.hapjava.characteristics.Characteristic;
6-
import io.github.hapjava.characteristics.impl.slat.CurrentTiltAngleCharacteristic;
7-
import io.github.hapjava.characteristics.impl.slat.TargetTiltAngleCharacteristic;
86
import io.github.hapjava.characteristics.impl.windowcovering.CurrentHorizontalTiltAngleCharacteristic;
97
import io.github.hapjava.characteristics.impl.windowcovering.CurrentVerticalTiltAngleCharacteristic;
108
import io.github.hapjava.characteristics.impl.windowcovering.TargetHorizontalTiltAngleCharacteristic;
@@ -22,14 +20,6 @@ public void defaultConstructorsKeepTheirSerializedOutput() {
2220
// Serialized output captured before custom ranges were added.
2321
for (Case c :
2422
Arrays.asList(
25-
Case.of(
26-
new CurrentTiltAngleCharacteristic(
27-
() -> CompletableFuture.completedFuture(50), cb -> {}, () -> {}),
28-
"{\"iid\":7,\"type\":\"C1\",\"perms\":[\"pr\",\"ev\"],\"format\":\"int\",\"value\":50,\"minValue\":-90,\"maxValue\":90,\"minStep\":1,\"unit\":\"arcdegrees\"}"),
29-
Case.of(
30-
new TargetTiltAngleCharacteristic(
31-
() -> CompletableFuture.completedFuture(50), v -> {}, cb -> {}, () -> {}),
32-
"{\"iid\":7,\"type\":\"C2\",\"perms\":[\"pr\",\"pw\",\"ev\"],\"format\":\"int\",\"value\":50,\"minValue\":-90,\"maxValue\":90,\"minStep\":1,\"unit\":\"arcdegrees\"}"),
3323
Case.of(
3424
new CurrentHorizontalTiltAngleCharacteristic(
3525
() -> CompletableFuture.completedFuture(50), cb -> {}, () -> {}),
@@ -56,10 +46,6 @@ public void defaultConstructorsKeepTheirSerializedOutput() {
5646
public void customRangeIsAdvertised() {
5747
for (Characteristic c :
5848
Arrays.<Characteristic>asList(
59-
new CurrentTiltAngleCharacteristic(
60-
0, 90, () -> CompletableFuture.completedFuture(50), cb -> {}, () -> {}),
61-
new TargetTiltAngleCharacteristic(
62-
0, 90, () -> CompletableFuture.completedFuture(50), v -> {}, cb -> {}, () -> {}),
6349
new CurrentHorizontalTiltAngleCharacteristic(
6450
0, 90, () -> CompletableFuture.completedFuture(50), cb -> {}, () -> {}),
6551
new TargetHorizontalTiltAngleCharacteristic(

0 commit comments

Comments
 (0)