From c525b33d4466a15275745e3641cbb205f40cfdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 22 Dec 2025 15:07:50 +0100 Subject: [PATCH] Mennekes: Update EV charger interface and add full charging current resolution --- mennekes/integrationpluginmennekes.cpp | 10 +++++----- mennekes/integrationpluginmennekes.json | 9 ++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mennekes/integrationpluginmennekes.cpp b/mennekes/integrationpluginmennekes.cpp index b854dd8..df1d530 100644 --- a/mennekes/integrationpluginmennekes.cpp +++ b/mennekes/integrationpluginmennekes.cpp @@ -320,8 +320,8 @@ void IntegrationPluginMennekes::executeAction(ThingActionInfo *info) if (info->action().actionTypeId() == amtronECUPowerActionTypeId) { bool power = info->action().paramValue(amtronECUPowerActionPowerParamTypeId).toBool(); - int maxChargingCurrent = info->thing()->stateValue(amtronECUMaxChargingCurrentStateTypeId).toUInt(); - int effectiveCurrent = power ? maxChargingCurrent : 0; + double maxChargingCurrent = info->thing()->stateValue(amtronECUMaxChargingCurrentStateTypeId).toDouble(); + int effectiveCurrent = power ? qRound(maxChargingCurrent) : 0; qCInfo(dcMennekes()) << "Executing power action:" << power << "max current:" << maxChargingCurrent << "-> effective current" << effectiveCurrent; QModbusReply *reply = amtronECUConnection->setHemsCurrentLimit(effectiveCurrent); if (!reply) { @@ -344,7 +344,7 @@ void IntegrationPluginMennekes::executeAction(ThingActionInfo *info) if (info->action().actionTypeId() == amtronECUMaxChargingCurrentActionTypeId) { bool power = info->thing()->stateValue(amtronECUPowerStateTypeId).toBool(); - int maxChargingCurrent = info->action().paramValue(amtronECUMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toInt(); + int maxChargingCurrent = qRound(info->action().paramValue(amtronECUMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble()); int effectiveCurrent = power ? maxChargingCurrent : 0; qCInfo(dcMennekes()) << "Executing max current action:" << maxChargingCurrent << "Power is" << power << "-> effective:" << effectiveCurrent; QModbusReply *reply = amtronECUConnection->setHemsCurrentLimit(effectiveCurrent); @@ -443,8 +443,8 @@ void IntegrationPluginMennekes::executeAction(ThingActionInfo *info) }); } if (info->action().actionTypeId() == amtronCompact20MaxChargingCurrentActionTypeId) { - int maxChargingCurrent = info->action().paramValue(amtronCompact20MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toInt(); - float value = maxChargingCurrent; + double maxChargingCurrent = info->action().paramValue(amtronCompact20MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble(); + float value = static_cast(maxChargingCurrent); // Note: in firmwares up to 1.0.2 there's an issue that it cannot be exactly 6A, must be 6.01 or so if (maxChargingCurrent == 6) { diff --git a/mennekes/integrationpluginmennekes.json b/mennekes/integrationpluginmennekes.json index bd3057f..2a644f6 100644 --- a/mennekes/integrationpluginmennekes.json +++ b/mennekes/integrationpluginmennekes.json @@ -107,10 +107,11 @@ "name": "maxChargingCurrent", "displayName": "Maximum charging current", "displayNameAction": "Set maximum charging current", - "type": "uint", + "type": "double", "unit": "Ampere", "minValue": 6, "maxValue": 32, + "stepSize": 1.0, "defaultValue": 6, "writable": true }, @@ -244,10 +245,11 @@ "displayName": "Maximum charging current", "displayNameEvent": "Maximum charging current changed", "displayNameAction": "Set maximum charging current", - "type": "uint", + "type": "double", "unit": "Ampere", "minValue": 6, "maxValue": 32, + "stepSize": 1.0, "defaultValue": 6, "writable": true } @@ -360,10 +362,11 @@ "name": "maxChargingCurrent", "displayName": "Maximum charging current", "displayNameAction": "Set maximum charging current", - "type": "uint", + "type": "double", "unit": "Ampere", "minValue": 6, "maxValue": 32, + "stepSize": 0.01, "defaultValue": 6, "writable": true },