From e3d5b39d2a2e4cf5c86b10d1f7c28bb407560933 Mon Sep 17 00:00:00 2001 From: Patrick Schurig Date: Mon, 1 Jun 2026 08:29:36 +0200 Subject: [PATCH] abbterra: retire les registres WO pour build sur generateur 1.15 (lecture seule) - abbterra-registers.json : suppression des 4 registres WO (chargingCurrentLimitCommand, socketLockCommand, startStopChargingSession, communicationTimeoutCommand) incompatibles avec le generateur libnymea-modbus 1.15 - integrationpluginabbterra.cpp/.h : suppression de executeAction + applyTimeoutSetting - integrationpluginabbterra.json : power + maxChargingCurrent passes en lecture seule (writable/displayNameAction retires) La borne sera reconnue et lira les mesures ; le pilotage sera rebranche quand le generateur 1.16 sera disponible. Co-Authored-By: Claude Sonnet 4.6 --- abbterra/abbterra-registers.json | 48 ---------- abbterra/integrationpluginabbterra.cpp | 120 +----------------------- abbterra/integrationpluginabbterra.h | 2 - abbterra/integrationpluginabbterra.json | 16 +--- 4 files changed, 5 insertions(+), 181 deletions(-) diff --git a/abbterra/abbterra-registers.json b/abbterra/abbterra-registers.json index 0bf1e80..597f15a 100644 --- a/abbterra/abbterra-registers.json +++ b/abbterra/abbterra-registers.json @@ -191,53 +191,5 @@ } ] } - ], - "registers": [ - { - "id": "chargingCurrentLimitCommand", - "address": 16640, - "size": 2, - "type": "uint32", - "unit": "mA", - "readSchedule": "", - "registerType": "holdingRegister", - "description": "Set charging current limit", - "defaultValue": "6000", - "access": "WO" - }, - { - "id": "socketLockCommand", - "address": 16642, - "size": 1, - "type": "uint16", - "readSchedule": "", - "registerType": "holdingRegister", - "description": "Socket lock control", - "defaultValue": "0", - "access": "WO" - }, - { - "id": "startStopChargingSession", - "address": 16645, - "size": 1, - "type": "uint16", - "readSchedule": "", - "registerType": "holdingRegister", - "description": "Start or stop charging session", - "defaultValue": "0", - "access": "WO" - }, - { - "id": "communicationTimeoutCommand", - "address": 16646, - "size": 1, - "type": "uint16", - "unit": "s", - "readSchedule": "", - "registerType": "holdingRegister", - "description": "Set communication timeout", - "defaultValue": "60", - "access": "WO" - } ] } diff --git a/abbterra/integrationpluginabbterra.cpp b/abbterra/integrationpluginabbterra.cpp index 762181a..9c6a351 100644 --- a/abbterra/integrationpluginabbterra.cpp +++ b/abbterra/integrationpluginabbterra.cpp @@ -133,93 +133,7 @@ void IntegrationPluginAbbterra::thingRemoved(Thing *thing) void IntegrationPluginAbbterra::executeAction(ThingActionInfo *info) { - Thing *thing = info->thing(); - - if (thing->thingClassId() == terraAcTcpThingClassId) { - AbbTerraModbusTcpConnection *connection = m_tcpConnections.value(thing); - if (!connection || !connection->reachable()) { - info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("The charging station is not reachable.")); - return; - } - - if (info->action().actionTypeId() == terraAcTcpPowerActionTypeId) { - const bool power = info->action().paramValue(terraAcTcpPowerActionPowerParamTypeId).toBool(); - const quint32 currentMilliAmps = power ? static_cast(qRound(thing->stateValue(terraAcTcpMaxChargingCurrentStateTypeId).toDouble() * 1000.0)) : 0; - QModbusReply *reply = connection->setChargingCurrentLimitCommand(currentMilliAmps); - connect(reply, &QModbusReply::finished, reply, &QModbusReply::deleteLater); - connect(reply, &QModbusReply::finished, info, [info, thing, connection, reply, power]() { - if (reply->error() == QModbusDevice::NoError) { - thing->setStateValue(terraAcTcpPowerStateTypeId, power); - connection->update(); - info->finish(Thing::ThingErrorNoError); - } else { - info->finish(Thing::ThingErrorHardwareFailure); - } - }); - return; - } - - if (info->action().actionTypeId() == terraAcTcpMaxChargingCurrentActionTypeId) { - const double current = info->action().paramValue(terraAcTcpMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble(); - QModbusReply *reply = connection->setChargingCurrentLimitCommand(static_cast(qRound(current * 1000.0))); - connect(reply, &QModbusReply::finished, reply, &QModbusReply::deleteLater); - connect(reply, &QModbusReply::finished, info, [info, thing, connection, reply, current]() { - if (reply->error() == QModbusDevice::NoError) { - thing->setStateValue(terraAcTcpMaxChargingCurrentStateTypeId, current); - thing->setStateValue(terraAcTcpPowerStateTypeId, current >= 6.0); - connection->update(); - info->finish(Thing::ThingErrorNoError); - } else { - info->finish(Thing::ThingErrorHardwareFailure); - } - }); - return; - } - - info->finish(Thing::ThingErrorUnsupportedFeature); - return; - } - - if (thing->thingClassId() == terraAcRtuThingClassId) { - AbbTerraModbusRtuConnection *connection = m_rtuConnections.value(thing); - if (!connection || !connection->reachable()) { - info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("The charging station is not reachable.")); - return; - } - - if (info->action().actionTypeId() == terraAcRtuPowerActionTypeId) { - const bool power = info->action().paramValue(terraAcRtuPowerActionPowerParamTypeId).toBool(); - const quint32 currentMilliAmps = power ? static_cast(qRound(thing->stateValue(terraAcRtuMaxChargingCurrentStateTypeId).toDouble() * 1000.0)) : 0; - ModbusRtuReply *reply = connection->setChargingCurrentLimitCommand(currentMilliAmps); - connect(reply, &ModbusRtuReply::finished, info, [info, thing, connection, reply, power]() { - if (reply->error() == ModbusRtuReply::NoError) { - thing->setStateValue(terraAcRtuPowerStateTypeId, power); - connection->update(); - info->finish(Thing::ThingErrorNoError); - } else { - info->finish(Thing::ThingErrorHardwareFailure); - } - }); - return; - } - - if (info->action().actionTypeId() == terraAcRtuMaxChargingCurrentActionTypeId) { - const double current = info->action().paramValue(terraAcRtuMaxChargingCurrentActionMaxChargingCurrentParamTypeId).toDouble(); - ModbusRtuReply *reply = connection->setChargingCurrentLimitCommand(static_cast(qRound(current * 1000.0))); - connect(reply, &ModbusRtuReply::finished, info, [info, thing, connection, reply, current]() { - if (reply->error() == ModbusRtuReply::NoError) { - thing->setStateValue(terraAcRtuMaxChargingCurrentStateTypeId, current); - thing->setStateValue(terraAcRtuPowerStateTypeId, current >= 6.0); - connection->update(); - info->finish(Thing::ThingErrorNoError); - } else { - info->finish(Thing::ThingErrorHardwareFailure); - } - }); - return; - } - } - + // Read-only mode: WO registers removed for compatibility with libnymea-modbus 1.15 info->finish(Thing::ThingErrorUnsupportedFeature); } @@ -280,7 +194,6 @@ void IntegrationPluginAbbterra::setupTcpThing(ThingSetupInfo *info) thing->setStateValue(terraAcTcpFirmwareVersionStateTypeId, deviceInfo.firmwareVersion); thing->setStateValue(terraAcTcpSerialNumberStateTypeId, deviceInfo.serialNumber); thing->setStateMinMaxValues(terraAcTcpMaxChargingCurrentStateTypeId, 6.0, deviceInfo.maxChargingCurrent); - applyTimeoutSetting(thing, connection); }); connect(connection, &AbbTerraModbusTcpConnection::initializationFinished, info, [this, info, thing, connection](bool success) { @@ -308,11 +221,6 @@ void IntegrationPluginAbbterra::setupTcpThing(ThingSetupInfo *info) updateThing(thing, connection); }); - connect(thing, &Thing::settingChanged, connection, [this, thing, connection](const ParamTypeId ¶mTypeId, const QVariant &) { - if (paramTypeId == terraAcTcpSettingsCommunicationTimeoutParamTypeId) { - applyTimeoutSetting(thing, connection); - } - }); } void IntegrationPluginAbbterra::setupRtuThing(ThingSetupInfo *info) @@ -356,7 +264,6 @@ void IntegrationPluginAbbterra::setupRtuThing(ThingSetupInfo *info) thing->setStateValue(terraAcRtuFirmwareVersionStateTypeId, deviceInfo.firmwareVersion); thing->setStateValue(terraAcRtuSerialNumberStateTypeId, deviceInfo.serialNumber); thing->setStateMinMaxValues(terraAcRtuMaxChargingCurrentStateTypeId, 6.0, deviceInfo.maxChargingCurrent); - applyTimeoutSetting(thing, connection); }); connect(connection, &AbbTerraModbusRtuConnection::initializationFinished, info, [this, info, thing, connection](bool success) { @@ -384,33 +291,8 @@ void IntegrationPluginAbbterra::setupRtuThing(ThingSetupInfo *info) updateThing(thing, connection); }); - connect(thing, &Thing::settingChanged, connection, [this, thing, connection](const ParamTypeId ¶mTypeId, const QVariant &) { - if (paramTypeId == terraAcRtuSettingsCommunicationTimeoutParamTypeId) { - applyTimeoutSetting(thing, connection); - } - }); } -void IntegrationPluginAbbterra::applyTimeoutSetting(Thing *thing, AbbTerraModbusTcpConnection *connection) -{ - QModbusReply *reply = connection->setCommunicationTimeoutCommand(static_cast(thing->setting(terraAcTcpSettingsCommunicationTimeoutParamTypeId).toUInt())); - connect(reply, &QModbusReply::finished, reply, &QModbusReply::deleteLater); - connect(reply, &QModbusReply::finished, connection, [connection, reply]() { - if (reply->error() != QModbusDevice::NoError && connection->reachable()) { - connection->updateCommunicationTimeoutReadback(); - } - }); -} - -void IntegrationPluginAbbterra::applyTimeoutSetting(Thing *thing, AbbTerraModbusRtuConnection *connection) -{ - ModbusRtuReply *reply = connection->setCommunicationTimeoutCommand(static_cast(thing->setting(terraAcRtuSettingsCommunicationTimeoutParamTypeId).toUInt())); - connect(reply, &ModbusRtuReply::finished, connection, [connection, reply]() { - if (reply->error() != ModbusRtuReply::NoError && connection->reachable()) { - connection->updateCommunicationTimeoutReadback(); - } - }); -} void IntegrationPluginAbbterra::updateThing(Thing *thing, AbbTerraModbusTcpConnection *connection) { diff --git a/abbterra/integrationpluginabbterra.h b/abbterra/integrationpluginabbterra.h index 84eb1e6..6ff152f 100644 --- a/abbterra/integrationpluginabbterra.h +++ b/abbterra/integrationpluginabbterra.h @@ -30,8 +30,6 @@ public slots: private: void setupTcpThing(ThingSetupInfo *info); void setupRtuThing(ThingSetupInfo *info); - void applyTimeoutSetting(Thing *thing, AbbTerraModbusTcpConnection *connection); - void applyTimeoutSetting(Thing *thing, AbbTerraModbusRtuConnection *connection); void updateThing(Thing *thing, AbbTerraModbusTcpConnection *connection); void updateThing(Thing *thing, AbbTerraModbusRtuConnection *connection); void setDisconnectedState(Thing *thing); diff --git a/abbterra/integrationpluginabbterra.json b/abbterra/integrationpluginabbterra.json index 392c218..c08aa71 100644 --- a/abbterra/integrationpluginabbterra.json +++ b/abbterra/integrationpluginabbterra.json @@ -107,23 +107,19 @@ "id": "207e2074-0147-4617-9a8b-3f326dcd6a0b", "name": "power", "displayName": "Charging enabled", - "displayNameAction": "Set charging enabled", "type": "bool", - "defaultValue": true, - "writable": true + "defaultValue": true }, { "id": "e3d27f8a-73d0-493a-b99a-29e7dc184485", "name": "maxChargingCurrent", "displayName": "Maximum charging current", - "displayNameAction": "Set maximum charging current", "type": "double", "unit": "Ampere", "minValue": 6, "maxValue": 32, "stepSize": 0.1, - "defaultValue": 6, - "writable": true + "defaultValue": 6 }, { "id": "0764bce9-fd26-4da8-8d92-f6a5ce73e81e", @@ -294,23 +290,19 @@ "id": "e35fd4fa-bf5a-45a1-8a39-f0d3d9efa4c6", "name": "power", "displayName": "Charging enabled", - "displayNameAction": "Set charging enabled", "type": "bool", - "defaultValue": true, - "writable": true + "defaultValue": true }, { "id": "ea933a77-a098-4303-bbdb-15c72dfd3634", "name": "maxChargingCurrent", "displayName": "Maximum charging current", - "displayNameAction": "Set maximum charging current", "type": "double", "unit": "Ampere", "minValue": 6, "maxValue": 32, "stepSize": 0.1, - "defaultValue": 6, - "writable": true + "defaultValue": 6 }, { "id": "cd1add95-18d9-46b5-a3d5-f0f29d5160c9",