Skip to content

Commit 0e58ccc

Browse files
author
Eugen Freiter
committed
fix the names of the garage door characteristics
1 parent d2b2f4f commit 0e58ccc

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Diff for: src/main/java/io/github/hapjava/impl/characteristics/garage/CurrentDoorStateCharacteristic.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.github.hapjava.HomekitCharacteristicChangeCallback;
44
import io.github.hapjava.accessories.GarageDoor;
5-
import io.github.hapjava.accessories.properties.DoorState;
65
import io.github.hapjava.characteristics.EnumCharacteristic;
76
import io.github.hapjava.characteristics.EventableCharacteristic;
87
import java.util.concurrent.CompletableFuture;
@@ -13,27 +12,27 @@ public class CurrentDoorStateCharacteristic extends EnumCharacteristic
1312
private final GarageDoor door;
1413

1514
public CurrentDoorStateCharacteristic(GarageDoor door) {
16-
super("00000032-0000-1000-8000-0026BB765291", true, true, "Target Door State", 1);
15+
super("0000000E-0000-1000-8000-0026BB765291", false, true, "Current Door State", 4);
1716
this.door = door;
1817
}
1918

2019
@Override
2120
protected void setValue(Integer value) throws Exception {
22-
door.setTargetDoorState(DoorState.fromCode(value));
21+
// Read Only
2322
}
2423

2524
@Override
2625
protected CompletableFuture<Integer> getValue() {
27-
return door.getTargetDoorState().thenApply(s -> s.getCode());
26+
return door.getCurrentDoorState().thenApply(s -> s.getCode());
2827
}
2928

3029
@Override
3130
public void subscribe(HomekitCharacteristicChangeCallback callback) {
32-
door.subscribeTargetDoorState(callback);
31+
door.subscribeCurrentDoorState(callback);
3332
}
3433

3534
@Override
3635
public void unsubscribe() {
37-
door.unsubscribeTargetDoorState();
36+
door.unsubscribeCurrentDoorState();
3837
}
3938
}

Diff for: src/main/java/io/github/hapjava/impl/characteristics/garage/TargetDoorStateCharacteristic.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.github.hapjava.HomekitCharacteristicChangeCallback;
44
import io.github.hapjava.accessories.GarageDoor;
5+
import io.github.hapjava.accessories.properties.DoorState;
56
import io.github.hapjava.characteristics.EnumCharacteristic;
67
import io.github.hapjava.characteristics.EventableCharacteristic;
78
import java.util.concurrent.CompletableFuture;
@@ -12,27 +13,27 @@ public class TargetDoorStateCharacteristic extends EnumCharacteristic
1213
private final GarageDoor door;
1314

1415
public TargetDoorStateCharacteristic(GarageDoor door) {
15-
super("0000000E-0000-1000-8000-0026BB765291", false, true, "Current Door State", 4);
16+
super("00000032-0000-1000-8000-0026BB765291", true, true, "Target Door State", 1);
1617
this.door = door;
1718
}
1819

1920
@Override
2021
protected void setValue(Integer value) throws Exception {
21-
// Read Only
22+
door.setTargetDoorState(DoorState.fromCode(value));
2223
}
2324

2425
@Override
2526
protected CompletableFuture<Integer> getValue() {
26-
return door.getCurrentDoorState().thenApply(s -> s.getCode());
27+
return door.getTargetDoorState().thenApply(s -> s.getCode());
2728
}
2829

2930
@Override
3031
public void subscribe(HomekitCharacteristicChangeCallback callback) {
31-
door.subscribeCurrentDoorState(callback);
32+
door.subscribeTargetDoorState(callback);
3233
}
3334

3435
@Override
3536
public void unsubscribe() {
36-
door.unsubscribeCurrentDoorState();
37+
door.unsubscribeTargetDoorState();
3738
}
3839
}

0 commit comments

Comments
 (0)