Finish thing setup immediatly and update state after initial ping
This commit is contained in:
parent
2a0fbe90f8
commit
0f968d4beb
@ -127,6 +127,7 @@ void IntegrationPluginNetworkDetector::setupThing(ThingSetupInfo *info)
|
|||||||
|
|
||||||
NetworkDeviceMonitor *monitor = hardwareManager()->networkDeviceDiscovery()->registerMonitor(macAddress);
|
NetworkDeviceMonitor *monitor = hardwareManager()->networkDeviceDiscovery()->registerMonitor(macAddress);
|
||||||
m_monitors.insert(thing, monitor);
|
m_monitors.insert(thing, monitor);
|
||||||
|
info->finish(Thing::ThingErrorNoError);
|
||||||
|
|
||||||
QHostAddress cachedAddress;
|
QHostAddress cachedAddress;
|
||||||
if (!monitor->networkDeviceInfo().address().isNull()) {
|
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 the address is not known yet, let the monitor do the work and finish the setup...
|
||||||
if (cachedAddress.isNull()) {
|
if (cachedAddress.isNull()) {
|
||||||
setupMonitorConnections(thing, monitor);
|
setupMonitorConnections(thing, monitor);
|
||||||
info->finish(Thing::ThingErrorNoError);
|
|
||||||
thing->setStateValue(networkDeviceIsPresentStateTypeId, monitor->reachable());
|
thing->setStateValue(networkDeviceIsPresentStateTypeId, monitor->reachable());
|
||||||
return;
|
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...
|
// However the ping result is, the monitor has catched up internally with the reachable state...
|
||||||
|
|
||||||
info->finish(Thing::ThingErrorNoError);
|
|
||||||
|
|
||||||
if (!monitor->networkDeviceInfo().address().isNull())
|
if (!monitor->networkDeviceInfo().address().isNull())
|
||||||
thing->setStateValue(networkDeviceAddressStateTypeId, monitor->networkDeviceInfo().address().toString());
|
thing->setStateValue(networkDeviceAddressStateTypeId, monitor->networkDeviceInfo().address().toString());
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user