Update interfaces and fix units
This commit is contained in:
parent
b039823694
commit
312a9504e4
@ -208,6 +208,8 @@ void IntegrationPluginGoECharger::executeAction(ThingActionInfo *info)
|
||||
} else if (action.actionTypeId() == goeHomeMaxChargingCurrentActionTypeId) {
|
||||
uint maxChargingCurrent = action.paramValue(goeHomeMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt();
|
||||
qCDebug(dcGoECharger()) << "Setting max charging current to" << maxChargingCurrent << "A";
|
||||
// FIXME: check if we can use amx since it is better for pc charging, not all version seen implement amx
|
||||
// Maybe check if the user sets it or a rule / hems logic
|
||||
// Set the allow value
|
||||
QString configuration = QString("amp=%1").arg(maxChargingCurrent);
|
||||
sendActionRequest(thing, info, configuration);
|
||||
@ -318,6 +320,8 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
|
||||
break;
|
||||
}
|
||||
|
||||
thing->setStateValue(goeHomeChargingStateTypeId, carState == CarStateCharging);
|
||||
|
||||
Access accessStatus = static_cast<Access>(statusMap.value("ast").toUInt());
|
||||
switch (accessStatus) {
|
||||
case AccessOpen:
|
||||
@ -350,6 +354,7 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
|
||||
thing->setStateValue(goeHomeUpdateAvailableStateTypeId, (statusMap.value("upd").toUInt() == 0 ? false : true));
|
||||
thing->setStateValue(goeHomeCloudStateTypeId, (statusMap.value("cdi").toUInt() == 0 ? false : true));
|
||||
thing->setStateValue(goeHomeFirmwareVersionStateTypeId, statusMap.value("fwv").toString());
|
||||
// FIXME: check if we can use amx since it is better for pc charging, not all version seen implement this
|
||||
thing->setStateValue(goeHomeMaxChargingCurrentStateTypeId, statusMap.value("amp").toUInt());
|
||||
thing->setStateValue(goeHomeLedBrightnessStateTypeId, statusMap.value("lbr").toUInt());
|
||||
thing->setStateValue(goeHomeLedEnergySaveStateTypeId, statusMap.value("lse").toBool());
|
||||
@ -359,12 +364,12 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
|
||||
uint amaLimit = statusMap.value("ama").toUInt();
|
||||
uint cableLimit = statusMap.value("cbl").toUInt();
|
||||
|
||||
// Set the limit for the max charging amps
|
||||
thing->setStateMaxValue(goeHomeMaxChargingCurrentStateTypeId, qMin(amaLimit, cableLimit));
|
||||
|
||||
thing->setStateValue(goeHomeAbsoluteMaxAmpereStateTypeId, amaLimit);
|
||||
thing->setStateValue(goeHomeCableType2AmpereStateTypeId, cableLimit);
|
||||
|
||||
// Set the limit for the max charging amps
|
||||
thing->setStateMaxValue(goeHomeMaxChargingCurrentStateTypeId, qMin(amaLimit, cableLimit));
|
||||
|
||||
// Parse nrg array
|
||||
QVariantList measurementList = statusMap.value("nrg").toList();
|
||||
if (measurementList.count() >= 1)
|
||||
@ -376,9 +381,9 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
|
||||
if (measurementList.count() >= 3)
|
||||
thing->setStateValue(goeHomeVoltagePhaseCStateTypeId, measurementList.at(2).toUInt());
|
||||
|
||||
if (measurementList.count() >= 5)
|
||||
if (measurementList.count() >= 5) {
|
||||
thing->setStateValue(goeHomeCurrentPhaseAStateTypeId, measurementList.at(4).toUInt() / 10.0);
|
||||
else {
|
||||
} else {
|
||||
thing->setStateValue(goeHomeCurrentPhaseAStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPhaseBStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPhaseCStateTypeId, 0);
|
||||
@ -386,6 +391,7 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseAStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseBStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
|
||||
if (measurementList.count() >= 6) {
|
||||
@ -397,6 +403,7 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseAStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseBStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
|
||||
if (measurementList.count() >= 7) {
|
||||
@ -407,26 +414,37 @@ void IntegrationPluginGoECharger::update(Thing *thing, const QVariantMap &status
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseAStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseBStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
|
||||
if (measurementList.count() >= 8) {
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseAStateTypeId, measurementList.at(7).toUInt() / 10.0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseAStateTypeId, measurementList.at(7).toUInt() * 100.0); // 0.1kW -> W
|
||||
} else {
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseAStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseBStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
|
||||
if (measurementList.count() >= 9) {
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseBStateTypeId, measurementList.at(8).toUInt() / 10.0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseBStateTypeId, measurementList.at(8).toUInt() * 100.0); // 0.1kW -> W
|
||||
} else {
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseBStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
|
||||
if (measurementList.count() >= 10) {
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, measurementList.at(9).toUInt() / 10.0);
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, measurementList.at(9).toUInt() * 100.0); // 0.1kW -> W
|
||||
} else {
|
||||
thing->setStateValue(goeHomeCurrentPowerPhaseCStateTypeId, 0);
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
|
||||
if (measurementList.count() >= 11) {
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, measurementList.at(11).toUInt() * 10.0); // 0.01kW -> W
|
||||
} else {
|
||||
thing->setStateValue(goeHomeCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"displayName": "go-eCharger Home",
|
||||
"id": "3b663d51-fdb5-4944-b409-c07f7933877e",
|
||||
"createMethods": ["Discovery", "User"],
|
||||
"interfaces": ["evcharger", "smartmeterconsumer", "connectable"],
|
||||
"interfaces": ["evcharger", "connectable"],
|
||||
"paramTypes": [
|
||||
{
|
||||
"id": "4342b72c-99d0-41a5-abc6-ea6c1cc1352c",
|
||||
@ -68,6 +68,14 @@
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "48c6cdb8-9fc1-4c14-95df-3e2c62e59361",
|
||||
"name": "charging",
|
||||
"displayName": "Charging",
|
||||
"displayNameEvent": "Charging changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "d80e1ed8-c3ae-4b68-bf86-21b4d7b2b201",
|
||||
"name": "access",
|
||||
@ -175,6 +183,16 @@
|
||||
"defaultValue": 0.0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "4b909ca1-3f62-406a-adc6-9b312e014741",
|
||||
"name": "currentPower",
|
||||
"displayName": "Current power",
|
||||
"displayNameEvent": "Current power changed",
|
||||
"type": "double",
|
||||
"unit": "Watt",
|
||||
"defaultValue": 0.00,
|
||||
"filter": "adaptive"
|
||||
},
|
||||
{
|
||||
"id": "c6f68517-c4cd-415d-9455-b1731f7d9a1a",
|
||||
"name": "currentPowerPhaseA",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user