Switch BLE scanner to active mode — bleak 0.20 passive requires or_patterns on BlueZ
Passive mode fails on Debian bookworm bleak 0.20.2 without or_patterns filter. Active mode is functionally equivalent for building-level presence detection and actually yields more complete advertisement data including device names.
This commit is contained in:
@@ -256,8 +256,8 @@ async def scan_loop():
|
|||||||
|
|
||||||
await on_arrival(name, mac, rssi)
|
await on_arrival(name, mac, rssi)
|
||||||
|
|
||||||
# Passive scanner — no SCAN_REQ packets sent
|
# Active scanner — sends SCAN_REQ to get full advertisement data including device names
|
||||||
async with BleakScanner(detection_callback=detection_callback, scanning_mode="passive") as scanner:
|
async with BleakScanner(detection_callback=detection_callback) as scanner:
|
||||||
try:
|
try:
|
||||||
while not shutdown_event.is_set():
|
while not shutdown_event.is_set():
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user