From 175143c2ff625b09cade9a4145ce37e5b574b3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 20 Oct 2021 15:22:07 +0200 Subject: [PATCH] Update state, use curr and update to latest interface --- keba/integrationpluginkeba.cpp | 10 +++------- keba/integrationpluginkeba.json | 28 ++++++---------------------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/keba/integrationpluginkeba.cpp b/keba/integrationpluginkeba.cpp index 837f3bbf..355c4203 100644 --- a/keba/integrationpluginkeba.cpp +++ b/keba/integrationpluginkeba.cpp @@ -280,6 +280,8 @@ void IntegrationPluginKeba::setDeviceState(Thing *thing, KeContact::State state) thing->setStateValue(wallboxActivityStateTypeId, "Authorization rejected"); break; } + + thing->setStateValue(wallboxChargingStateTypeId, state == KeContact::StateCharging); } void IntegrationPluginKeba::setDevicePlugState(Thing *thing, KeContact::PlugState plugState) @@ -421,13 +423,11 @@ void IntegrationPluginKeba::onReportTwoReceived(const KeContact::ReportTwo &repo thing->setStateValue(wallboxError2StateTypeId, reportTwo.error2); thing->setStateValue(wallboxSystemEnabledStateTypeId, reportTwo.enableSys); - thing->setStateValue(wallboxMaxChargingCurrentStateTypeId, reportTwo.currTimer); - thing->setStateValue(wallboxMaxChargingCurrentGeneralStateTypeId, reportTwo.currentUser); + thing->setStateValue(wallboxMaxChargingCurrentStateTypeId, reportTwo.currentUser); thing->setStateValue(wallboxMaxChargingCurrentPercentStateTypeId, reportTwo.maxCurrentPercentage); // Set the state limits according to the hardware limits thing->setStateMaxValue(wallboxMaxChargingCurrentStateTypeId, reportTwo.currentHardwareLimitation); - thing->setStateMaxValue(wallboxMaxChargingCurrentGeneralStateTypeId, reportTwo.currentHardwareLimitation); thing->setStateValue(wallboxOutputX2StateTypeId, reportTwo.output); thing->setStateValue(wallboxInputStateTypeId, reportTwo.input); @@ -462,7 +462,6 @@ void IntegrationPluginKeba::onReportThreeReceived(const KeContact::ReportThree & thing->setStateValue(wallboxCurrentPhase1EventTypeId, reportThree.currentPhase1); thing->setStateValue(wallboxCurrentPhase2EventTypeId, reportThree.currentPhase2); thing->setStateValue(wallboxCurrentPhase3EventTypeId, reportThree.currentPhase3); - thing->setStateValue(wallboxCurrentStateTypeId, reportThree.currentPhase1 + reportThree.currentPhase2 + reportThree.currentPhase3); thing->setStateValue(wallboxVoltagePhase1EventTypeId, reportThree.voltagePhase1); thing->setStateValue(wallboxVoltagePhase2EventTypeId, reportThree.voltagePhase2); thing->setStateValue(wallboxVoltagePhase3EventTypeId, reportThree.voltagePhase3); @@ -579,9 +578,6 @@ void IntegrationPluginKeba::executeAction(ThingActionInfo *info) QUuid requestId; if (action.actionTypeId() == wallboxMaxChargingCurrentActionTypeId) { int milliAmpere = action.param(wallboxMaxChargingCurrentActionMaxChargingCurrentParamTypeId).value().toDouble() * 1000; - requestId = keba->setMaxAmpere(milliAmpere); - } else if(action.actionTypeId() == wallboxMaxChargingCurrentGeneralActionTypeId) { - int milliAmpere = action.param(wallboxMaxChargingCurrentGeneralActionMaxChargingCurrentGeneralParamTypeId).value().toDouble() * 1000; requestId = keba->setMaxAmpereGeneral(milliAmpere); } else if(action.actionTypeId() == wallboxPowerActionTypeId) { requestId = keba->enableOutput(action.param(wallboxPowerActionTypeId).value().toBool()); diff --git a/keba/integrationpluginkeba.json b/keba/integrationpluginkeba.json index 4caaccca..fe55cd2a 100644 --- a/keba/integrationpluginkeba.json +++ b/keba/integrationpluginkeba.json @@ -128,14 +128,12 @@ "defaultValue": false }, { - "id": "a29c1748-fe97-4830-a56e-e1cc4e618385", - "name": "current", - "displayName": "Current", - "displayNameEvent": "Current changed", - "type": "double", - "unit": "Ampere", - "defaultValue": 0.00, - "suggestLogging": true + "id": "c9785626-2501-478d-8c18-c42ad5d9a269", + "name": "charging", + "displayName": "Charging", + "displayNameEvent": "Charging changed", + "type": "bool", + "defaultValue": false }, { "id": "593656f0-babf-4308-8767-68f34e10fb15", @@ -151,20 +149,6 @@ "writable": true, "suggestLogging": true }, - { - "id": "da0cfb97-0b27-4d8f-bdf7-45b1ca727038", - "name": "maxChargingCurrentGeneral", - "displayName": "Maximal general charging current", - "displayNameEvent": "Maximal general charging current changed", - "displayNameAction": "Set maximal general charging current", - "type": "double", - "unit": "Ampere", - "defaultValue": 6.0, - "minValue": 6.0, - "maxValue": 32.0, - "writable": true, - "suggestLogging": true - }, { "id": "3c7b83a0-0e42-47bf-9788-dde6aab5ceea", "name": "maxChargingCurrentPercent",