Fix max charging current if keba retuns 0 for hardware limit

master
Simon Stürz 2021-11-04 13:18:01 +01:00
parent 49e55afefc
commit cd79bb517f
2 changed files with 24 additions and 21 deletions

View File

@ -157,7 +157,7 @@ void IntegrationPluginKeba::setupThing(ThingSetupInfo *info)
thing->setStateValue(wallboxFirmwareStateTypeId, report.firmware);
thing->setStateValue(wallboxSerialnumberStateTypeId, report.serialNumber);
thing->setStateValue(wallboxModelStateTypeId, report.product);
thing->setStateValue(wallboxUptimeStateTypeId, report.seconds/60);
thing->setStateValue(wallboxUptimeStateTypeId, report.seconds / 60);
m_kebaDevices.insert(thing->id(), keba);
info->finish(Thing::ThingErrorNoError);
@ -435,8 +435,12 @@ void IntegrationPluginKeba::onReportTwoReceived(const KeContact::ReportTwo &repo
thing->setStateValue(wallboxMaxChargingCurrentPercentStateTypeId, reportTwo.maxCurrentPercentage);
// Set the state limits according to the hardware limits
thing->setStateMaxValue(wallboxMaxChargingCurrentStateTypeId, reportTwo.currentHardwareLimitation);
if (reportTwo.currentHardwareLimitation > 0) {
thing->setStateMaxValue(wallboxMaxChargingCurrentStateTypeId, reportTwo.currentHardwareLimitation);
} else {
// If we have no limit given, reset to the statetype limit
thing->setStateMaxValue(wallboxMaxChargingCurrentStateTypeId, thing->thingClass().getStateType(wallboxMaxChargingCurrentStateTypeId).maxValue());
}
thing->setStateValue(wallboxOutputX2StateTypeId, reportTwo.output);
thing->setStateValue(wallboxInputStateTypeId, reportTwo.input);

View File

@ -43,22 +43,6 @@
"defaultValue": false,
"cached": false
},
{
"id": "b44bc948-1234-4f87-9a22-bfb6de09df4d",
"name": "error1",
"displayName": "Error 1",
"displayNameEvent": "Error 1 changed",
"type": "int",
"defaultValue": 0
},
{
"id": "afca201a-5213-43fe-bfec-cae6ce7509d2",
"name": "error2",
"displayName": "Error 2",
"displayNameEvent": "Error 2 changed",
"type": "int",
"defaultValue": 0
},
{
"id": "c3fca233-95b9-4948-88c6-4c0f13cf53b1",
"name": "model",
@ -167,8 +151,7 @@
"unit": "Percentage",
"defaultValue": 100,
"minValue": 0,
"maxValue": 100,
"suggestLogging": true
"maxValue": 100
},
{
"id": "4a2d75d8-a3a0-4b40-9ca7-e8b6f11d0ef9",
@ -310,6 +293,22 @@
"unit": "Minutes",
"defaultValue": 0
},
{
"id": "b44bc948-1234-4f87-9a22-bfb6de09df4d",
"name": "error1",
"displayName": "Error 1",
"displayNameEvent": "Error 1 changed",
"type": "int",
"defaultValue": 0
},
{
"id": "afca201a-5213-43fe-bfec-cae6ce7509d2",
"name": "error2",
"displayName": "Error 2",
"displayNameEvent": "Error 2 changed",
"type": "int",
"defaultValue": 0
},
{
"id": "f1758c5c-2c02-41cb-93ec-b778a3c78d28",
"name": "failsafeMode",