Giter VIP home page Giter VIP logo

omblepy's People

Contributors

dromie avatar userx14 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

omblepy's Issues

Recovering device's internal clock

Thanks for your nice project, it gave me a lot of information about Omron devices' Bluetooth protocol. I would like to implement other features in relation with devices' internal clock (how to recover it, to reconfigure it, etc...) and I've several question :

  1. Do you have any information concerning devices' internal clock ?
  2. How did you get EEPROM address and data format for measurement information (official documentation reverse engineering, communication analysis, EEPROM diff analysis) ?

Thanks !

EVOLV data structure

Hello Benjamin, I have completely decrypted the data sets for the 7600 Evolv. Information about the error bytes and the arrhythmia values are available. If you are interested please reply.
Kind regards, Güsel

Which usb bt adapter?

There are a myriad of them, and the ons I haveCSR 4.0 don't work. Whats a good one to use? The system pairs, but then never finishes.

New device support.

Can you make support for another Omron RS2 Intelli IT (HEM-161T) device? I tried to connect but without success.

Timesync on hem-7361-t does not work

Thanks for this great tool that allowed me to use my hem-7361 locally instead of uploading my data to the cloud! :)

I tried the experimental untested code for timesync and I'm writing to report back that it does not work for me. The first issue is that

year, month, day, hour, minute, second = [int(byte) for byte in readTimeSyncDataByteArray[8:]]

causes ValueError: too many values to unpack (expected 6). The problem is not just the number of bytes (the array length is 16, the length of the [8:] part is 8) but the bytes themselves are "bad" as well, all of them are 0xff so there is no way to parse them into timestamp fields.

Even if I skip over the part of parsing the device's time, the writing of the timestamp does not have any effect either (apart from a flashing Err text on the device).

Read data is realtime

This works perfectly for HEM-7361T, thanks a lot building it.

Now moving forward, we were able to export all data in CSV, we wanted to know is there any way we can get real time notification whenever a new Blood pressure reading is taken on the device.

Thanks!

7600T and Missing Functionality

Hi,

I have used your (main branch) omblepy.py to successfully pair to my 7600T using "-d hem-7322T-d -p". It paired on the second attempt. I would like to help with getting the data read working and any other possible features. I am doing this on a raspberry pi 4 with the latest 64bit debian bullseye.

What needs doing to get this working?

Thanks

OMRON HEM-7142T1 project

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.

Documentation

Can you tell me how you find which UUIDs for different functions and bytes code to write for a particular action?

Pairing is not available in Core Bluetooth.

I'm trying to run

python ./omblepy.py -d HEM-7361T

I get the following error

Traceback (most recent call last):
  File "XXXX/omblepy/./omblepy.py", line 364, in main
    await bleClient.pair(protection_level = 2)
  File "XXXX/omblepy/env/lib/python3.10/site-packages/bleak/__init__.py", line 629, in pair
    return await self._backend.pair(*args, **kwargs)
  File "XXXX/omblepy/env/lib/python3.10/site-packages/bleak/backends/corebluetooth/client.py", line 191, in pair
    raise NotImplementedError("Pairing is not available in Core Bluetooth.")
NotImplementedError: Pairing is not available in Core Bluetooth.

Any solution for this?

Problem with paring M7 Inteli

Trying to pair but no luck :(

root@adm:/home/robert/omblepy# python3 omblepy.py -p -d HEM-7361T
2024-06-14 20:41:31,876 - omblepy - INFO - Attempt to import module for device hem-7361t
To improve your chance of a successful connection please do the following:
 -remove previous device pairings in your OS's bluetooth dialog
 -enable bluetooth on you omron device and use the specified mode (pairing or normal)
 -do not accept any pairing dialog until you selected your device in the following list

Select your Omron device from the list below...
/home/robert/omblepy/omblepy.py:297: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  devices = sorted(devices, key = lambda x: x.rssi, reverse=True)
/home/robert/omblepy/omblepy.py:301: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  tableEntries.append([deviceIdx, device.address, device.name, device.rssi])
+----+-------------------+-------------------------------+------+
| ID | MAC               | NAME                          | RSSI |
+----+-------------------+-------------------------------+------+
| 0  | 0A:31:DA:6D:C6:B5 | 0A-31-DA-6D-C6-B5             | -55  |
| 1  | 24:FC:E5:8F:CE:BF | 24-FC-E5-8F-CE-BF             | -65  |
| 2  | 14:13:0B:44:F5:FC | 14-13-0B-44-F5-FC             | -68  |
| 3  | 28:FF:B2:32:E0:19 | BLEsmart_0000025828FFB232E019 | -78  |
| 4  | 14:13:0B:C0:AC:BE | 14-13-0B-C0-AC-BE             | -80  |
| 5  | 68:27:19:1B:31:83 | D1531102                      | -81  |
| 6  | A0:92:08:5A:95:A0 | TY                            | -83  |
| 7  | 5B:A9:59:9E:8C:92 | 5B-A9-59-9E-8C-92             | -85  |
| 8  | 58:61:6A:0C:D6:0A | 58-61-6A-0C-D6-0A             | -87  |
| 9  | 42:71:ED:4F:E8:CF | 42-71-ED-4F-E8-CF             | -88  |
| 10 | FC:03:9F:59:DE:42 | FC-03-9F-59-DE-42             | -89  |
| 11 | 3E:C7:CB:01:CB:46 | 3E-C7-CB-01-CB-46             | -90  |
| 12 | 48:4A:6E:97:50:AF | [LG] webOS TV SM8600PLA       | -90  |
| 13 | 5C:B9:19:A3:0F:57 | 5C-B9-19-A3-0F-57             | -91  |
| 14 | EE:8A:9D:75:D9:03 | EE-8A-9D-75-D9-03             | -91  |
| 15 | 8C:CE:FD:75:0C:F9 | Xiaomi Band 8 Active 0CF9     | -92  |
| 16 | FC:F2:35:D8:66:52 | FC-F2-35-D8-66-52             | -92  |
| 17 | 6E:DE:E4:0B:C8:4A | 6E-DE-E4-0B-C8-4A             | -92  |
| 18 | 4F:33:BA:40:E3:A6 | 4F-33-BA-40-E3-A6             | -93  |
| 19 | 6C:68:5F:C6:41:79 | 6C-68-5F-C6-41-79             | -93  |
| 20 | 40:00:00:B4:34:E2 | 40-00-00-B4-34-E2             | -93  |
| 21 | 4B:C7:6D:D0:45:32 | 4B-C7-6D-D0-45-32             | -93  |
| 22 | CB:10:0D:3C:9A:1C | CB-10-0D-3C-9A-1C             | -93  |
| 23 | 51:8B:3F:B8:17:07 | 51-8B-3F-B8-17-07             | -94  |
| 24 | 7C:1E:B9:43:37:FD | 7C-1E-B9-43-37-FD             | -95  |
| 25 | 32:05:A6:29:AC:21 | 32-05-A6-29-AC-21             | -95  |
| 26 | 00:16:A4:6F:B2:13 | Stratos MAXO 40/0,5-12-R7     | -95  |
| 27 | 76:11:4E:41:87:84 | 76-11-4E-41-87-84             | -95  |
+----+-------------------+-------------------------------+------+
Enter ID or just press Enter to rescan.
3
2024-06-14 20:41:40,251 - omblepy - INFO - Attempt connecting to 28:FF:B2:32:E0:19.
2024-06-14 20:41:51,802 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 214, in connect
    reply = await self._bus.call(
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/dbus_fast/aio/message_bus.py", line 385, in call
    await future
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/robert/omblepy/omblepy.py", line 362, in main
    await bleClient.connect()
  File "/usr/local/lib/python3.11/dist-packages/bleak/__init__.py", line 615, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 151, in connect
    async with async_timeout(timeout):
  File "/usr/lib/python3.11/asyncio/timeouts.py", line 98, in __aexit__
    raise TimeoutError
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 532, in unpair
    assert_reply(reply)
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.DoesNotExist] Does Not Exist

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/robert/omblepy/omblepy.py", line 389, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/robert/omblepy/omblepy.py", line 386, in main
    await bleClient.unpair()
  File "/usr/local/lib/python3.11/dist-packages/bleak/__init__.py", line 653, in unpair
    return await self._backend.unpair()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/bleak/backends/bluezdbus/client.py", line 535, in unpair
    raise BleakDeviceNotFoundError(
bleak.exc.BleakDeviceNotFoundError: Device with address 28:FF:B2:32:E0:19 was not found.

Missing Services with recent Linux Kernels

On some Linux distributions the error:
"Some required bluetooth attributes not found on this ble device."
will occur. There seems to be a bug in the kernel or bluetooth stack of these distributions.
Some services of the omron bluetooth device are not discovered.
Even operating system tools like gatttool do only find half of the services present on the device.
If anyone has an idea what is going on, please let me know.

BP653 / HEM-6321T-Z

Hi, I get exception trying to pair with Omron BP653 / HEM-6321T-Z;

On Ubuntu 22.04 I get this:

$ python ./omblepy.py -p -d HEM-7322T --loggerDebug
2024-03-05 16:19:23,121 - omblepy - INFO - Attempt to import module for device hem-7322t
To improve your chance of a successful connection please do the following:
 -remove previous device pairings in your OS's bluetooth dialog
 -enable bluetooth on you omron device and use the specified mode (pairing or normal)
 -do not accept any pairing dialog until you selected your device in the following list

Select your Omron device from the list below...
/media/james/data/disposable/git/my_ubpm/omblepy/./omblepy.py:297: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  devices = sorted(devices, key = lambda x: x.rssi, reverse=True)
/media/james/data/disposable/git/my_ubpm/omblepy/./omblepy.py:301: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  tableEntries.append([deviceIdx, device.address, device.name, device.rssi])
+----+-------------------+-------------------------------+------+
| ID | MAC               | NAME                          | RSSI |
+----+-------------------+-------------------------------+------+
| 0  | 70:E3:E4:1D:9A:A9 | 70-E3-E4-1D-9A-A9             | -76  |
| 1  | DF:46:B5:26:78:DB | DF-46-B5-26-78-DB             | -78  |
| 2  | 70:BB:6A:D6:31:6B | 70-BB-6A-D6-31-6B             | -83  |
| 3  | CF:05:1C:67:04:00 | BLEsmart_000001180F051C670400 | -85  |
| 4  | D4:9D:C0:84:03:89 | D4-9D-C0-84-03-89             | -92  |
+----+-------------------+-------------------------------+------+
Enter ID or just press Enter to rescan.
3
2024-03-05 16:19:32,733 - omblepy - INFO - Attempt connecting to CF:05:1C:67:04:00.
2024-03-05 16:20:09,851 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
  File "/media/james/data/disposable/git/my_ubpm/omblepy/./omblepy.py", line 389, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/media/james/data/disposable/git/my_ubpm/omblepy/./omblepy.py", line 364, in main
    await bleClient.pair(protection_level = 2)
  File "/home/james/.local/lib/python3.10/site-packages/bleak/__init__.py", line 629, in pair
    return await self._backend.pair(*args, **kwargs)
  File "/home/james/.local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 473, in pair
    assert_reply(reply)
  File "/home/james/.local/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

On win11 I get this:

python ./omblepy.py -p -d HEM-7322T --loggerDebug
2024-03-03 13:55:14,756 - omblepy - INFO - Attempt to import module for device hem-7322t
To improve your chance of a successful connection please do the following:
 -remove previous device pairings in your OS's bluetooth dialog
 -enable bluetooth on you omron device and use the specified mode (pairing or normal)
 -do not accept any pairing dialog until you selected your device in the following list

Select your Omron device from the list below...
C:\data\git\temp\omblepy\omblepy.py:297: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  devices = sorted(devices, key = lambda x: x.rssi, reverse=True)
C:\data\git\temp\omblepy\omblepy.py:301: FutureWarning: BLEDevice.rssi is deprecated and will be removed in a future version of Bleak, use AdvertisementData.rssi instead
  tableEntries.append([deviceIdx, device.address, device.name, device.rssi])
+----+-------------------+-------------------------------+------+
| ID | MAC               | NAME                          | RSSI |
+----+-------------------+-------------------------------+------+
| 0  | CF:05:1C:67:04:00 | BLEsmart_000001180F051C670400 | -67  |
| 1  | 43:F7:98:A5:4E:EE | None                          | -69  |
| 2  | D4:9D:C0:84:03:89 | None                          | -91  |
| 3  | 77:9B:43:C1:5F:0D | None                          | -93  |
+----+-------------------+-------------------------------+------+
Enter ID or just press Enter to rescan.
0
2024-03-03 13:55:24,974 - omblepy - INFO - Attempt connecting to CF:05:1C:67:04:00.
2024-03-03 13:55:29,683 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
  File "C:\data\git\temp\omblepy\omblepy.py", line 389, in <module>
    asyncio.run(main())
  File "C:\Users\james\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\james\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\james\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 685, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\data\git\temp\omblepy\omblepy.py", line 364, in main
    await bleClient.pair(protection_level = 2)
  File "C:\data\git\temp\omblepy\venv\Lib\site-packages\bleak\__init__.py", line 629, in pair
    return await self._backend.pair(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\data\git\temp\omblepy\venv\Lib\site-packages\bleak\backends\winrt\client.py", line 616, in pair
    raise BleakError(f"Could not pair with device: {pairing_result.status}")
bleak.exc.BleakError: Could not pair with device: 15

I have tried the troubleshooting steps without success.

My BT info:

$ bluetoothd -v
5.64

$ hciconfig -a
hci0:	Type: Primary  Bus: USB
	BD Address: 3C:E9:F7:F3:2F:63  ACL MTU: 1021:4  SCO MTU: 96:6
	UP RUNNING 
	RX bytes:147329 acl:1133 sco:0 events:7615 errors:0
	TX bytes:843472 acl:955 sco:0 commands:4677 errors:0
	Features: 0xbf 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
	Link policy: RSWITCH SNIFF 
	Link mode: PERIPHERAL ACCEPT 
	Name: 'XPS13-9320-ubuntu'
	Class: 0x7c010c
	Service Classes: Rendering, Capturing, Object Transfer, Audio, Telephony
	Device Class: Computer, Laptop
	HCI Version:  (0xc)  Revision: 0x35fc
	LMP Version:  (0xc)  Subversion: 0x35fc
	Manufacturer: Intel Corp. (2)

Thanks,
James

HEM-7600T: works only when bluetoothctl is running

When I tried pairing and connecting to HEM-7600T, I kept getting the following error:

# python omblepy.py -d HEM-7600T --mac XX:XX:XX:XX:XX:XX --loggerDebug
2024-02-14 16:51:26,089 - omblepy - INFO - Attempt to import module for device hem-7600t
2024-02-14 16:51:26,134 - omblepy - INFO - Attempt connecting to XX:XX:XX:XX:XX:XX.
2024-02-14 16:51:32,465 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
  File "/srv/services/omble/omblepy/omblepy.py", line 364, in main
    await bleClient.pair(protection_level = 2)
  File "/srv/services/omble/venv-omble/lib/python3.11/site-packages/bleak/__init__.py", line 629, in pair
    return await self._backend.pair(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/services/omble/venv-omble/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 473, in pair
    assert_reply(reply)
  File "/srv/services/omble/venv-omble/lib/python3.11/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.AuthenticationFailed] Authentication Failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/services/omble/omblepy/omblepy.py", line 389, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/srv/services/omble/omblepy/omblepy.py", line 387, in main
    await bleClient.disconnect()
  File "/srv/services/omble/venv-omble/lib/python3.11/site-packages/bleak/__init__.py", line 614, in disconnect
    return await self._backend.disconnect()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/services/omble/venv-omble/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 420, in disconnect
    assert self._bus is None
           ^^^^^^^^^^^^^^^^^
AssertionError

In the meantime, journalctl -u bluetooth.service showed:

lut 14 16:51:17 hostname bluetoothd[3979]: src/device.c:new_auth() No agent available for request type 2
lut 14 16:51:17 hostname bluetoothd[3979]: device_confirm_passkey: Operation not permitted

However, whenever I start bluetoothctl in other console windows (and keep it running), it does suceed to pair/sync, the user1.csv contains correct data and journalctl stays silent.

But still, it ends with an AssertionError:

# python omblepy.py -d HEM-7600T --mac XX:XX:XX:XX:XX:XX
2024-02-14 16:56:14,429 - omblepy - INFO - Attempt to import module for device hem-7600t
2024-02-14 16:56:14,468 - omblepy - INFO - Attempt connecting to XX:XX:XX:XX:XX:XX.
2024-02-14 16:56:21,527 - omblepy - INFO - communication started
2024-02-14 16:56:22,436 - omblepy - INFO - start reading data, this can take a while, use debug flag to see progress
2024-02-14 16:56:29,049 - omblepy - INFO - communication finished
2024-02-14 16:56:29,056 - omblepy - INFO - writing data to user1.csv
2024-02-14 16:56:29,062 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
  File "/srv/services/omble/omblepy/omblepy.py", line 389, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/srv/services/omble/omblepy/omblepy.py", line 387, in main
    await bleClient.disconnect()
  File "/srv/services/omble/venv-omble/lib/python3.11/site-packages/bleak/__init__.py", line 614, in disconnect
    return await self._backend.disconnect()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/services/omble/venv-omble/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 420, in disconnect
    assert self._bus is None
           ^^^^^^^^^^^^^^^^^
AssertionError

I'm on Ubuntu 23.04 & bluetoothctl: 5.66, commit 1f43fef.

Is there anything I can do to fix this?

OMRON RS7: bleak.exc.BleakDBusError: [org.bluez.Error.AuthenticationFailed] Authentication Failed

When trying to pair my OMRON RS7 i always get an error: bleak.exc.BleakDBusError: [org.bluez.Error.AuthenticationFailed] Authentication Failed.

I tried all troubleshooting steps and maybe it helps: i can connect, trust and pair it from within bluetoothctl.

Any ideas what I could try?

$ python3 ./omblepy.py -p -d HEM-7361T --mac XX:XX:XX:XX:XX:XX --loggerDebug
2023-04-25 17:43:33,413 - omblepy - INFO - Attempt to import module for device hem-7361t
2023-04-25 17:43:33,433 - omblepy - INFO - Attempt connecting to XX:XX:XX:XX:XX:XX.
2023-04-25 17:43:39,968 - omblepy - INFO - unpair and disconnect
Traceback (most recent call last):
  File "/tmp/omblepy/./omblepy.py", line 364, in main
    await bleClient.pair(protection_level = 2)
  File "/usr/lib/python3.10/site-packages/bleak/__init__.py", line 555, in pair
    return await self._backend.pair(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 466, in pair
    assert_reply(reply)
  File "/usr/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.AuthenticationFailed] Authentication Failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/omblepy/./omblepy.py", line 389, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/tmp/omblepy/./omblepy.py", line 387, in main
    await bleClient.disconnect()
  File "/usr/lib/python3.10/site-packages/bleak/__init__.py", line 540, in disconnect
    return await self._backend.disconnect()
  File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 413, in disconnect
    assert self._bus is None
AssertionError

writeNewPairingKey for an HEM-7151T

I am trying to get this to work with an OMRON HEM-7151T

Scanning for BLE devices...
+----+-------------------+-------------------------------+------+
| ID | MAC               | NAME                          | RSSI |
+----+-------------------+-------------------------------+------+
| 0  | 28:FF:B2:73:5F:EF | BLEsmart_0000016028FFB2735FEF | -56  |
+----+-------------------+-------------------------------+------+
Enter ID or just press Enter to rescan.
0
Attempt connecting to 28:FF:B2:73:5F:EF.
Traceback (most recent call last):
  File "/data/data4/src/omblepy/omblepy.py", line 344, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/data/data4/src/omblepy/omblepy.py", line 337, in main
    await bluetoothTxRxObj.writeNewPairingKey()
  File "/data/data4/src/omblepy/omblepy.py", line 201, in writeNewPairingKey
    raise ValueError(f"Could not enter key programming mode. Has the device been started in pairing mode?")
ValueError: Could not enter key programming mode. Has the device been started in pairing mode?

I threw some print statements in the writeNewPairingKey function:

deviceResponse == bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
deviceResponse[:2] == bytearray(b'\x00\x00')

I always seem to get an empty byte array as a response.

I took a look at an example in the bleak source code and was able to grab this info off the device:

[Service] 00001801-0000-1000-8000-00805f9b34fb (Handle: 256): Generic Attribute Profile
    [Characteristic] 00002a05-0000-1000-8000-00805f9b34fb (Handle: 272): Service Changed (indicate), Value: None
[Service] 0000180a-0000-1000-8000-00805f9b34fb (Handle: 512): Device Information
    [Characteristic] 00002a23-0000-1000-8000-00805f9b34fb (Handle: 528): System ID (read), Value: None
    [Characteristic] 00002a24-0000-1000-8000-00805f9b34fb (Handle: 544): Model Number String (read), Value: None
    [Characteristic] 00002a25-0000-1000-8000-00805f9b34fb (Handle: 560): Serial Number String (read), Value: None
    [Characteristic] 00002a26-0000-1000-8000-00805f9b34fb (Handle: 576): Firmware Revision String (read), Value: None
    [Characteristic] 00002a27-0000-1000-8000-00805f9b34fb (Handle: 592): Hardware Revision String (read), Value: None
    [Characteristic] 00002a28-0000-1000-8000-00805f9b34fb (Handle: 608): Software Revision String (read), Value: None
    [Characteristic] 00002a29-0000-1000-8000-00805f9b34fb (Handle: 624): Manufacturer Name String (read), Value: None
    [Characteristic] 00002a2a-0000-1000-8000-00805f9b34fb (Handle: 640): IEEE 11073-20601 Regulatory Cert. Data List (read), Value: None
[Service] ecbe3980-c9a2-11e1-b1bd-0002a5d5c51b (Handle: 768): Unknown
    [Characteristic] b305b680-aee7-11e1-a730-0002a5d5c51b (Handle: 784): Unknown (read,write-without-response,write,notify), Value: None
    [Characteristic] db5b55e0-aee7-11e1-965e-0002a5d5c51b (Handle: 800): Unknown (write-without-response,write), Value: None
    [Characteristic] e0b8a060-aee7-11e1-92f4-0002a5d5c51b (Handle: 816): Unknown (write-without-response,write), Value: None
    [Characteristic] 0ae12b00-aee8-11e1-a192-0002a5d5c51b (Handle: 832): Unknown (write-without-response,write), Value: None
    [Characteristic] 10e1ba60-aee8-11e1-89e5-0002a5d5c51b (Handle: 848): Unknown (write-without-response,write), Value: None
    [Characteristic] 49123040-aee8-11e1-a74d-0002a5d5c51b (Handle: 864): Unknown (read,notify), Value: None
    [Characteristic] 4d0bf320-aee8-11e1-a0d9-0002a5d5c51b (Handle: 880): Unknown (read,notify), Value: None
    [Characteristic] 5128ce60-aee8-11e1-b84b-0002a5d5c51b (Handle: 896): Unknown (read,notify), Value: None
    [Characteristic] 560f1420-aee8-11e1-8184-0002a5d5c51b (Handle: 912): Unknown (read,notify), Value: None
    [Characteristic] 8858eb40-aee8-11e1-bb67-0002a5d5c51b (Handle: 928): Unknown (notify), Value: None
[Service] 0000180f-0000-1000-8000-00805f9b34fb (Handle: 1024): Battery Service
    [Characteristic] 00002a19-0000-1000-8000-00805f9b34fb (Handle: 1040): Battery Level (read,notify), Value: None
[Service] 00001805-0000-1000-8000-00805f9b34fb (Handle: 1280): Current Time Service
    [Characteristic] 00002a2b-0000-1000-8000-00805f9b34fb (Handle: 1296): Current Time (read,write,notify), Value: None
[Service] 5df5e817-a945-4f81-89c0-3d4e9759c07c (Handle: 1536): Unknown
    [Characteristic] 00002a52-0000-1000-8000-00805f9b34fb (Handle: 1552): Record Access Control Point (write,indicate), Value: None
    [Characteristic] c195da8a-0e23-4582-acd8-d446c77c45de (Handle: 1568): Unknown (indicate), Value: None
[Service] 0000181c-0000-1000-8000-00805f9b34fb (Handle: 1792): User Data
    [Characteristic] 00002a99-0000-1000-8000-00805f9b34fb (Handle: 1808): Database Change Increment (read,write,notify), Value: None
    [Characteristic] 00002a9a-0000-1000-8000-00805f9b34fb (Handle: 1824): User Index (read), Value: None
    [Characteristic] 00002a9f-0000-1000-8000-00805f9b34fb (Handle: 1840): User Control Point (write,indicate), Value: None
    [Characteristic] 00002a85-0000-1000-8000-00805f9b34fb (Handle: 1856): Date of Birth (read,write), Value: None
[Service] 00001810-0000-1000-8000-00805f9b34fb (Handle: 2048): Blood Pressure
    [Characteristic] 00002a35-0000-1000-8000-00805f9b34fb (Handle: 2064): Blood Pressure Measurement (indicate), Value: None
    [Characteristic] 00002a49-0000-1000-8000-00805f9b34fb (Handle: 2080): Blood Pressure Feature (read), Value: None

Any idea what I might try to get past this error in writeNewPairingKey ?.

UPDATE:

@userx14 I saw your comment about using btmgmt and bluetoothctl manually but after the write 0x02 its still all zeros

I tried with an android phone and the nRF Connect app and it seems i was able to get a response of 82-0F-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 but I am not sure what that means. I then wrote 0x00fedcba9876543210fedcba9876543210 and got the response 80-04-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.