abbterra: fix RTU setup on slow radio links (433 MHz)

reachableChanged(true) never fires within the nymea setup timeout when
the RTU link is slow (e.g. 433 MHz radio relay). Add a fallback:
trigger initialize() immediately if master is already connected
(QTimer::singleShot 500 ms), and also on master::connectedChanged.
The existing reachableChanged path is kept for TCP-style RTU adapters.

Bump to 1.15.0+etm5.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Patrick Schurig 2026-06-24 23:08:36 +02:00
parent 5d87de1814
commit a068d5a2cd
2 changed files with 23 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "plugininfo.h"
#include <QLoggingCategory>
#include <QTimer>
#include <QtMath>
#include <utility>
@ -332,6 +333,20 @@ void IntegrationPluginAbbterra::setupRtuThing(ThingSetupInfo *info)
const quint16 slaveId = static_cast<quint16>(thing->paramValue(terraAcRtuThingSlaveIdParamTypeId).toUInt());
AbbTerraModbusRtuConnection *connection = new AbbTerraModbusRtuConnection(master, slaveId, thing);
// reachableChanged(true) may never fire on slow radio links (e.g. 433 MHz)
// before the setup timeout expires, so we also trigger initialize() as soon
// as the master port is open.
if (master->connected()) {
QTimer::singleShot(500, connection, [connection]() {
connection->initialize();
});
}
connect(master, &ModbusRtuMaster::connectedChanged, connection, [connection](bool connected) {
if (connected) {
connection->initialize();
}
});
connect(connection, &AbbTerraModbusRtuConnection::reachableChanged, thing, [this, thing, connection](bool reachable) {
if (reachable) {
connection->initialize();

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
etm-powersync-plugins-modbus (1.15.0+etm5) trixie; urgency=medium
* abbterra: fix RTU setup on slow radio links — trigger initialize() on
master connectedChanged, not only on reachableChanged (which never fires
within setup timeout over 433 MHz).
-- ETM-Schurig SARL <contact@etm-schurig.eu> Tue, 24 Jun 2026 10:00:00 +0200
etm-powersync-plugins-modbus (1.15.0+etm4) trixie; urgency=medium
* Correction modbus registers.