bleak icon indicating copy to clipboard operation
bleak copied to clipboard

Linear searching is a performance bottleneck in `BlueZManager.get_services` with many devices

Open bdraco opened this issue 1 year ago • 3 comments

Properties are indexed well for _wait_condition but building the services can be expensive when the number of properties stored gets to a large number. Its noticeable when there ~20 bluetooth devices that have their services resolved in the properties dict

bdraco avatar Aug 08 '22 17:08 bdraco

I'm planning on working on a solution for this

bdraco avatar Aug 08 '22 17:08 bdraco

https://github.com/Jc2k/aiohomekit/issues/135

It looks like sometimes they are missing as well

bdraco avatar Aug 09 '22 00:08 bdraco

Might also be the cause of https://github.com/home-assistant/core/issues/75962#issuecomment-1207916740

Switchbot communication failed. Stopping trying
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 81, in _sendcommand
return await self._send_command_locked(key, command)
File "/usr/local/lib/python3.10/site-packages/switchbot/devices/device.py", line 122, in _send_command_locked
await client.start_notify(read_char, _notification_handler)
File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 809, in start_notify
raise BleakError(
bleak.exc.BleakError: Characteristic with UUID None could not be found!

bdraco avatar Aug 09 '22 00:08 bdraco