diff --git a/py_dormakaba_dkey/__init__.py b/py_dormakaba_dkey/__init__.py index 75fb37d..f04404e 100644 --- a/py_dormakaba_dkey/__init__.py +++ b/py_dormakaba_dkey/__init__.py @@ -4,10 +4,11 @@ from . import errors from .commands import Notifications -from .dkey import DKEYLock +from .dkey import DKEYLock, device_filter __all__ = [ "DKEYLock", "Notifications", + "device_filter", "errors", ] diff --git a/py_dormakaba_dkey/dkey.py b/py_dormakaba_dkey/dkey.py index e11e878..b945b92 100644 --- a/py_dormakaba_dkey/dkey.py +++ b/py_dormakaba_dkey/dkey.py @@ -64,6 +64,15 @@ ACTIVATION_CODE_ALLOWED = "BCDFGHJKLMNPQRSTVWXZ0123456789" +def device_filter(advertisement_data: AdvertisementData) -> bool: + """Return True if the device is supported.""" + uuids = advertisement_data.service_uuids + if SERVICE_UUID in uuids or CHARACTERISTIC_UUID_TO_SERVER in uuids: + return True + + return False + + class BaseProcedure(ABC): """Base class for procedures."""