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

Error Packet has error bit set #24

Open
agamm opened this issue Oct 31, 2024 · 12 comments
Open

Error Packet has error bit set #24

agamm opened this issue Oct 31, 2024 · 12 comments

Comments

@agamm
Copy link

agamm commented Oct 31, 2024

C:\Users\MyUser>colmi_r02_client.exe --address=31:38:42:35:XX:XX get-real-time-heart-rate
Starting reading, please wait.
asyncio: Exception in callback Client._handle_tx(<bleak.backen...001820F1A0C80>)(bytearray(b'\...\x00\x00\x8c'))
handle: <Handle Client._handle_tx(<bleak.backen...001820F1A0C80>)(bytearray(b'\...\x00\x00\x8c'))>
Traceback (most recent call last):
  File "C:\Users\MyUser\.pyenv\pyenv-win\versions\3.12.7\Lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\MyUser\pipx\venvs\colmi-r02-client\Lib\site-packages\colmi_r02_client\client.py", line 106, in _handle_tx
    assert packet_type < 127, f"Packet has error bit set {packet}"

OS: Windows
Python: 3.12.7
XX:XX was changed.

Any ideas?

@tahnok
Copy link
Owner

tahnok commented Oct 31, 2024

Can you try again with the --record flag and the --debug flag and upload the log and the recording?

@agamm
Copy link
Author

agamm commented Oct 31, 2024

Here:

colmi_r02_client.exe --record --debug --address=31:38:42:35:XX:XX get-real-time-heart-rate
colmi_r02_client.cli: Recording responses to captures\colmi_response_capture_1730404231.bin
colmi_r02_client.client: Connecting to 31:38:42:35:XX:XX
colmi_r02_client.client: Connected!
Starting reading, please wait.
colmi_r02_client.client: Sending packet: bytearray(b'i\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00j')
colmi_r02_client.client: Received packet bytearray(b'i\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00j')
colmi_r02_client.client: Sending packet: bytearray(b'\x1e3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Q')
colmi_r02_client.client: Received packet bytearray(b'\x9e\xee\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c')
asyncio: Exception in callback Client._handle_tx(<bleak.backen...001F9B00C2DB0>)(bytearray(b'...\x00\x00\x8c'))
handle: <Handle Client._handle_tx(<bleak.backen...001F9B00C2DB0>)(bytearray(b'...\x00\x00\x8c'))>
Traceback (most recent call last):
File "C:\Users\MyUser.pyenv\pyenv-win\versions\3.12.7\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\MyUser\pipx\venvs\colmi-r02-client\Lib\site-packages\colmi_r02_client\client.py", line 106, in _handle_tx
assert packet_type < 127, f"Packet has error bit set {packet}"
^^^^^^^^^^^^^^^^^

bin capture file:

i�
image

@tahnok
Copy link
Owner

tahnok commented Nov 3, 2024

Is this the r10?

@agamm
Copy link
Author

agamm commented Nov 4, 2024

No, I bought this (R2):
https://www.aliexpress[.]us/item/3256806445134241.html

COLMI R02 Smart Ring Military Grade Titanium Steel Shell Health Monitoring IP68 & 3ATM Waterproof Multi-sport Modes

@devwearsprada
Copy link

devwearsprada commented Nov 5, 2024

I have the same issue with a COLMI R02 ring. Below the logs and bin file.

Output of scan:

                Name  | Address
--------------------------------------------
            R02_5001  |  C77FF180-C50B-DFD0-AAC1-XXXXXXXXXXXX

Output of get-real-time-heart-rate

colmi_r02_client --address=C77FF180-C50B-DFD0-AAC1-XXXXXXXXXXXX --debug --record get-real-time-heart-rate >> log.txt
colmi_r02_client.cli: Recording responses to captures/colmi_response_capture_1730818479.bin
colmi_r02_client.client: Connecting to C77FF180-C50B-DFD0-AAC1-E8AC2CA17F1D
colmi_r02_client.client: Connected!
colmi_r02_client.client: Sending packet: bytearray(b'i\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00j')
colmi_r02_client.client: Received packet bytearray(b'i\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00j')
colmi_r02_client.client: Sending packet: bytearray(b'\x1e3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Q')
colmi_r02_client.client: Received packet bytearray(b'\x9e\xee\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c')
asyncio: Exception in callback PeripheralDelegate.did_update_value_for_characteristic()
handle: <Handle PeripheralDelegate.did_update_value_for_characteristic()>
Traceback (most recent call last):
  File "/usr/local/Cellar/[email protected]/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/colmi-r02-client/lib/python3.13/site-packages/bleak/backends/corebluetooth/PeripheralDelegate.py", line 381, in did_update_value_for_characteristic
    notify_callback(bytearray(value))
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/user/.local/pipx/venvs/colmi-r02-client/lib/python3.13/site-packages/colmi_r02_client/client.py", line 106, in _handle_tx
    assert packet_type < 127, f"Packet has error bit set {packet}"
           ^^^^^^^^^^^^^^^^^
AssertionError: Packet has error bit set bytearray(b'\x9e\xee\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8c')

.bin file of record

colmi_response_capture_1730817364.bin.zip

@agamm
Copy link
Author

agamm commented Nov 10, 2024

@tahnok anything else we can try to debug this?

@tahnok
Copy link
Owner

tahnok commented Nov 10, 2024

I haven't had a chance to look at this yet, but I will when I get the chance. On discord I've had a report that maybe it's a different chip but same protocol (implemented slightly differently)

@tahnok
Copy link
Owner

tahnok commented Dec 2, 2024

I think I fixed this, can you try again?

@agamm
Copy link
Author

agamm commented Dec 2, 2024

Now I get:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\MyUser\.local\bin\colmi_r02_client.exe\__main__.py", line 4, in <module>
  File "C:\Users\MyUser\pipx\venvs\colmi-r02-client\Lib\site-packages\colmi_r02_client\cli.py", line 16, in <module>
    from colmi_r02_client.client import Client
  File "C:\Users\MyUser\pipx\venvs\colmi-r02-client\Lib\site-packages\colmi_r02_client\client.py", line 13, in <module>
    from colmi_r02_client import battery, date_utils, steps, set_time, blink_twice, hr, hr_settings, packet, reboot, real_time
  File "C:\Users\MyUser\pipx\venvs\colmi-r02-client\Lib\site-packages\colmi_r02_client\date_utils.py", line 4, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

Python 3.12.7

@tahnok
Copy link
Owner

tahnok commented Dec 2, 2024

Oops, different issue introduced recently that I just now fixed if you want to try again

@agamm
Copy link
Author

agamm commented Dec 7, 2024

colmi_r02_util.exe scan
Found device(s)
                Name  | Address
--------------------------------------------

empty.

@tahnok
Copy link
Owner

tahnok commented Dec 11, 2024

Scanning shouldn't have changed, you might have to try a few times to pick it up, it seems the scan misses the device. Can you try colmi_r02_client --address=YOUR_ADDRESS get-real-time heart-rate?

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

No branches or pull requests

3 participants