From 178c16c967443495a838a47eb8ce538729b26a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Mon, 22 Dec 2025 16:54:26 +0100 Subject: [PATCH] Keba: Update EV charger interface and add full charging current resolution --- keba/integrationpluginkeba.cpp | 12 ++++++------ keba/integrationpluginkeba.json | 6 ++++-- keba/kecontact.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/keba/integrationpluginkeba.cpp b/keba/integrationpluginkeba.cpp index 8f5773a7..2f7e9f76 100644 --- a/keba/integrationpluginkeba.cpp +++ b/keba/integrationpluginkeba.cpp @@ -281,7 +281,7 @@ void IntegrationPluginKeba::executeAction(ThingActionInfo *info) QUuid requestId; if (thing->thingClassId() == kebaThingClassId) { if (action.actionTypeId() == kebaMaxChargingCurrentActionTypeId) { - int milliAmpere = action.paramValue(kebaMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt() * 1000; + int milliAmpere = qRound(action.paramValue(kebaMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble() * 1000); requestId = keba->setMaxAmpereGeneral(milliAmpere); } else if (action.actionTypeId() == kebaPowerActionTypeId) { requestId = keba->enableOutput(action.param(kebaPowerActionTypeId).value().toBool()); @@ -302,7 +302,7 @@ void IntegrationPluginKeba::executeAction(ThingActionInfo *info) } else if (thing->thingClassId() == kebaSimpleThingClassId) { if (action.actionTypeId() == kebaSimpleMaxChargingCurrentActionTypeId) { - int milliAmpere = action.paramValue(kebaSimpleMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt() * 1000; + int milliAmpere = qRound(action.paramValue(kebaSimpleMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble() * 1000); requestId = keba->setMaxAmpereGeneral(milliAmpere); } else if (action.actionTypeId() == kebaSimplePowerActionTypeId) { requestId = keba->enableOutput(action.param(kebaSimplePowerActionTypeId).value().toBool()); @@ -481,7 +481,7 @@ void IntegrationPluginKeba::onCommandExecuted(QUuid requestId, bool success) if (thing->thingClassId() == kebaThingClassId) { // Set the value to the state so we don't have to wait for the report 2 response if (info->action().actionTypeId() == kebaMaxChargingCurrentActionTypeId) { - uint value = info->action().paramValue(kebaMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt(); + double value = info->action().paramValue(kebaMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble(); info->thing()->setStateValue("maxChargingCurrent", value); } else if (info->action().actionTypeId() == kebaPowerActionTypeId) { info->thing()->setStateValue("power", info->action().paramValue(kebaPowerActionTypeId).toBool()); @@ -489,7 +489,7 @@ void IntegrationPluginKeba::onCommandExecuted(QUuid requestId, bool success) } else if (thing->thingClassId() == kebaSimpleThingClassId) { // Set the value to the state so we don't have to wait for the report 2 response if (info->action().actionTypeId() == kebaSimpleMaxChargingCurrentActionTypeId) { - uint value = info->action().paramValue(kebaSimpleMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt(); + double value = info->action().paramValue(kebaSimpleMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble(); info->thing()->setStateValue("maxChargingCurrent", value); } else if (info->action().actionTypeId() == kebaPowerActionTypeId) { info->thing()->setStateValue("power", info->action().paramValue(kebaSimplePowerActionTypeId).toBool()); @@ -598,7 +598,7 @@ void IntegrationPluginKeba::onReportTwoReceived(const KeContact::ReportTwo &repo qCDebug(dcKeba()) << " - Output:" << reportTwo.output; qCDebug(dcKeba()) << " - Input:" << reportTwo.input; qCDebug(dcKeba()) << " - Serial number:" << reportTwo.serialNumber; - qCDebug(dcKeba()) << " - Uptime:" << reportTwo.seconds/60 << "[min]"; + qCDebug(dcKeba()) << " - Uptime:" << reportTwo.seconds / 60 << "[min]"; if (reportTwo.serialNumber == thing->paramValue(m_serialNumberParamTypeIds.value(thing->thingClassId())).toString()) { setDeviceState(thing, reportTwo.state); @@ -609,7 +609,7 @@ void IntegrationPluginKeba::onReportTwoReceived(const KeContact::ReportTwo &repo thing->setStateValue("error2", reportTwo.error2); thing->setStateValue("systemEnabled", reportTwo.enableSys); - thing->setStateValue("maxChargingCurrent", qRound(reportTwo.currentUser)); + thing->setStateValue("maxChargingCurrent", reportTwo.currentUser); thing->setStateValue("maxChargingCurrentPercent", reportTwo.maxCurrentPercentage); thing->setStateValue("maxChargingCurrentHardware", reportTwo.currentHardwareLimitation); diff --git a/keba/integrationpluginkeba.json b/keba/integrationpluginkeba.json index 311fe639..77f9dddd 100644 --- a/keba/integrationpluginkeba.json +++ b/keba/integrationpluginkeba.json @@ -136,11 +136,12 @@ "displayName": "Maximal charging current", "displayNameEvent": "Maximal charging current changed", "displayNameAction": "Set maximal charging current", - "type": "uint", + "type": "double", "unit": "Ampere", "defaultValue": 6, "minValue": 6, "maxValue": 32, + "stepSize": 0.001, "writable": true, "suggestLogging": true }, @@ -549,11 +550,12 @@ "displayName": "Maximal charging current", "displayNameEvent": "Maximal charging current changed", "displayNameAction": "Set maximal charging current", - "type": "uint", + "type": "double", "unit": "Ampere", "defaultValue": 6, "minValue": 6, "maxValue": 32, + "stepSize": 0.001, "writable": true, "suggestLogging": true }, diff --git a/keba/kecontact.h b/keba/kecontact.h index 7f5599b9..39871067 100644 --- a/keba/kecontact.h +++ b/keba/kecontact.h @@ -130,7 +130,7 @@ public: double maxCurrent; //Current preset value via Control pilot in ampere. double maxCurrentPercentage; //Current preset value via Control pilot in 0,1% of the PWM value double currentHardwareLimitation; //Highest possible charging current of the charging connection. Contains device maximum, DIP-switch setting, cable coding and temperature reduction. - double currentUser; //Current preset value of the user via UDP; Default = 63000mA. + double currentUser; //Current preset value of the user via UDP; A. double currentFailsafe; //Current preset value for the Failsafe function. int timeoutFailsafe; //Communication timeout before triggering the Failsafe function. int currTimer; //Shows the current preset value of currtime.