Add phase count state according to updated evcharger interface

master
Simon Stürz 2021-10-22 12:34:53 +02:00
parent 94be751d24
commit f7fde95e76
2 changed files with 30 additions and 1 deletions

View File

@ -458,6 +458,26 @@ void IntegrationPluginKeba::onReportThreeReceived(const KeContact::ReportThree &
qCDebug(dcKeba()) << " - Serial number" << reportThree.serialNumber;
qCDebug(dcKeba()) << " - Uptime" << reportThree.seconds/60 << "[min]";
// Check how many phases are connected
if (reportThree.voltagePhase1 == 0 && reportThree.voltagePhase2 == 0 && reportThree.voltagePhase3 == 0) {
// Note: if not charging, all voltage values are 0, only set the phase count if any voltage gets reported.
} else {
uint phaseCount = 0;
if (reportThree.voltagePhase1 > 0) {
phaseCount += 1;
}
if (reportThree.voltagePhase2 > 0) {
phaseCount += 1;
}
if (reportThree.voltagePhase3 > 0) {
phaseCount += 1;
}
thing->setStateValue(wallboxPhaseCountStateTypeId, phaseCount);
}
if (reportThree.serialNumber == thing->stateValue(wallboxSerialnumberStateTypeId).toString()) {
thing->setStateValue(wallboxCurrentPhaseAEventTypeId, reportThree.currentPhase1);
thing->setStateValue(wallboxCurrentPhaseBEventTypeId, reportThree.currentPhase2);

View File

@ -83,7 +83,6 @@
"type": "QString",
"defaultValue": ""
},
{
"id": "83ed0774-2a91-434d-b03c-d920d02f2981",
"name": "power",
@ -103,6 +102,16 @@
"type": "bool",
"defaultValue": false
},
{
"id": "6713b2e7-41b3-4596-a304-3065726bdbe4",
"name": "phaseCount",
"displayName": "Number of connected phases",
"displayNameEvent": "Number of connected phases changed",
"type": "uint",
"minValue": 1,
"maxValue": 3,
"defaultValue": 1
},
{
"id": "539e5602-6dd9-465d-9705-3bb59bcf8982",
"name": "activity",