-
Notifications
You must be signed in to change notification settings - Fork 220
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
Wrong data format mi-like with encryption #79
Comments
Ver 2.9 - Added additional id flags to advertising packages [0x02,0x01,0x06] is inserted at the beginning of the packet: https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile/
BLUETOOTH SPECIFICATION:The Flags AD type contains several flag bits interpreted as boolean values. 18.1 FLAGS
Encryption does not include this block. This is just an additional heading. |
Mijia Telink samples |
Thanks, I’ll check tomorrow. BLE monitor is splitting the message up, but it first does a check on this 02 01 06 part to be present. As it was missing, parsing of the message failed. I could have worked around this, but it seems better to have the exact same format as the original stock firmware. Anyway, thanks for the fast response, I’ll test it tomorrow. |
The project does not aim to make a fake Xiaomi LYWSD03MMC. The inclusion of extended advertising is also possible. Then the length of the data in the packet will be kilobytes ... :)
These three bytes now increase battery consumption by 5%. This is what the 'users' wanted. :) |
I can confirm it's ok working now. Thanks
I do understand. I just noticed a difference in the BLE advertising format, which made BLE monitor not parsing the message (due to the check on 02 01 06 (or 15 16 95) being present in the message). This check works for all other Xiaomi MiBeacon sensors, so my thought was that it would be the easiest to fix in your firmware.
Hmmm, that's significant. Only by adding these three bytes? I'll leave it up to you, to decide on whether you keep the change or not. It can also be fixed on the side of BLE monitor, if you decide to reverse. |
i was testing too... now packets are decrypted but read randomly 5-15 minutes by homeassistant, while i have set the firmware to send the packets every minute if i can, as it's permitted by the protocol, i would go back to firmware 2.8 and correct ble_monitor component... thanks both |
I exaggerated that 5%.
In version 2.8 there are errors in the mode of working with encrypted advertisements in alternation by count. This is due to the fact that the coding of the package requires energy. It is necessary to encode 3 types of packet - with temperature, with humidity, with battery. This is done once on 64 advertising. |
@50494554524F In addition, let me explain how BLE monitor works. These 64 advertisements are all the same, with the same |
64 Advertisings -> 4 message from different data recurring 16 times. 16 Temperature, 16 humidity, 16 battery + 16 empty message for compatibility with the original. All 64 have the same |
The update interval depends on the settings:
As a result, the data update time will be equal to 16 measurement intervals from the sensor. Data update time (next Frame Counter)= 62.5 * 1 * 16 = 1000 ms = 1 sec Maximum: Data update time (next Frame Counter)= 10000 * 25 * 16 = 4000000 ms = 4000 sec |
really clear now, thanks |
I'm the developer of the Passive BLE Monitor integration and we received an issue that a user's sensor didn't work when he set the sensor to advertisement type
Mi
with encryption enabled. I checked it and came to the same conclusion.So I compared a HCI dump message from stock firmware (first line in the table below) to a message from ATC firmware with advertisement type Mi and encryption enabled (second line in the table). As you can see, three bytes are missing (
01 06 1A
). Is it possible to fix/change this.Possibly related to #73 where they also seem to have issues with the encryption?
The text was updated successfully, but these errors were encountered: