Improve it a bit more
This commit is contained in:
parent
37081a51bd
commit
5768ebca91
@ -57,18 +57,20 @@ void IntegrationPluginOneWire::discoverThings(ThingDiscoveryInfo *info)
|
|||||||
foreach(Thing *parentDevice, myThings().filterByThingClassId(oneWireInterfaceThingClassId)) {
|
foreach(Thing *parentDevice, myThings().filterByThingClassId(oneWireInterfaceThingClassId)) {
|
||||||
if (parentDevice->stateValue(oneWireInterfaceAutoAddStateTypeId).toBool()) {
|
if (parentDevice->stateValue(oneWireInterfaceAutoAddStateTypeId).toBool()) {
|
||||||
//devices cannot be discovered since auto mode is enabled
|
//devices cannot be discovered since auto mode is enabled
|
||||||
return info->finish(Thing::ThingErrorNoError);
|
continue;
|
||||||
} else {
|
|
||||||
m_runningDiscoveries.insert(parentDevice, info);
|
|
||||||
connect(info, &ThingDiscoveryInfo::destroyed, this, [this, parentDevice](){
|
|
||||||
m_runningDiscoveries.remove(parentDevice);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (m_oneWireInterface)
|
|
||||||
m_oneWireInterface->discoverDevices();
|
|
||||||
}
|
}
|
||||||
|
m_runningDiscoveries.insert(parentDevice, info);
|
||||||
|
connect(info, &ThingDiscoveryInfo::destroyed, this, [this, parentDevice](){
|
||||||
|
m_runningDiscoveries.remove(parentDevice);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (m_oneWireInterface)
|
||||||
|
m_oneWireInterface->discoverDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_runningDiscoveries.isEmpty()) {
|
||||||
|
info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("All configured one wire interfaces are set up to automatically add new devices."));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user