Skip to content

Commit a0e0bda

Browse files
Add support for FilterMaintenanceAccessory
[#124](#124)
1 parent 10a9f43 commit a0e0bda

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/main/java/io/github/hapjava/accessories/optionalcharacteristic/AccessoryWithResetFilterIndication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ public interface AccessoryWithResetFilterIndication {
99
* Request to reset the filter level
1010
*
1111
* @param indication always 1, by HomeKit protocol. (to be ignored)
12+
* @return a future that completes when the change is made
13+
* @throws Exception when the change cannot be made
1214
*/
1315
CompletableFuture<Void> resetFilterIndication(Integer indication) throws Exception;
1416
}

src/main/java/io/github/hapjava/characteristics/impl/base/IntegerCharacteristic.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ protected CompletableFuture<JsonObjectBuilder> makeBuilder(int iid) {
7272

7373
@Override
7474
protected CompletableFuture<Integer> getValue() {
75-
if (getter.isPresent()) {
76-
return getter.map(integerGetter -> integerGetter.get()).get();
77-
} else {
78-
return null;
79-
}
75+
return getter.map(integerGetter -> integerGetter.get()).orElse(null);
8076
}
8177

8278
@Override

0 commit comments

Comments
 (0)