Fronius: Fix generating childs with multiple fronius connections

master
Michael Zanetti 2022-09-23 11:21:38 +02:00
parent f0abb00942
commit e74d9b0417
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

@ -283,7 +283,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;
@ -298,7 +298,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, [=]() {
@ -342,7 +342,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());