Merge PR #102: Mennekes: Add firmware version check and workaround erraneously signalled 0A max

This commit is contained in:
jenkins 2023-02-01 12:18:24 +01:00
commit 46b6638841
2 changed files with 27 additions and 7 deletions

View File

@ -398,6 +398,16 @@ void IntegrationPluginMennekes::setupAmtronECUConnection(ThingSetupInfo *info)
}
qCDebug(dcMennekes()) << "Connection init finished successfully" << amtronECUConnection;
QString minimumVersion = "5.22";
if (!ensureAmtronECUVersion(amtronECUConnection, minimumVersion)) {
qCWarning(dcMennekes()) << "Firmware version too old:" << QByteArray::fromHex(QByteArray::number(amtronECUConnection->firmwareVersion(), 16)) << "Minimum required:" << minimumVersion;
hardwareManager()->networkDeviceDiscovery()->unregisterMonitor(monitor);
amtronECUConnection->deleteLater();
info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("The firmware version of this wallbox is too old. Please upgrade the firmware to at least version 5.22."));
return;
}
m_amtronECUConnections.insert(thing, amtronECUConnection);
info->finish(Thing::ThingErrorNoError);
@ -426,8 +436,13 @@ void IntegrationPluginMennekes::setupAmtronECUConnection(ThingSetupInfo *info)
qCDebug(dcMennekes()) << "min current limit changed:" << minCurrentLimit;
thing->setStateMinValue(amtronECUMaxChargingCurrentStateTypeId, minCurrentLimit);
});
connect(amtronECUConnection, &AmtronECUModbusTcpConnection::maxCurrentLimitChanged, thing, [thing](quint16 maxCurrentLimit) {
connect(amtronECUConnection, &AmtronECUModbusTcpConnection::maxCurrentLimitChanged, thing, [this, thing](quint16 maxCurrentLimit) {
qCDebug(dcMennekes()) << "max current limit changed:" << maxCurrentLimit;
// If the vehicle or cable are not capable of reporting the maximum, this will be 0
// We'll reset to the max defined in the json file in that case
if (maxCurrentLimit == 0) {
maxCurrentLimit = supportedThings().findById(amtronECUThingClassId).stateTypes().findById(amtronECUMaxChargingCurrentStateTypeId).maxValue().toUInt();
}
thing->setStateMaxValue(amtronECUMaxChargingCurrentStateTypeId, maxCurrentLimit);
});
connect(amtronECUConnection, &AmtronECUModbusTcpConnection::hemsCurrentLimitChanged, thing, [thing](quint16 hemsCurrentLimit) {

View File

@ -9,23 +9,28 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../integrationpluginmennekes.cpp" line="127"/>
<location filename="../integrationpluginmennekes.cpp" line="177"/>
<location filename="../integrationpluginmennekes.cpp" line="133"/>
<location filename="../integrationpluginmennekes.cpp" line="183"/>
<source>The MAC address is not known. Please reconfigure the thing.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../integrationpluginmennekes.cpp" line="138"/>
<location filename="../integrationpluginmennekes.cpp" line="188"/>
<location filename="../integrationpluginmennekes.cpp" line="144"/>
<location filename="../integrationpluginmennekes.cpp" line="194"/>
<source>The host address is not known yet. Trying later again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../integrationpluginmennekes.cpp" line="372"/>
<location filename="../integrationpluginmennekes.cpp" line="497"/>
<location filename="../integrationpluginmennekes.cpp" line="387"/>
<location filename="../integrationpluginmennekes.cpp" line="515"/>
<source>Error communicating with the wallbox.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../integrationpluginmennekes.cpp" line="398"/>
<source>The firmware version of this wallbox is too old. Please upgrade the firmware to at least version 5.22.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Mennekes</name>