userx14 / omblepy

Cli tool to read records from omron blood-pressure bluetooth-low-energy measurement instruments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OMRON HEM-7142T1 project

stanleyoz opened this issue · comments

Hi. Just got a 7142T1 and like to help to connect this device to get the data into our computers.

In bluetoothctl, was able to pair and connect in "P" mode ..

[bluetooth]# connect F9:28:00:95:99:83
Attempting to connect to F9:28:00:95:99:83
[CHG] Device F9:28:00:95:99:83 Connected: yes
Connection successful
[CHG] Device F9:28:00:95:99:83 ServicesResolved: yes
[HEM-7142T1]#

When I ran the omblepy.py script ...

2023-12-03 11:21:03,341 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
File "/home/stanley/coding/mkBLE/omblepy/./omblepy.py", line 389, in
asyncio.run(main())
File "/home/stanley/miniconda3/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/stanley/miniconda3/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/stanley/coding/mkBLE/omblepy/./omblepy.py", line 362, in main
await bleClient.connect()
File "/home/stanley/.local/share/virtualenvs/mkBLE-pJAGQooe/lib/python3.10/site-packages/bleak/init.py", line 605, in connect
return await self._backend.connect(**kwargs)
File "/home/stanley/.local/share/virtualenvs/mkBLE-pJAGQooe/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 140, in connect
raise BleakDeviceNotFoundError(
bleak.exc.BleakDeviceNotFoundError: Device with address F9:28:00:95:99:83 was not found.

OR

2023-12-03 11:26:34,332 - omblepy - INFO - Attempt connecting to F9:28:00:95:99:83.
2023-12-03 11:26:35,752 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
File "/home/stanley/coding/mkBLE/omblepy/./omblepy.py", line 367, in main
raise OSError("""Some required bluetooth attributes not found on this ble device.
OSError: Some required bluetooth attributes not found on this ble device.
This means that either, you connected to a wrong device,
or that your OS has a bug when reading BT LE device attributes (certain linux versions).

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/stanley/coding/mkBLE/omblepy/./omblepy.py", line 389, in
asyncio.run(main())
File "/home/stanley/miniconda3/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/stanley/miniconda3/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/stanley/coding/mkBLE/omblepy/./omblepy.py", line 387, in main
await bleClient.disconnect()
File "/home/stanley/.local/share/virtualenvs/mkBLE-pJAGQooe/lib/python3.10/site-packages/bleak/init.py", line 614, in disconnect
return await self._backend.disconnect()
File "/home/stanley/.local/share/virtualenvs/mkBLE-pJAGQooe/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 420, in disconnect
assert self._bus is None
AssertionError

Is it just a "work-flow" problem here? Should I unpair using bluetoothctl and leave to the script? In what OMRON device "mode" can we recieve data from the device?

Thanks mate.

And ... when my computer is unpaired (I remove the pairing in bluetoothctl), I get this when OMRON is in flashing "P" mode ..

Enter ID or just press Enter to rescan.
0
2023-12-03 11:30:48,211 - omblepy - INFO - Attempt connecting to F9:28:00:95:99:83.
2023-12-03 11:31:18,599 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
File "/home/stanley/coding/mkBLE/omblepy/./omblepy.py", line 389, in
asyncio.run(main())
File "/home/stanley/miniconda3/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/stanley/miniconda3/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/stanley/coding/mkBLE/omblepy/./omblepy.py", line 364, in main
await bleClient.pair(protection_level = 2)
File "/home/stanley/.local/share/virtualenvs/mkBLE-pJAGQooe/lib/python3.10/site-packages/bleak/init.py", line 629, in pair
return await self._backend.pair(*args, **kwargs)
File "/home/stanley/.local/share/virtualenvs/mkBLE-pJAGQooe/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 473, in pair
assert_reply(reply)
File "/home/stanley/.local/share/virtualenvs/mkBLE-pJAGQooe/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 22, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.AuthenticationCanceled] Authentication Canceled
(mkBLE) (base) stanley@stanLG:~/coding/mkBLE/omblepy$

Hi @stanleyoz,

I've also seen the errors you are getting. Most likely they are caused either by the linux bluez driver or the python bluetooth library I use (bleak). On the machines I encountered this issue it worked with different older versions of bluez, and with windows.
My suspicion is on bluez, since some of the bluetooth attributes used to transmit the data are not detected with the system tools either. Thats also the reason I built in a check to verify the services are there and print the "OS has a bug when reading BT LE device attributes (certain linux versions)." error.

If it is not a big hurdle for you I would really recommend to test with windows first and if you get it to work there find a compatible linux/bluez version.

Thanks for testing,
Benjamin

Hi Benjamin. You are right as I am also chatting with Thomas and even tested with a new plug-in he baked just for the 7142T1 but that failed to authenticate with the device so far : https://codeberg.org/LazyT/ubpm/issues/72#. He also suspects the same and suggesting to work with a Win version since the bluez is a suspect for now. I hope to follow up (I am away from my BPM for a few days :( ... ) and perhaps can get this newer model monitor included in the library soon. Thanks.