File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
src/main/java/com/beowulfe/hap Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ public abstract class BaseCharacteristic<T> implements Characteristic {
2222 private final Logger logger = LoggerFactory .getLogger (BaseCharacteristic .class );
2323
2424 private final String type ;
25+ private final String shortType ;
2526 private final String format ;
2627 private final boolean isWritable ;
2728 private final boolean isReadable ;
@@ -46,6 +47,7 @@ public BaseCharacteristic(
4647 }
4748
4849 this .type = type ;
50+ this .shortType = this .type .replaceAll ("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$" , "$1" );
4951 this .format = format ;
5052 this .isWritable = isWritable ;
5153 this .isReadable = isReadable ;
@@ -94,11 +96,10 @@ protected CompletableFuture<JsonObjectBuilder> makeBuilder(int instanceId) {
9496 JsonObjectBuilder builder =
9597 Json .createObjectBuilder ()
9698 .add ("iid" , instanceId )
97- .add ("type" , type )
99+ .add ("type" , shortType )
98100 .add ("perms" , perms .build ())
99101 .add ("format" , format )
100- .add ("events" , false )
101- .add ("bonjour" , false )
102+ .add ("ev" , false )
102103 .add ("description" , description );
103104 setJsonValue (builder , value );
104105 return builder ;
Original file line number Diff line number Diff line change @@ -65,8 +65,10 @@ public HttpResponse listing() throws Exception {
6565 }
6666
6767 private CompletableFuture <JsonObject > toJson (Service service , int interfaceId ) throws Exception {
68+ String shortType =
69+ service .getType ().replaceAll ("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$" , "$1" );
6870 JsonObjectBuilder builder =
69- Json .createObjectBuilder ().add ("iid" , ++interfaceId ).add ("type" , service . getType () );
71+ Json .createObjectBuilder ().add ("iid" , ++interfaceId ).add ("type" , shortType );
7072 List <Characteristic > characteristics = service .getCharacteristics ();
7173 Collection <CompletableFuture <JsonObject >> characteristicFutures =
7274 new ArrayList <>(characteristics .size ());
You can’t perform that action at this time.
0 commit comments