diff --git a/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java b/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java index a4ba443b1..46cdf7dc2 100644 --- a/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java +++ b/src/main/java/com/beowulfe/hap/characteristics/BaseCharacteristic.java @@ -22,6 +22,7 @@ public abstract class BaseCharacteristic implements Characteristic { private final Logger logger = LoggerFactory.getLogger(BaseCharacteristic.class); private final String type; + private final String shortType; private final String format; private final boolean isWritable; private final boolean isReadable; @@ -46,6 +47,7 @@ public BaseCharacteristic( } this.type = type; + this.shortType = this.type.replaceAll("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$", "$1"); this.format = format; this.isWritable = isWritable; this.isReadable = isReadable; @@ -94,11 +96,10 @@ protected CompletableFuture makeBuilder(int instanceId) { JsonObjectBuilder builder = Json.createObjectBuilder() .add("iid", instanceId) - .add("type", type) + .add("type", shortType) .add("perms", perms.build()) .add("format", format) - .add("events", false) - .add("bonjour", false) + .add("ev", false) .add("description", description); setJsonValue(builder, value); return builder; diff --git a/src/main/java/com/beowulfe/hap/impl/json/AccessoryController.java b/src/main/java/com/beowulfe/hap/impl/json/AccessoryController.java index 67304e615..b45e1f6ca 100644 --- a/src/main/java/com/beowulfe/hap/impl/json/AccessoryController.java +++ b/src/main/java/com/beowulfe/hap/impl/json/AccessoryController.java @@ -65,8 +65,10 @@ public HttpResponse listing() throws Exception { } private CompletableFuture toJson(Service service, int interfaceId) throws Exception { + String shortType = + service.getType().replaceAll("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$", "$1"); JsonObjectBuilder builder = - Json.createObjectBuilder().add("iid", ++interfaceId).add("type", service.getType()); + Json.createObjectBuilder().add("iid", ++interfaceId).add("type", shortType); List characteristics = service.getCharacteristics(); Collection> characteristicFutures = new ArrayList<>(characteristics.size());