Merge PR #107: Mennekes: Discard unknown discovery results

master
jenkins 2023-01-17 16:38:03 +01:00
commit 806cbfe117
1 changed files with 9 additions and 0 deletions

View File

@ -61,6 +61,9 @@ void IntegrationPluginMennekes::discoverThings(ThingDiscoveryInfo *info)
name = "AMTRON Charge Control";
} else if (result.model.startsWith("P")) {
name = "AMTRON Professional";
} else {
qCWarning(dcMennekes()) << "Unknown Amtron model:" << result.model;
continue;
}
ThingDescriptor descriptor(amtronECUThingClassId, name, description);
qCDebug(dcMennekes()) << "Discovered:" << descriptor.title() << descriptor.description();
@ -88,6 +91,11 @@ void IntegrationPluginMennekes::discoverThings(ThingDiscoveryInfo *info)
connect(discovery, &AmtronHCC3Discovery::discoveryFinished, info, [=](){
foreach (const AmtronHCC3Discovery::AmtronDiscoveryResult &result, discovery->discoveryResults()) {
if (result.serialNumber.isEmpty()) {
qCWarning(dcMennekes()) << "Unable to read Amtron serial number:" << result.serialNumber << result.wallboxName;
continue;
}
ThingDescriptor descriptor(amtronHCC3ThingClassId, result.wallboxName, "Serial: " + result.serialNumber + " - " + result.networkDeviceInfo.address().toString());
qCDebug(dcMennekes()) << "Discovered:" << descriptor.title() << descriptor.description();
@ -98,6 +106,7 @@ void IntegrationPluginMennekes::discoverThings(ThingDiscoveryInfo *info)
descriptor.setThingId(existingThings.first()->id());
}
ParamList params;
params << Param(amtronHCC3ThingMacAddressParamTypeId, result.networkDeviceInfo.macAddress());
// Note: if we discover also the port and modbusaddress, we must fill them in from the discovery here, for now everywhere the defaults...