hap-java / HAP-Java

Java implementation of the HomeKit Accessory Protocol
MIT License
153 stars 82 forks source link

BooleanCharacteristic "convert" always false #3

Closed oberlon closed 8 years ago

oberlon commented 8 years ago

If I toggle a switch with my phone I always get false as return value (The lightbulb is now off). The method convert in BooleanCharacteristic gets "0" or "1" (org.glassfish.json.JsonNumberImpl$JsonIntNumber) as input but always returns false. Perhaps jsonValue.equals(JsonValue.TRUE); is not correct?

code:

@Override protected Boolean convert(JsonValue jsonValue) { System.out.println(jsonValue.getClass() + " -> " + jsonValue); boolean ret = jsonValue.equals(JsonValue.TRUE); System.out.println("return: " + ret); return ret; }

output:

class org.glassfish.json.JsonNumberImpl$JsonIntNumber -> 1 return: false The lightbulb is now off 17:49:26.645 [defaultEventExecutorGroup-4-1] INFO c.b.h.i.http.HomekitClientConnection - 204 /characteristics class org.glassfish.json.JsonNumberImpl$JsonIntNumber -> 0 return: false The lightbulb is now off

andylintner commented 8 years ago

What client are you using? The reference app on 8.2 is sending a json true/false.

oberlon commented 8 years ago

I am using Eve. https://www.elgato.com/en/eve/eve-app

andylintner commented 8 years ago

Not sure why Eve sends 0/1, but I confirmed it does.