diff --git a/phoenixconnect/integrationpluginphoenixconnect.cpp b/phoenixconnect/integrationpluginphoenixconnect.cpp index 4879dee..0cc505f 100644 --- a/phoenixconnect/integrationpluginphoenixconnect.cpp +++ b/phoenixconnect/integrationpluginphoenixconnect.cpp @@ -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](){ diff --git a/phoenixconnect/integrationpluginphoenixconnect.json b/phoenixconnect/integrationpluginphoenixconnect.json index ad92279..ed6a3a1 100644 --- a/phoenixconnect/integrationpluginphoenixconnect.json +++ b/phoenixconnect/integrationpluginphoenixconnect.json @@ -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 },