Fix go-eCharger discovery
This commit is contained in:
parent
24a7ce13be
commit
a690689ab8
@ -58,13 +58,13 @@ void IntegrationPluginGoECharger::discoverThings(ThingDiscoveryInfo *info)
|
|||||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
||||||
foreach (const NetworkDevice &networkDevice, discoveryReply->networkDevices()) {
|
foreach (const NetworkDevice &networkDevice, discoveryReply->networkDevices()) {
|
||||||
|
|
||||||
qCDebug(dcGoECharger()) << "Found" << networkDevice;
|
qCDebug(dcGoECharger()) << "Checking discovered" << networkDevice;
|
||||||
// Filter by hostname
|
// Filter by hostname
|
||||||
if (!networkDevice.hostName().toLower().contains("go-echarger"))
|
if (!networkDevice.hostName().toLower().contains("go-echarger"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// We need also the mac address
|
// We need also the mac address
|
||||||
if (!networkDevice.macAddress().isEmpty())
|
if (networkDevice.macAddress().isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
@ -90,7 +90,7 @@ void IntegrationPluginGoECharger::discoverThings(ThingDiscoveryInfo *info)
|
|||||||
// Check if we already have set up this device
|
// Check if we already have set up this device
|
||||||
Things existingThings = myThings().filterByParam(goeHomeThingMacAddressParamTypeId, networkDevice.macAddress());
|
Things existingThings = myThings().filterByParam(goeHomeThingMacAddressParamTypeId, networkDevice.macAddress());
|
||||||
if (existingThings.count() == 1) {
|
if (existingThings.count() == 1) {
|
||||||
qCDebug(dcGoECharger()) << "This go-eCharger already exists in the system!" << networkDevice;
|
qCDebug(dcGoECharger()) << "This go-eCharger already exists in the system" << networkDevice;
|
||||||
descriptor.setThingId(existingThings.first()->id());
|
descriptor.setThingId(existingThings.first()->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user