snowdd1 / homebridge-knx

KNX platform shim for homebridge
https://github.com/nfarina/homebridge
GNU General Public License v2.0
97 stars 56 forks source link

Assumption of DPTs from HomeKit Types wrong #79

Closed snowdd1 closed 7 years ago

snowdd1 commented 7 years ago

(Finding in #77 )

HomeKit uses two separated fields for Format and Unit which are mixed up in homebridge-knx in characteristic.js Line ~ 234

Format Unit DPT
BOOL none DPT1
INT none DPT5
INT PERCENTAGE DPT5.001
FLOAT none DPT9
FLOAT PERCENTAGE DPT5.001
FLOAT else DPT9

other types to come, not yet supported.

Citations from https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/Characteristic.js :

62 Characteristic.Formats = { 
63   BOOL: 'bool', 
64   INT: 'int', 
65   FLOAT: 'float', 
66   STRING: 'string', 
67   ARRAY: 'array', // unconfirmed 
68   DICTIONARY: 'dictionary', // unconfirmed 
69   UINT8: 'uint8', 
70   UINT16: 'uint16', 
71   UINT32: 'uint32', 
72   UINT64: 'uint64', 
73   DATA: 'data', // unconfirmed 
74   TLV8: 'tlv8' 
75 } 
78 Characteristic.Units = { 
79   // HomeKit only defines Celsius, for Fahrenheit, it requires iOS app to do the conversion. 
80   CELSIUS: 'celsius', 
81   PERCENTAGE: 'percentage', 
82   ARC_DEGREE: 'arcdegrees', 
83   LUX: 'lux', 
84   SECONDS: 'seconds' 
85 }