hap-java / HAP-Java

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

BasicThermostat #26

Closed nathanjskelton closed 7 years ago

nathanjskelton commented 7 years ago

Currently running 1.1.4 snapshot... if I register an implementation of BasicThermostat with the bridge, I am unable to add the bridge to Homekit... and if I add the BasicThermostat to a bridge that is already paired, the devices seem to loose the ability to communicate with the bridge until I remove it and re-pair it.

I am using most of the other accessory types... no issues. 61 accessories in all with no other problems.

andylintner commented 7 years ago

Try using HomekitRoot.allowUnauthenticatexRequests and then get the http result for /accessories

You might spot the problem in the JSON output. Otherwise, include the result here and I can take a look.

nathanjskelton commented 7 years ago

I've looked at the JSON-- it's valid JSON and I'm not seeing what may be the issue. This is the segment that represents the Thermostat device. When this device is present in the /accessories, it seems to irreparably corrupt any devices that try to refresh their list for some reason, causing me to have to remove the bridge and re-add all the devices. Any insight appreciated... thanks:

{ "services": [ { "characteristics": [ { "maxLen": 255, "iid": 2, "type": "00000023-0000-1000-8000-0026BB765291", "perms": [ "pr" ], "format": "string", "events": false, "bonjour": false, "description": "Name of the accessory", "value": "Thermostat" }, { "maxLen": 255, "iid": 3, "type": "00000020-0000-1000-8000-0026BB765291", "perms": [ "pr" ], "format": "string", "events": false, "bonjour": false, "description": "The name of the manufacturer", "value": "none" }, { "maxLen": 255, "iid": 4, "type": "00000021-0000-1000-8000-0026BB765291", "perms": [ "pr" ], "format": "string", "events": false, "bonjour": false, "description": "The name of the model", "value": "none" }, { "maxLen": 255, "iid": 5, "type": "00000030-0000-1000-8000-0026BB765291", "perms": [ "pr" ], "format": "string", "events": false, "bonjour": false, "description": "The serial number of the accessory", "value": "none" }, { "description": "Identifies the accessory via a physical action on the accessory", "bonjour": false, "events": false, "format": "bool", "perms": [ "pw" ], "type": "00000014-0000-1000-8000-0026BB765291", "iid": 6 } ], "type": "0000003E-0000-1000-8000-0026BB765291", "iid": 1 }, { "characteristics": [ { "maxLen": 255, "iid": 8, "type": "00000023-0000-1000-8000-0026BB765291", "perms": [ "pr" ], "format": "string", "events": false, "bonjour": false, "description": "Name of the accessory", "value": "Thermostat" }, { "minStep": 1, "maxValue": 3, "minValue": 0, "iid": 9, "type": "0000000F-0000-1000-8000-0026BB765291", "perms": [ "pr", "ev" ], "format": "int", "events": false, "bonjour": false, "description": "Current Mode", "value": 1 }, { "unit": "celsius", "minStep": 0.1, "maxValue": 90, "minValue": 45, "iid": 10, "type": "00000011-0000-1000-8000-0026BB765291", "perms": [ "pr", "ev" ], "format": "float", "events": false, "bonjour": false, "description": "Current Temperature", "value": 0 }, { "minStep": 1, "maxValue": 3, "minValue": 0, "iid": 11, "type": "00000033-0000-1000-8000-0026BB765291", "perms": [ "pw", "pr", "ev" ], "format": "int", "events": false, "bonjour": false, "description": "Target Mode", "value": 1 }, { "unit": "celsius", "minStep": 0.1, "maxValue": 90, "minValue": 45, "iid": 12, "type": "00000035-0000-1000-8000-0026BB765291", "perms": [ "pw", "pr", "ev" ], "format": "float", "events": false, "bonjour": false, "description": "Target Temperature", "value": 0 }, { "minStep": 1, "maxValue": 1, "minValue": 0, "iid": 13, "type": "00000036-0000-1000-8000-0026BB765291", "perms": [ "pr" ], "format": "int", "events": false, "bonjour": false, "description": "The temperature unit", "value": 0 } ], "type": "0000004A-0000-1000-8000-0026BB765291", "iid": 7 } ], "aid": 56 }

andylintner commented 7 years ago

The Current Temperature field defines a minimum temperature of 45, but a value of 0.

iOS ends up being pretty sensitive about stuff like that. Arguably, the library should catch that for you - it doesn't now.

(Also, the temperature should be expressed in Celsius degrees - 45 would be a very high minimum)

nathanjskelton commented 7 years ago

That was it-- also, thanks for pointing out that degrees needed to be in Celsius. Thanks for the help, much appreciated.