diff --git a/libnymea-app-core/discovery/bluetoothservicediscovery.cpp b/libnymea-app-core/discovery/bluetoothservicediscovery.cpp index 0dac9d68..9c211465 100644 --- a/libnymea-app-core/discovery/bluetoothservicediscovery.cpp +++ b/libnymea-app-core/discovery/bluetoothservicediscovery.cpp @@ -2,6 +2,8 @@ #include "discoverymodel.h" +#include + BluetoothServiceDiscovery::BluetoothServiceDiscovery(DiscoveryModel *discoveryModel, QObject *parent) : QObject(parent), m_discoveryModel(discoveryModel) @@ -45,7 +47,11 @@ void BluetoothServiceDiscovery::discover() qDebug() << "BluetoothServiceDiscovery: Start scanning for service" << m_nymeaServiceUuid.toString(); setDiscovering(true); m_serviceDiscovery->setUuidFilter(m_nymeaServiceUuid); - m_serviceDiscovery->start(QBluetoothServiceDiscoveryAgent::FullDiscovery); + + // Delay restarting as Bluez might not be ready just yet + QTimer::singleShot(500, this, [this]() { + m_serviceDiscovery->start(QBluetoothServiceDiscoveryAgent::FullDiscovery); + }); } void BluetoothServiceDiscovery::stopDiscovery()