diff --git a/fronius/froniusnetworkreply.cpp b/fronius/froniusnetworkreply.cpp index 13141ae4..34d0ab4c 100644 --- a/fronius/froniusnetworkreply.cpp +++ b/fronius/froniusnetworkreply.cpp @@ -71,7 +71,7 @@ void FroniusNetworkReply::setNetworkReply(QNetworkReply *networkReply) { m_networkReply = networkReply; - // The QNetworkReply will be deleted in the constructor if set + // The QNetworkReply will be deleted in the destructor if set connect(m_networkReply, &QNetworkReply::finished, this, &FroniusNetworkReply::finished); } diff --git a/fronius/integrationpluginfronius.cpp b/fronius/integrationpluginfronius.cpp index 2613977a..934ff50c 100644 --- a/fronius/integrationpluginfronius.cpp +++ b/fronius/integrationpluginfronius.cpp @@ -110,6 +110,15 @@ void IntegrationPluginFronius::setupThing(ThingSetupInfo *info) if (thing->thingClassId() == connectionThingClassId) { QHostAddress address(thing->paramValue(connectionThingAddressParamTypeId).toString()); + + // Handle reconfigure + if (m_froniusConnections.values().contains(thing)) { + FroniusSolarConnection *oldConnection = m_froniusConnections.key(thing); + m_froniusConnections.remove(oldConnection); + oldConnection->deleteLater(); + } + + // Create the connection FroniusSolarConnection *connection = new FroniusSolarConnection(hardwareManager()->networkManager(), address, thing); // Verify the version