Merge PR #609: Fronius: Fix generating childs with multiple fronius connections

This commit is contained in:
jenkins 2022-09-26 17:40:11 +02:00
commit 5f7de0d406
2 changed files with 7 additions and 5 deletions

View File

@ -188,11 +188,13 @@ void FroniusSolarConnection::sendNextRequest()
m_currentReply = m_requestQueue.dequeue();
qCDebug(dcFronius()) << "Connection: Sending request" << m_currentReply->request().url().toString();
// qCDebug(dcFronius()) << "Connection: Sending request" << m_currentReply->request().url().toString();
m_currentReply->setNetworkReply(m_networkManager->get(m_currentReply->request()));
connect(m_currentReply, &FroniusNetworkReply::finished, this, [=](){
qCDebug(dcFronius()) << "Connection: Request finished" << m_currentReply->networkReply()->error();
if (m_currentReply->networkReply()->error() != QNetworkReply::NoError) {
qCWarning(dcFronius()) << "Connection: Request finished with error:" << m_currentReply->networkReply()->error() << "for url" << m_currentReply->request().url().toString();
}
// Note: the network reply will be deleted in the destructor
m_currentReply->deleteLater();

View File

@ -287,7 +287,7 @@ void IntegrationPluginFronius::refreshConnection(FroniusSolarConnection *connect
const QString serialNumber = inverterInfo.value("Serial").toString();
// Note: we use the id to identify for backwards compatibility
if (myThings().filterByParam(inverterThingIdParamTypeId, inverterId).isEmpty()) {
if (myThings().filterByParentId(connectionThing->id()).filterByParam(inverterThingIdParamTypeId, inverterId).isEmpty()) {
QString thingDescription = connectionThing->name();
ThingDescriptor descriptor(inverterThingClassId, "Fronius Solar Inverter", thingDescription, connectionThing->id());
ParamList params;
@ -302,7 +302,7 @@ void IntegrationPluginFronius::refreshConnection(FroniusSolarConnection *connect
QVariantMap meterMap = bodyMap.value("Data").toMap().value("Meter").toMap();
foreach (const QString &meterId, meterMap.keys()) {
// Note: we use the id to identify for backwards compatibility
if (myThings().filterByParam(meterThingIdParamTypeId, meterId).isEmpty()) {
if (myThings().filterByParentId(connectionThing->id()).filterByParam(meterThingIdParamTypeId, meterId).isEmpty()) {
// Get the meter realtime data for details
FroniusNetworkReply *realtimeDataReply = connection->getMeterRealtimeData(meterId.toInt());
connect(realtimeDataReply, &FroniusNetworkReply::finished, this, [=]() {
@ -346,7 +346,7 @@ void IntegrationPluginFronius::refreshConnection(FroniusSolarConnection *connect
QVariantMap storageMap = bodyMap.value("Data").toMap().value("Storage").toMap();
foreach (const QString &storageId, storageMap.keys()) {
// Note: we use the id to identify for backwards compatibility
if (myThings().filterByParam(storageThingIdParamTypeId, storageId).isEmpty()) {
if (myThings().filterByParentId(connectionThing->id()).filterByParam(storageThingIdParamTypeId, storageId).isEmpty()) {
// Get the meter realtime data for details
FroniusNetworkReply *realtimeDataReply = connection->getStorageRealtimeData(storageId.toInt());