Skip to content

Commit 4e05b25

Browse files
committed
Allow null characteristics
Fix to allow null characteristic values - they appear to actually be supported by Homekit
1 parent 24bad71 commit 4e05b25

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected CompletableFuture<JsonObjectBuilder> makeBuilder(int instanceId) {
9090
.add("events", false)
9191
.add("bonjour", false)
9292
.add("description", description);
93-
setJsonValue(builder, value != null ? value : getDefault());
93+
setJsonValue(builder, value);
9494
return builder;
9595
});
9696
}

src/main/java/com/beowulfe/hap/characteristics/FloatCharacteristic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected Double convert(JsonValue jsonValue) {
6969
@Override
7070
protected final CompletableFuture<Double> getValue() {
7171
double rounder = 1 / this.minStep;
72-
return getDoubleValue().thenApply(d -> Math.round(d * rounder) / rounder);
72+
return getDoubleValue().thenApply(d -> d == null ? null : Math.round(d * rounder) / rounder);
7373
}
7474

7575
/**

0 commit comments

Comments
 (0)