Handle reconfigure

pull/544/head
Simon Stürz 2022-03-07 14:47:54 +01:00
parent 9f1869462a
commit dba629b173
2 changed files with 10 additions and 1 deletions

View File

@ -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);
}

View File

@ -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