Follow-up to the etm1 fixes, driven by live debugging against a real ABB
Terra AC 7 kW behind a Waveshare RS485->TCP gateway (192.168.1.132, slave 2):
- etm3: disable TCP auto-discovery (createMethods = "user" only). Discovery
blind-scans the LAN and SIGSEGVs nymead as soon as any Modbus device answers
:502 with an exception response. The crash is in the generated reachability
handler (abbterramodbustcpconnection.cpp:2062 dereferences the check-reachable
reply after it is freed); it could not be fixed from the discovery code alone.
A gateway's slave id can't be discovered anyway, so manual add is required.
- etm2: still defer/guard AbbTerraTcpDiscovery::cleanupConnection() teardown
(kept for correctness even though discovery is now off by default).
- etm4: setupTcpThing() never called connectDevice(), so manual setup hung until
timeout. Start the connection when the network monitor reports the device.
- etm5: decode the serial-number and firmware register fields as BCD per ABB
spec §5.1 (0x46 = week 46, not 70; 0x22 = 22 kW). The binary reading rejected
real chargers ("does not match the ABB Terra AC Modbus register map").
Verified end to end: charger adds cleanly (TACW7-4-4624-S0034), states poll and
actions execute, no SIGSEGV. The underlying discovery/generated-code crash is
tracked separately.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two coupled fixes so the ABB Terra AC can be added over Modbus TCP:
- Restore checkReachableRegister ("serialNumber") in the register JSON.
The libnymea-modbus 1.15 code generator *requires* it — without it the
connection classes (abbterramodbustcpconnection.h) are never generated and
the plugin fails to build. Reverts the false lead in b23a9a2. The register
is valid: mbpoll confirms holding reg 16384 (uint64) responds at slave 2.
- Fix a use-after-free in AbbTerraTcpDiscovery::cleanupConnection() that
SIGSEGV'd nymead during network discovery whenever any Modbus device on the
LAN answered on :502 with an exception (e.g. "illegal data address"). The
method is invoked from several of the connection's own signals; it now
bails out on the second (re-entrant) call and disconnects the connection's
signals before disconnectDevice(), so the teardown can no longer re-enter
while the QModbusReply "finished" handler is still dereferencing the reply.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>