Frans-Willem / AqaraHub

AqaraHub is an open-source Zigbee hub for Xiaomi Aqara devices. It aims to be a replacement to the Xiaomi Gateway that does not require communication to outside servers, and uses a saner communication option (e.g. MQTT).
252 stars 34 forks source link

Report attributes values as JSON #3

Closed Frans-Willem closed 6 years ago

Frans-Willem commented 6 years ago

Reporting of attributes should be available as untyped, e.g.:

123
true
"Hello world"
[123,true,"Hello world"]

As well as typed, e.g.:

{"type":"uint8", "value": 123}
{"type":"bool", "value": true}
{"type":"octstr", "value":"Hello world"}
{"type":"struct", "value": [{"type":"uint8","value":123},{"type":"bool", "value":true},{"type":"octstr","value":"Hello world"}]}

(In the future, writing of attributes should be supported as typed. Untyped is more difficult, as we won't know what Zigbee type the attribute should be.)

Frans-Willem commented 6 years ago

Untyped is not yet posted to MQTT, but I'm not convinced it should be. to_json code supports it in case it's needed later.

mclei-asw commented 6 years ago

I would like to have untyped values in MQTT as I am interfacing it with other systems and parsing JSON is a big unnecessary overhead there, for example in Arduino.

Or have it configurable.