From 0f968d4beb2d06da07e0518efc83d02c31881530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 4 May 2022 11:10:06 +0200 Subject: [PATCH] Finish thing setup immediatly and update state after initial ping --- networkdetector/integrationpluginnetworkdetector.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/networkdetector/integrationpluginnetworkdetector.cpp b/networkdetector/integrationpluginnetworkdetector.cpp index 41f7cfc3..e3ef7327 100644 --- a/networkdetector/integrationpluginnetworkdetector.cpp +++ b/networkdetector/integrationpluginnetworkdetector.cpp @@ -127,6 +127,7 @@ void IntegrationPluginNetworkDetector::setupThing(ThingSetupInfo *info) NetworkDeviceMonitor *monitor = hardwareManager()->networkDeviceDiscovery()->registerMonitor(macAddress); m_monitors.insert(thing, monitor); + info->finish(Thing::ThingErrorNoError); QHostAddress cachedAddress; if (!monitor->networkDeviceInfo().address().isNull()) { @@ -138,7 +139,6 @@ void IntegrationPluginNetworkDetector::setupThing(ThingSetupInfo *info) // If the address is not known yet, let the monitor do the work and finish the setup... if (cachedAddress.isNull()) { setupMonitorConnections(thing, monitor); - info->finish(Thing::ThingErrorNoError); thing->setStateValue(networkDeviceIsPresentStateTypeId, monitor->reachable()); return; } @@ -152,8 +152,6 @@ void IntegrationPluginNetworkDetector::setupThing(ThingSetupInfo *info) // However the ping result is, the monitor has catched up internally with the reachable state... - info->finish(Thing::ThingErrorNoError); - if (!monitor->networkDeviceInfo().address().isNull()) thing->setStateValue(networkDeviceAddressStateTypeId, monitor->networkDeviceInfo().address().toString());