Fix ble006 for the new converter format #1352
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@AlexxIT think you had a different interpertation of data of the knob event this device reports when you converts to the new format. I have rewrote it. Please see comments in the code for details.
Feel free to streamline the code or the event name if we can make it shorter without being hard to undersrtand.
This is my first time to update the converter so it took me a while to read the wiki and the MIOT spec to interpret the relationship. I think I got most of them, e.g. how to map mi id to the spec json structure, how to find the value for certain event after I pressed the button.
The only thing I could not understand is that when I turn on the debug message, I could not map "pdid" and "eid" below to the the spec mi id in the code where service iid = 5, event iid =1036, property iid =2. Do you mind explaining a bit on that?
2024-05-08 21:15:53.601 DEBUG (MainThread) [custom_components.xiaomi_gateway3.mqtt.192.168.1.40] {'topic': 'miio/report', 'data': b'{"id":580456024,"method":"_async.ble_event","params":{"dev":{"did":"blt.3.1hk9un6hkcg00","mac":"CA:6E:1B:6A:8F:89","pdid":17825},"evt":[{"eid":22052,"edata":"16"}],"frmCnt":1,"gwts":1715199353}}'}
e.g. the battery sensor in this device does not show up, so I'd like to troubleshoot it. But I am not sure which "eid" and "pid" I need to search in the log for such battery event.