From af125347d6b244d740a7828d9a0ce0f66fffd871 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 23 Mar 2023 13:00:26 +0100 Subject: [PATCH] If no matching services are found when connecting to a device, default to BLEManager. GATT characteristics are not necessarily exposed as services. --- platypush/plugins/bluetooth/_plugin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platypush/plugins/bluetooth/_plugin.py b/platypush/plugins/bluetooth/_plugin.py index 01880b12..1dcbd04b 100644 --- a/platypush/plugins/bluetooth/_plugin.py +++ b/platypush/plugins/bluetooth/_plugin.py @@ -238,10 +238,9 @@ class BluetoothPlugin(RunnablePlugin, EntityManager): else [srv for srv in device.services if srv.uuid == uuid] ) - assert matching_services, ( - f'No service found on the device {device} for port={port}, ' - f'service_uuid={service_uuid}' - ) + if not matching_services: + # It could be a GATT characteristic, so try BLE + return self._managers[BLEManager] srv = matching_services[0] return (