sunspec: dispatch froniusConnection in setupThing()

setupThing() only knew about sunspecConnection and solarEdgeConnection, so a
froniusConnection thing fell into the final Q_ASSERT_X. In a release build the
assert is compiled out, setupThing() returns without calling info->finish(),
and the pairing hangs until the setup times out - with no message at all. In a
debug build nymead dies on the assert instead.

Take the same branch as the two vendors that already work: createConnection()
already reads the slave ID and picks the byte order for froniusConnection, so
no new logic is needed.

postSetupThing() and thingRemoved() are unchanged on purpose. The former only
special cases solarEdgeConnection, for the battery search a Fronius must not
run, and registers the refresh timer for every thing. The latter is keyed on
m_sunSpecConnections, which createConnection() now populates for Fronius as
well.

Makes the four cases of tst_sunspecplugin pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Patrick Schurig 2026-08-01 16:20:09 +02:00
parent c2eccd96e5
commit 3802807be7

View File

@ -247,7 +247,8 @@ void IntegrationPluginSunSpec::setupThing(ThingSetupInfo *info)
qCDebug(dcSunSpec()) << thing->params();
if (thing->thingClassId() == sunspecConnectionThingClassId ||
thing->thingClassId() == solarEdgeConnectionThingClassId) {
thing->thingClassId() == solarEdgeConnectionThingClassId ||
thing->thingClassId() == froniusConnectionThingClassId) {
// Handle reconfigure
if (m_sunSpecConnections.contains(thing->id())) {