Merge PR #225: Update EV charger interface and add full charging current resolution
This commit is contained in:
commit
5d14f3a932
@ -201,7 +201,7 @@ void IntegrationPluginAmperfied::executeAction(ThingActionInfo *info)
|
||||
|
||||
if (info->action().actionTypeId() == energyControlPowerActionTypeId) {
|
||||
bool power = info->action().paramValue(energyControlPowerActionPowerParamTypeId).toBool();
|
||||
ModbusRtuReply *reply = connection->setChargingCurrent(power ? info->thing()->stateValue(energyControlMaxChargingCurrentStateTypeId).toUInt() * 10 : 0);
|
||||
ModbusRtuReply *reply = connection->setChargingCurrent(power ? static_cast<quint16>(qRound(info->thing()->stateValue(energyControlMaxChargingCurrentStateTypeId).toDouble() * 10)) : 0);
|
||||
connect(reply, &ModbusRtuReply::finished, info, [info, reply, power](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
info->thing()->setStateValue(energyControlPowerStateTypeId, power);
|
||||
@ -216,11 +216,11 @@ void IntegrationPluginAmperfied::executeAction(ThingActionInfo *info)
|
||||
|
||||
if (info->action().actionTypeId() == energyControlMaxChargingCurrentActionTypeId) {
|
||||
bool power = info->thing()->stateValue(energyControlPowerStateTypeId).toBool();
|
||||
uint max = info->action().paramValue(energyControlMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt() * 10;
|
||||
ModbusRtuReply *reply = connection->setChargingCurrent(power ? max : 0);
|
||||
connect(reply, &ModbusRtuReply::finished, info, [info, reply, max](){
|
||||
double current = qRound(info->action().paramValue(energyControlMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble() * 10) / 10.0;
|
||||
ModbusRtuReply *reply = connection->setChargingCurrent(power ? static_cast<quint16>(qRound(current * 10)) : 0);
|
||||
connect(reply, &ModbusRtuReply::finished, info, [info, reply, current](){
|
||||
if (reply->error() == ModbusRtuReply::NoError) {
|
||||
info->thing()->setStateValue(energyControlMaxChargingCurrentStateTypeId, max / 10);
|
||||
info->thing()->setStateValue(energyControlMaxChargingCurrentStateTypeId, current);
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
} else {
|
||||
qCWarning(dcAmperfied()) << "Error setting power:" << reply->error() << reply->errorString();
|
||||
@ -241,8 +241,8 @@ void IntegrationPluginAmperfied::executeAction(ThingActionInfo *info)
|
||||
|
||||
if (actionType.name() == "power") {
|
||||
bool power = info->action().paramValue(actionType.paramTypes().findByName("power").id()).toBool();
|
||||
uint max = info->thing()->stateValue("maxChargingCurrent").toUInt();
|
||||
QModbusReply *reply = connection->setChargingCurrent(power ? max * 10 : 0);
|
||||
double current = info->thing()->stateValue("maxChargingCurrent").toDouble();
|
||||
QModbusReply *reply = connection->setChargingCurrent(power ? static_cast<quint16>(qRound(current * 10)) : 0);
|
||||
connect(reply, &QModbusReply::finished, info, [info, reply, power](){
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
info->thing()->setStateValue("power", power);
|
||||
@ -254,11 +254,11 @@ void IntegrationPluginAmperfied::executeAction(ThingActionInfo *info)
|
||||
});
|
||||
} else if (actionType.name() == "maxChargingCurrent") {
|
||||
bool power = info->thing()->stateValue("power").toBool();
|
||||
uint max = info->action().paramValue(actionType.paramTypes().findByName("maxChargingCurrent").id()).toUInt();
|
||||
QModbusReply *reply = connection->setChargingCurrent(power ? max * 10 : 0);
|
||||
connect(reply, &QModbusReply::finished, info, [info, reply, max](){
|
||||
double current = info->action().paramValue(actionType.paramTypes().findByName("maxChargingCurrent").id()).toDouble();
|
||||
QModbusReply *reply = connection->setChargingCurrent(power ?static_cast<quint16>(qRound(current * 10)): 0);
|
||||
connect(reply, &QModbusReply::finished, info, [info, reply, current](){
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
info->thing()->setStateValue("maxChargingCurrent", max / 10);
|
||||
info->thing()->setStateValue("maxChargingCurrent", current);
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
} else {
|
||||
qCWarning(dcAmperfied()) << "Error setting power:" << reply->error() << reply->errorString();
|
||||
@ -357,7 +357,7 @@ void IntegrationPluginAmperfied::setupRtuConnection(ThingSetupInfo *info)
|
||||
thing->setStateValue(energyControlPowerStateTypeId, false);
|
||||
} else {
|
||||
thing->setStateValue(energyControlPowerStateTypeId, true);
|
||||
thing->setStateValue(energyControlMaxChargingCurrentStateTypeId, connection->chargingCurrent() / 10);
|
||||
thing->setStateValue(energyControlMaxChargingCurrentStateTypeId, connection->chargingCurrent() / 10.0);
|
||||
}
|
||||
thing->setStateMinMaxValues(energyControlMaxChargingCurrentStateTypeId, connection->minChargingCurrent(), connection->maxChargingCurrent());
|
||||
thing->setStateValue(energyControlCurrentPowerStateTypeId, connection->currentPower());
|
||||
@ -446,7 +446,7 @@ void IntegrationPluginAmperfied::setupTcpConnection(ThingSetupInfo *info)
|
||||
thing->setStateValue("power", false);
|
||||
} else {
|
||||
thing->setStateValue("power", true);
|
||||
thing->setStateValue("maxChargingCurrent", connection->chargingCurrent() / 10);
|
||||
thing->setStateValue("maxChargingCurrent", connection->chargingCurrent() / 10.0);
|
||||
}
|
||||
thing->setStateMinMaxValues("maxChargingCurrent", connection->minChargingCurrent(), connection->maxChargingCurrent());
|
||||
thing->setStateValue("currentPower", connection->currentPower());
|
||||
|
||||
@ -98,10 +98,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -212,10 +213,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -337,10 +339,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -462,10 +465,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
|
||||
@ -217,7 +217,7 @@ void IntegrationPluginInro::executeAction(ThingActionInfo *info)
|
||||
}
|
||||
|
||||
if (info->action().actionTypeId() == pantaboxMaxChargingCurrentActionTypeId) {
|
||||
quint16 chargingCurrent = info->action().paramValue(pantaboxMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt();
|
||||
quint16 chargingCurrent = static_cast<quint16>(qRound(info->action().paramValue(pantaboxMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble()));
|
||||
qCDebug(dcInro()) << "PANTABOX: Set max charging current" << chargingCurrent << "A";
|
||||
|
||||
QModbusReply *reply = connection->setMaxChargingCurrent(chargingCurrent);
|
||||
|
||||
@ -108,10 +108,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 16,
|
||||
"stepSize": 1.0,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
|
||||
@ -320,8 +320,8 @@ void IntegrationPluginMennekes::executeAction(ThingActionInfo *info)
|
||||
|
||||
if (info->action().actionTypeId() == amtronECUPowerActionTypeId) {
|
||||
bool power = info->action().paramValue(amtronECUPowerActionPowerParamTypeId).toBool();
|
||||
int maxChargingCurrent = info->thing()->stateValue(amtronECUMaxChargingCurrentStateTypeId).toUInt();
|
||||
int effectiveCurrent = power ? maxChargingCurrent : 0;
|
||||
double maxChargingCurrent = info->thing()->stateValue(amtronECUMaxChargingCurrentStateTypeId).toDouble();
|
||||
int effectiveCurrent = power ? qRound(maxChargingCurrent) : 0;
|
||||
qCInfo(dcMennekes()) << "Executing power action:" << power << "max current:" << maxChargingCurrent << "-> effective current" << effectiveCurrent;
|
||||
QModbusReply *reply = amtronECUConnection->setHemsCurrentLimit(effectiveCurrent);
|
||||
if (!reply) {
|
||||
@ -344,7 +344,7 @@ void IntegrationPluginMennekes::executeAction(ThingActionInfo *info)
|
||||
|
||||
if (info->action().actionTypeId() == amtronECUMaxChargingCurrentActionTypeId) {
|
||||
bool power = info->thing()->stateValue(amtronECUPowerStateTypeId).toBool();
|
||||
int maxChargingCurrent = info->action().paramValue(amtronECUMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toInt();
|
||||
int maxChargingCurrent = qRound(info->action().paramValue(amtronECUMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble());
|
||||
int effectiveCurrent = power ? maxChargingCurrent : 0;
|
||||
qCInfo(dcMennekes()) << "Executing max current action:" << maxChargingCurrent << "Power is" << power << "-> effective:" << effectiveCurrent;
|
||||
QModbusReply *reply = amtronECUConnection->setHemsCurrentLimit(effectiveCurrent);
|
||||
@ -443,8 +443,8 @@ void IntegrationPluginMennekes::executeAction(ThingActionInfo *info)
|
||||
});
|
||||
}
|
||||
if (info->action().actionTypeId() == amtronCompact20MaxChargingCurrentActionTypeId) {
|
||||
int maxChargingCurrent = info->action().paramValue(amtronCompact20MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toInt();
|
||||
float value = maxChargingCurrent;
|
||||
double maxChargingCurrent = info->action().paramValue(amtronCompact20MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble();
|
||||
float value = static_cast<float>(maxChargingCurrent);
|
||||
|
||||
// Note: in firmwares up to 1.0.2 there's an issue that it cannot be exactly 6A, must be 6.01 or so
|
||||
if (maxChargingCurrent == 6) {
|
||||
|
||||
@ -107,10 +107,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 1.0,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -244,10 +245,11 @@
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameEvent": "Maximum charging current changed",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 1.0,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
}
|
||||
@ -360,10 +362,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.01,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
|
||||
@ -223,7 +223,7 @@ void IntegrationPluginPcElectric::executeAction(ThingActionInfo *info)
|
||||
|
||||
} else if (info->action().actionTypeId() == ev11MaxChargingCurrentActionTypeId) {
|
||||
|
||||
uint desiredChargingCurrent = info->action().paramValue(ev11MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt();
|
||||
double desiredChargingCurrent = info->action().paramValue(ev11MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble();
|
||||
qCDebug(dcPcElectric()) << "Set max charging current to" << desiredChargingCurrent << "A";
|
||||
|
||||
// Update buffer
|
||||
|
||||
@ -126,11 +126,12 @@
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameEvent": "Maximum charging current changed",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"defaultValue": 6,
|
||||
"minValue": 6,
|
||||
"maxValue": 16,
|
||||
"stepSize": 0.01,
|
||||
"writable": true
|
||||
},
|
||||
{
|
||||
|
||||
@ -186,7 +186,7 @@ void IntegrationPluginPhoenixConnect::setupThing(ThingSetupInfo *info)
|
||||
|
||||
connect(connection, &PhoenixModbusTcpConnection::maximumChargingCurrentChanged, thing, [thing](quint16 maxChargingCurrent) {
|
||||
qCDebug(dcPhoenixConnect()) << "Max charging current changed" << maxChargingCurrent;
|
||||
thing->setStateValue("maxChargingCurrent", 1.0 * maxChargingCurrent / 10); // 100mA -> 1A
|
||||
thing->setStateValue("maxChargingCurrent", maxChargingCurrent / 10.0); // 100mA -> 1A
|
||||
});
|
||||
|
||||
connect(connection, &PhoenixModbusTcpConnection::activePowerChanged, thing, [thing](quint32 activePower) {
|
||||
@ -262,7 +262,8 @@ void IntegrationPluginPhoenixConnect::executeAction(ThingActionInfo *info)
|
||||
});
|
||||
|
||||
} else if (actionType.name() == "maxChargingCurrent") {
|
||||
uint16_t current = action.param(actionType.id()).value().toUInt();
|
||||
double current = qRound(action.param(actionType.id()).value().toDouble() * 10) / 10.0;
|
||||
|
||||
qCDebug(dcPhoenixConnect()) << "Charging power set to" << current;
|
||||
QModbusReply *reply = connection->setMaximumChargingCurrent(current * 10);
|
||||
connect(reply, &QModbusReply::finished, info, [info, thing, reply, current](){
|
||||
|
||||
@ -104,10 +104,11 @@
|
||||
"displayName": "Charging current",
|
||||
"displayNameEvent": "Charging current changed",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 16,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -217,10 +218,11 @@
|
||||
"displayName": "Charging current",
|
||||
"displayNameEvent": "Charging current changed",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -366,10 +368,11 @@
|
||||
"displayName": "Charging current",
|
||||
"displayNameEvent": "Charging current changed",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 16,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -479,10 +482,11 @@
|
||||
"displayName": "Charging current",
|
||||
"displayNameEvent": "Charging current changed",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -628,10 +632,11 @@
|
||||
"displayName": "Charging current",
|
||||
"displayNameEvent": "Charging current changed",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 16,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -731,10 +736,11 @@
|
||||
"displayName": "Charging current",
|
||||
"displayNameEvent": "Charging current changed",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 0.1,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
|
||||
@ -139,7 +139,7 @@ void IntegrationPluginSchrack::setupThing(ThingSetupInfo *info)
|
||||
qCDebug(dcSchrack()) << "Charge control enabled changed:" << charging;
|
||||
// If this register goes 0->1 it means charging has been started. This could be because of an RFID tag.
|
||||
// As we have may set charging current to 0 ourselves, we'll want to activate it again here
|
||||
uint maxSetPoint = thing->stateValue(cionMaxChargingCurrentStateTypeId).toUInt();
|
||||
quint16 maxSetPoint = static_cast<quint16>(qRound(thing->stateValue(cionMaxChargingCurrentStateTypeId).toDouble()));
|
||||
if (cionConnection->chargingCurrentSetpoint() != maxSetPoint) {
|
||||
cionConnection->setChargingCurrentSetpoint(maxSetPoint);
|
||||
}
|
||||
@ -293,7 +293,7 @@ void IntegrationPluginSchrack::executeAction(ThingActionInfo *info)
|
||||
CionModbusRtuConnection *cionConnection = m_cionConnections.value(info->thing());
|
||||
if (info->action().actionTypeId() == cionPowerActionTypeId) {
|
||||
bool enabled = info->action().paramValue(cionPowerActionPowerParamTypeId).toBool();
|
||||
int maxChargingCurrent = enabled ? info->thing()->stateValue(cionMaxChargingCurrentStateTypeId).toUInt() : 0;
|
||||
int maxChargingCurrent = enabled ? static_cast<quint16>(qRound(info->thing()->stateValue(cionMaxChargingCurrentStateTypeId).toDouble())) : 0;
|
||||
qCDebug(dcSchrack()) << "Setting charging enabled:" << (enabled ? 1 : 0) << "(charging current setpoint:" << maxChargingCurrent << ")";
|
||||
|
||||
// Note: If the wallbox has an RFID reader connected, writing register 100 (chargingEnabled) won't work as the RFID
|
||||
@ -321,7 +321,7 @@ void IntegrationPluginSchrack::executeAction(ThingActionInfo *info)
|
||||
|
||||
} else if (info->action().actionTypeId() == cionMaxChargingCurrentActionTypeId) {
|
||||
// If charging is set to enabled, we'll write the value to the wallbox
|
||||
uint maxChargingCurrent = info->action().paramValue(cionMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt();
|
||||
quint16 maxChargingCurrent = static_cast<quint16>(qRound(info->action().paramValue(cionMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble()));
|
||||
if (info->thing()->stateValue(cionPowerStateTypeId).toBool()) {
|
||||
qCDebug(dcSchrack) << "Charging is enabled. Applying max charging current setpoint of" << maxChargingCurrent << "to wallbox";
|
||||
ModbusRtuReply *reply = cionConnection->setChargingCurrentSetpoint(maxChargingCurrent);
|
||||
|
||||
@ -68,11 +68,12 @@
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameEvent": "Maximum charging current changed",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"defaultValue": 6,
|
||||
"minValue": 1,
|
||||
"maxValue": 32,
|
||||
"stepSize": 1.0,
|
||||
"writable": true
|
||||
},
|
||||
{
|
||||
|
||||
@ -187,7 +187,7 @@ void IntegrationPluginVestel::executeAction(ThingActionInfo *info)
|
||||
// Note: only write the register if power is true, otherwise we would start charging. The state represents the desired current,
|
||||
// once the power is true, the current will be written to the corresponding current.
|
||||
|
||||
int maxChargingCurrent = info->action().paramValue(evc04MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toInt();
|
||||
quint16 maxChargingCurrent = static_cast<quint16>(qRound(info->action().paramValue(evc04MaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble()));
|
||||
|
||||
if (info->thing()->stateValue(evc04PowerStateTypeId).toBool()) {
|
||||
qCDebug(dcVestel()) << "Write max charging current" << maxChargingCurrent;
|
||||
|
||||
@ -107,10 +107,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 1.0,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
|
||||
@ -513,7 +513,7 @@ void IntegrationPluginWebasto::executeAction(ThingActionInfo *info)
|
||||
m_asyncActions.insert(requestId, info);
|
||||
}
|
||||
} else if (action.actionTypeId() == webastoLiveMaxChargingCurrentActionTypeId) {
|
||||
int ampere = action.paramValue(webastoLiveMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt();
|
||||
quint16 ampere = static_cast<quint16>(qRound(action.paramValue(webastoLiveMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble()));
|
||||
thing->setStateValue(webastoLiveMaxChargingCurrentStateTypeId, ampere);
|
||||
QUuid requestId = connection->setChargeCurrent(ampere);
|
||||
if (requestId.isNull()) {
|
||||
@ -571,7 +571,7 @@ void IntegrationPluginWebasto::executeAction(ThingActionInfo *info)
|
||||
executeWebastoNextPowerAction(info, power);
|
||||
}
|
||||
} else if (action.actionTypeId() == webastoNextMaxChargingCurrentActionTypeId) {
|
||||
quint16 chargingCurrent = action.paramValue(webastoNextMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toUInt();
|
||||
quint16 chargingCurrent = static_cast<quint16>(qRound(action.paramValue(webastoNextMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble()));
|
||||
qCDebug(dcWebasto()) << "Set max charging current of" << thing << "to" << chargingCurrent << "ampere";
|
||||
QModbusReply *reply = connection->setChargeCurrent(chargingCurrent);
|
||||
connect(reply, &QModbusReply::finished, reply, &QModbusReply::deleteLater);
|
||||
@ -620,7 +620,7 @@ void IntegrationPluginWebasto::executeAction(ThingActionInfo *info)
|
||||
});
|
||||
}
|
||||
if (info->action().actionTypeId() == webastoUniteMaxChargingCurrentActionTypeId) {
|
||||
int maxChargingCurrent = info->action().paramValue(webastoUniteMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toInt();
|
||||
quint16 maxChargingCurrent = static_cast<quint16>(qRound(info->action().paramValue(webastoUniteMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble()));
|
||||
QModbusReply *reply = evc04Connection->setChargingCurrent(maxChargingCurrent);
|
||||
connect(reply, &QModbusReply::finished, info, [info, reply, maxChargingCurrent](){
|
||||
if (reply->error() == QModbusDevice::NoError) {
|
||||
|
||||
@ -96,10 +96,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Charging current",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 80,
|
||||
"stepSize": 1.0,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -297,10 +298,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Charging current",
|
||||
"displayNameAction": "Set charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 1.0,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
@ -569,10 +571,11 @@
|
||||
"name": "maxChargingCurrent",
|
||||
"displayName": "Maximum charging current",
|
||||
"displayNameAction": "Set maximum charging current",
|
||||
"type": "uint",
|
||||
"type": "double",
|
||||
"unit": "Ampere",
|
||||
"minValue": 6,
|
||||
"maxValue": 32,
|
||||
"stepSize": 1.0,
|
||||
"defaultValue": 6,
|
||||
"writable": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user