Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BT] Avoid duplicates decoded messages with multiple servicedata #1727

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

1technophile
Copy link
Owner

Description:

Some BLE devices like the LYWSDCGQ send several servicedata per BLE packets, before this PR we generated 2 MQTT messages:

{"id":"","mac_type":0,"adv_type":0,"name":"MJ_HT_V1","rssi":-86,"brand":"Xiaomi","model":"Mi Jia round","model_id":"LYWSDCGQ","type":"THB","tempc":25.7,"tempf":78.26,"servicedata":"f19de672f819","servicedatauuid":"0xffff"}
{"id":"","mac_type":0,"adv_type":0,"name":"MJ_HT_V1","rssi":-86,"servicedata":"5020aa01511122334455660410020101","servicedatauuid":"0xfe95","brand":"Xiaomi","model":"Mi Jia round","model_id":"LYWSDCGQ","type":"THB","tempc":25.7,"tempf":78.26}

With this modification, the second message will not duplicate the decoded information from the first one:

{"id":"","mac_type":0,"adv_type":0,"name":"MJ_HT_V1","rssi":-96,"servicedata":"5020aa01ac1122334455660a10010f","servicedatauuid":"0xfe95","brand":"Xiaomi","model":"Mi Jia round","model_id":"LYWSDCGQ","type":"THB","batt":15}
{"id":"","mac_type":0,"adv_type":0,"name":"MJ_HT_V1","rssi":-96,"servicedata":"f19de672f819","servicedatauuid":"0xffff"}

This will avoid the controller to record 2 data entries with the same timestamp and will provide a better readability of undecoded messages

Checklist:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

@1technophile 1technophile changed the title [BT] Avoid duplicates messages [BT] Avoid duplicates decoded messages with multiple servicedata Aug 7, 2023
@1technophile 1technophile merged commit 1f2f8dc into development Aug 7, 2023
142 checks passed
@1technophile 1technophile deleted the fix-duplicates branch August 7, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant