Exclude more noisy BLE beacons.

Excluding Apple iBeacons and devices with no name and no services.
This commit is contained in:
Fabio Manganiello 2023-04-25 16:19:11 +02:00
parent 99382e4505
commit cb288deb71
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -191,6 +191,10 @@ class EventHandler:
""" """
Check if the beacon received from the given device should be skipped. Check if the beacon received from the given device should be skipped.
""" """
# Exclude Apple iBeacons
if device.manufacturer == 'Apple, Inc.' and device.model == 'iBeacon':
return True
# "Noisy" beacon devices usually have no associated friendly name. If a # "Noisy" beacon devices usually have no associated friendly name. If a
# device has a valid name, we should probably include it. # device has a valid name, we should probably include it.
if ( if (
@ -206,6 +210,10 @@ class EventHandler:
): ):
return True return True
# If the device has no children and no manufacturer, skip it
if not (device.children and device.manufacturer):
return True
# If the device has any children other than services, don't skip it # If the device has any children other than services, don't skip it
if any(not isinstance(child, BluetoothService) for child in device.children): if any(not isinstance(child, BluetoothService) for child in device.children):
return False return False