Merge PR #107: Mennekes: Discard unknown discovery results
commit
806cbfe117
|
|
@ -61,6 +61,9 @@ void IntegrationPluginMennekes::discoverThings(ThingDiscoveryInfo *info)
|
||||||
name = "AMTRON Charge Control";
|
name = "AMTRON Charge Control";
|
||||||
} else if (result.model.startsWith("P")) {
|
} else if (result.model.startsWith("P")) {
|
||||||
name = "AMTRON Professional";
|
name = "AMTRON Professional";
|
||||||
|
} else {
|
||||||
|
qCWarning(dcMennekes()) << "Unknown Amtron model:" << result.model;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
ThingDescriptor descriptor(amtronECUThingClassId, name, description);
|
ThingDescriptor descriptor(amtronECUThingClassId, name, description);
|
||||||
qCDebug(dcMennekes()) << "Discovered:" << descriptor.title() << descriptor.description();
|
qCDebug(dcMennekes()) << "Discovered:" << descriptor.title() << descriptor.description();
|
||||||
|
|
@ -88,6 +91,11 @@ void IntegrationPluginMennekes::discoverThings(ThingDiscoveryInfo *info)
|
||||||
connect(discovery, &AmtronHCC3Discovery::discoveryFinished, info, [=](){
|
connect(discovery, &AmtronHCC3Discovery::discoveryFinished, info, [=](){
|
||||||
foreach (const AmtronHCC3Discovery::AmtronDiscoveryResult &result, discovery->discoveryResults()) {
|
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());
|
ThingDescriptor descriptor(amtronHCC3ThingClassId, result.wallboxName, "Serial: " + result.serialNumber + " - " + result.networkDeviceInfo.address().toString());
|
||||||
qCDebug(dcMennekes()) << "Discovered:" << descriptor.title() << descriptor.description();
|
qCDebug(dcMennekes()) << "Discovered:" << descriptor.title() << descriptor.description();
|
||||||
|
|
||||||
|
|
@ -98,6 +106,7 @@ void IntegrationPluginMennekes::discoverThings(ThingDiscoveryInfo *info)
|
||||||
descriptor.setThingId(existingThings.first()->id());
|
descriptor.setThingId(existingThings.first()->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ParamList params;
|
ParamList params;
|
||||||
params << Param(amtronHCC3ThingMacAddressParamTypeId, result.networkDeviceInfo.macAddress());
|
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...
|
// Note: if we discover also the port and modbusaddress, we must fill them in from the discovery here, for now everywhere the defaults...
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue