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

Recursive publishing #50

Closed andrei-trybukhouski closed 5 years ago

andrei-trybukhouski commented 5 years ago

with --recursive-publish option hub also sends full json string. but my mqtt client module independently parses the json payloads, and there is duplication. since client does it badly, I want the hub to do it, but did not send full json. is it possible?

Frans-Willem commented 5 years ago

I'm not quite sure what you mean. Could you add some examples ?

andrei-trybukhouski commented 5 years ago

I use the majordomo controller. his own mqtt client parses json. and if i started aqarahub with --recursive-publish option, both aqarahub and majordomo parses json and they outputs doubles.

AqaraHub[6747]: <INFO> [PublishValue] Publishing to 'AqaraHub/00158D00029B1A2A/1/in/Basic/Report Attributes/0xFF01/value/1': {"type":"uint16","value":3300}
AqaraHub[6747]: <INFO> [PublishValue] Publishing to 'AqaraHub/00158D00029B1A2A/1/in/Basic/Report Attributes/0xFF01/value/1/type': "uint16"
AqaraHub[6747]: <INFO> [PublishValue] Publishing to 'AqaraHub/00158D00029B1A2A/1/in/Basic/Report Attributes/0xFF01/value/1/value': 3300

i want without first line

AqaraHub[6747]: <INFO> [PublishValue] Publishing to 'AqaraHub/00158D00029B1A2A/1/in/Basic/Report Attributes/0xFF01/value/1/type': "uint16"
AqaraHub[6747]: <INFO> [PublishValue] Publishing to 'AqaraHub/00158D00029B1A2A/1/in/Basic/Report Attributes/0xFF01/value/1/value': 3300

because the first line (in the code above) is parsed by the majordomo module and they are doubled.

Frans-Willem commented 5 years ago

Currently it's not possible to prevent the first part to be sent by AqaraHub, but if you turn off --recursive-publish it will only send the first message, and your majordomo controller can unpack it and publish the other two messages ?

andrei-trybukhouski commented 5 years ago

Yes, but the fact is that majordomo sometimes parses such long lines incorrectly. and thanks for the replies