-
Notifications
You must be signed in to change notification settings - Fork 28
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
Bluetooth scanner version 2 #478
Bluetooth scanner version 2 #478
Conversation
Issue: #477 |
1 similar comment
Issue: #477 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @taulfsime
I think this is a good change. Please see comment above
Applied this PR to my production instance that suffer script memory overflow for Shelly BLU Gateway ( |
…-mem-overflow' into bluetooth-proxy-script-causes-mem-overflow
I did some tweaks to make it backwards compatible |
I've just about got it wired up to |
needs aioshelly 8.0.0 needs home-assistant-libs/aioshelly#478
aioshelly/ble/const.py
Outdated
const burstSendCount = 5; // number if events, emitted on timer event | ||
const maxQueue = 80; // if the queue exceeds the limit, all new events are ignored until it empties | ||
const packetsInSingleEvent = 5; // max number of packets in single event |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taulfsime Can we put 16 (to match ESPHome) in an event or is that too large?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024-01-12 13:47:57.890 WARNING (MainThread) [aioshelly.ble.backend.scanner] parsed_advs: [('55:F2:94:5F:18:42', -47, (None, [], {}, {76: b'\t\x08\x13\xf1\xc0\xa8k\xbd\x1bX\x16\x08\x00\xda-\xed\xdd%h\\'}, None)), ('D4:B2:A1:7C:42:17', -64, ('RZSS', [], {}, {}, None)), ('C5:F0:B6:05:9A:B8', -65, (None, [], {}, {76: b'\x12\x02$\x01'}, None)), ('F6:EE:7E:AC:9F:EB', -55, (None, [], {}, {76: b'\x12\x02.\x03\x07\x11\x06(\x89\x8amE\x88C!\xde/\xa1#WD\xae\xa9'}, None)), ('FC:EE:36:CF:93:95', -68, (None, [], {}, {2409: b'\xfc\xee6\xcf\x93\x95\x13\x1fd\x12\x04'}, None)), ('D8:EF:2F:41:B1:34', -72, ('RZSS', [], {}, {}, None)), ('34:AB:95:85:66:6D', -74, ('LOOKin_98F33163', ['00001812-0000-1000-8000-00805f9b34fb'], {}, {}, None))]
2024-01-12 13:47:58.453 WARNING (MainThread) [aioshelly.ble.backend.scanner] parsed_advs: [('74:CD:9C:23:FC:C4', -43, (None, [], {}, {76: b'\x10\x05!\x98_oC'}, 8)), ('24:0B:2A:36:55:4B', -72, (None, [], {}, {76: b'\t\x08\x13\x08\xc0\xa8k[\x1bX'}, None)), ('63:8F:51:DD:CC:0C', -58, (None, [], {}, {76: b'\x13\x0b\x1b|\x02\xa4\xc4_?6\xa1\xbe\x00'}, None)), ('E2:88:93:E1:50:6E', -44, (None, [], {}, {76: b'\x12\x02\x00\x00'}, None)), ('67:AE:22:73:84:52', -55, (None, [], {}, {76: b'\x10\x070\x1f\x08\xcf\n^h'}, 12)), ('F8:04:2E:E1:9F:19', -74, (None, [], {}, {117: b'B\x04\x01\x80\xa0\xf8\x04.\xe1\x9f\x19\xfa\x04.\xe1\x9f\x18\x01\x00\x00\x00\x00\x00\x00'}, None))]
2024-01-12 13:47:59.516 WARNING (MainThread) [aioshelly.ble.backend.scanner] parsed_advs: [('D1:4B:33:1F:0A:FD', -69, (None, [], {}, {2409: b'\xd1K3\x1f\n\xfd?\x1dd\x11\x04'}, None)), ('68:60:7C:2F:C1:1B', -76, (None, [], {}, {76: b'\t\x08\x13\xc5\xc0\xa8k~\x1bX\x16\x08\x00\xe8\xad\x12\xca\xfeIW'}, None)), ('F1:D0:17:BA:C6:A2', -75, ('Nanoleaf Strip 3B32', [], {}, {}, None)), ('34:AB:95:85:6E:F9', -68, ('LOOKin_98F330B4', ['00001812-0000-1000-8000-00805f9b34fb'], {}, {}, None)), ('5A:DB:5D:53:1E:84', -48, (None, [], {}, {76: b'\x0c\x0e\x08\xd9\\,\xe0\x91\x94\x9a\xf2^\xf5F\xd8\xf8\x10\x06A\x1dR\xdf\xe9\x18'}, None)), ('6A:1D:DC:AD:36:E2', -47, (None, [], {}, {76: b'\x0c\x0e\x08\xd9\\,\xe0\x91\x94\x9a\xf2^\xf5F\xd8\xf8\x10\x06A\x1dR\xdf\xe9\x18'}, None)), ('CC:32:37:35:4E:05', -59, ('GVH5106_4E05', ['0000ec88-0000-1000-8000-00805f9b34fb'], {}, {1: b'\x01\x01\x0e\xa3s\xa8'}, None))]
2024-01-12 13:48:00.364 WARNING (MainThread) [aioshelly.ble.backend.scanner] parsed_advs: [('C0:95:6D:53:56:AD', -71, (None, [], {}, {76: b'\x10\x05\n\x14\x84\xfa\xce'}, 12)), ('7A:56:85:6A:6D:CD', -60, (None, ['0000fe07-0000-1000-8000-00805f9b34fb'], {}, {1447: b'\x05\x10\x01\x00\x00\x00\x00\x00\x00\x02#\x00\xca'}, 9)), ('6A:1D:DC:AD:36:E2', -42, (None, [], {}, {76: b'\x0c\x0e\x08\xda\\h\xab\xfd\x9f\xd7YcF_\xe3\x08\x10\x06A\x1dR\xdf\xe9\x18'}, None)), ('5A:DB:5D:53:1E:84', -42, (None, [], {}, {76: b'\x0c\x0e\x08\xda\\h\xab\xfd\x9f\xd7YcF_\xe3\x08\x10\x06A\x1dR\xdf\xe9\x18'}, None))]
2024-01-12 13:48:01.107 WARNING (MainThread) [aioshelly.ble.backend.scanner] parsed_advs: [('D4:B2:A1:7C:42:17', -71, ('RZSS', [], {}, {}, None)), ('FC:EE:36:CF:93:95', -71, (None, [], {}, {2409: b'\xfc\xee6\xcf\x93\x95\x13\x1fd\x12\x04'}, None)), ('34:AB:95:85:66:6D', -71, ('LOOKin_98F33163', ['00001812-0000-1000-8000-00805f9b34fb'], {}, {}, None)), ('55:F2:94:5F:18:42', -37, (None, [], {}, {76: b'\t\x08\x13\xf1\xc0\xa8k\xbd\x1bX\x16\x08\x00\xda-\xed\xdd%h\\'}, None))]
2024-01-12 13:48:01.670 WARNING (MainThread) [aioshelly.ble.backend.scanner] parsed_advs: [('CC:32:37:35:4E:05', -59, ('GVH5106_4E05', ['0000ec88-0000-1000-8000-00805f9b34fb'], {}, {1: b'\x01\x01\x0e\x94-\x80'}, None)), ('D8:EF:2F:41:B1:34', -70, ('RZSS', [], {}, {}, None)), ('74:CD:9C:23:FC:C4', -52, (None, [], {}, {76: b'\x10\x05!\x98_oC'}, 8)), ('63:8F:51:DD:CC:0C', -45, (None, [], {}, {76: b'\x13\x0b\x1b|\x02\xa4\xc4_?6\xa1\xbe\x00'}, None))]
It seems to work ok to go to 16
diagnostics look good overnight |
Retesting with the above timing tweaks. We can revert them if needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested for several hours and works without problems, thanks 👍
Thanks @taulfsime We will get this shipped in 2024.2.x |
In this script version, a queue is established to store packets, and a timer is employed to flush the queue.
Additionally, it addresses the issue where the device owns the scan process, but the script attempts to initiate a new one, which causes the script to not work.