Mennekes: Discard unknown discovery results

master
Michael Zanetti 2023-01-16 12:24:36 +01:00
parent 4fb80af76e
commit 49b7e2a57e
3 changed files with 15 additions and 0 deletions

View File

@ -83,6 +83,11 @@ void AmtronECUDiscovery::checkNetworkDevice(const NetworkDeviceInfo &networkDevi
cleanupConnection(connection);
return;
}
if (connection->firmwareVersion() == 0 || connection->model().isEmpty()) {
qCDebug(dcMennekes()) << "Firmware version or model invalid. Skipping" << networkDeviceInfo.address();
cleanupConnection(connection);
return;
}
Result result;
result.firmwareVersion = connection->firmwareVersion();
result.model = connection->model();

View File

@ -85,6 +85,12 @@ void AmtronHCC3Discovery::checkNetworkDevice(const NetworkDeviceInfo &networkDev
cleanupConnection(connection);
return;
}
if (connection->serialNumber() == 0 || connection->name().isEmpty()) {
qCDebug(dcMennekes()) << "Serial number or name invalid. Skipping" << networkDeviceInfo.address();
cleanupConnection(connection);
return;
}
AmtronDiscoveryResult result;
result.wallboxName = connection->name();
result.serialNumber = connection->serialNumber();

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();
@ -98,6 +101,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...