Replies: 9 comments 6 replies
-
|
Bleak accesses characteristics by UUID rather than by handle. So the first argument to |
Beta Was this translation helpful? Give feedback.
-
|
Thank you: |
Beta Was this translation helpful? Give feedback.
-
|
Thank you again: def notification_handler(characteristic: BleakGATTCharacteristic, data: bytearray):
print(f"response using callback function: {data}") and CMD_UUID = "00000002-0000-1000-8000-00805f9b34fb"
await client.start_notify(CMD_UUID, notification_handler)
await client.write_gatt_char(CMD_UUID, b'\xAA\x23\x00\x23\x00',response=True) # this send data to device
await client.stop_notify()I get: await client.start_notify(CMD_UUID, notification_handler)
File "/usr/local/lib/python3.10/dist-packages/bleak/__init__.py", line 799, in start_notify
await self._backend.start_notify(
File "/usr/local/lib/python3.10/dist-packages/bleak/backends/bluezdbus/client.py", line 930, in start_notify
assert_reply(reply)
File "/usr/local/lib/python3.10/dist-packages/bleak/backends/bluezdbus/utils.py", line 27, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotSupported] Operation is not supportedCan you see what I am doing wrong? |
Beta Was this translation helpful? Give feedback.
-
|
I don't understand I am afraid 2025-11-24 21:32:37,332 __main__ INFO: starting scan...
2025-11-24 21:32:37,453 __main__ INFO: connecting to device...
2025-11-24 21:32:39,761 __main__ INFO: connected to HS48FF (53:0A:F5:3B:48:FF)
2025-11-24 21:32:39,761 __main__ INFO: [Service] 00000001-0000-1000-8000-00805f9b34fb (Handle: 10): SDP
2025-11-24 21:32:39,761 __main__ INFO: [Characteristic] 00000003-0000-1000-8000-00805f9b34fb (Handle: 13): RFCOMM (notify)
2025-11-24 21:32:40,157 __main__ ERROR: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 15): Client Characteristic Configuration, Error: [org.bluez.Error.Failed] Operation failed with ATT error: 0x80 (Unknown code)
2025-11-24 21:32:40,157 __main__ INFO: [Characteristic] 00000002-0000-1000-8000-00805f9b34fb (Handle: 11): Vendor specific (write)
2025-11-24 21:32:40,157 __main__ INFO: [Service] 00001801-0000-1000-8000-00805f9b34fb (Handle: 6): Generic Attribute Profile
2025-11-24 21:32:40,246 __main__ INFO: [Characteristic] 00002a05-0000-1000-8000-00805f9b34fb (Handle: 7): Service Changed (read,indicate), Value: bytearray(b'\x01\x00\xff\xff')
2025-11-24 21:32:40,428 __main__ INFO: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 9): Client Characteristic Configuration, Value: bytearray(b'\x02\x00')
2025-11-24 21:32:40,428 __main__ INFO: disconnecting...How should be my start_notify and stop_notify lines? |
Beta Was this translation helpful? Give feedback.
-
|
you were right: Thank you for all your Help! |
Beta Was this translation helpful? Give feedback.
-
|
YES!! def notification_handler(characteristic: BleakGATTCharacteristic, data: bytearray):
print(f"response using callback function: {data}")
async def run():
adres="53:0A:F5:3B:48:FF"
client = BleakClient(str(adres))
await client.connect()
CMD_UUID = "00000003-0000-1000-8000-00805f9b34fb"
CMD_UUID2 = "00000002-0000-1000-8000-00805f9b34fb"
await client.start_notify(CMD_UUID, notification_handler)
await client.write_gatt_char(CMD_UUID2, b'\xaa\x23\x00\x23\x00',response=True) # this send data to device
await client.stop_notify(CMD_UUID)
if __name__ == "__main__":
asyncio.run(run()) |
Beta Was this translation helpful? Give feedback.
-
|
Unfortunately I responded to fast. the program response with the start_notify but with the wrong data... As I said before Looking at Whireshark the BMS send out the correct data, but is does not reach Python.... I tried all the other UUID from the service_explorer.py but the all end up with an error. |
Beta Was this translation helpful? Give feedback.
-
|
As soon as I have acces to the BMS, I will let you know. |
Beta Was this translation helpful? Give feedback.
-
|
For an other BMS, with Home Assistant close by, I used https://github.com/patman15/BMS_BLE-HA |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to connect with python to my BMS.
Have been debugging with wireshark and now have a working sample in gatttool
Which I can relate to the data I want to see.
I already made a lot of test python/bleak programs but none of them sends the correct data to the BMS
So the BMS does not respond correctly.
the last thing I tried was:
but that does not produce the right data to the BMS
Any help will be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions