Fronius: Fix generating childs with multiple fronius connections
This commit is contained in:
parent
f0abb00942
commit
e74d9b0417
@ -188,11 +188,13 @@ void FroniusSolarConnection::sendNextRequest()
|
|||||||
|
|
||||||
m_currentReply = m_requestQueue.dequeue();
|
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()));
|
m_currentReply->setNetworkReply(m_networkManager->get(m_currentReply->request()));
|
||||||
|
|
||||||
connect(m_currentReply, &FroniusNetworkReply::finished, this, [=](){
|
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
|
// Note: the network reply will be deleted in the destructor
|
||||||
m_currentReply->deleteLater();
|
m_currentReply->deleteLater();
|
||||||
|
|||||||
@ -283,7 +283,7 @@ void IntegrationPluginFronius::refreshConnection(FroniusSolarConnection *connect
|
|||||||
const QString serialNumber = inverterInfo.value("Serial").toString();
|
const QString serialNumber = inverterInfo.value("Serial").toString();
|
||||||
|
|
||||||
// Note: we use the id to identify for backwards compatibility
|
// 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();
|
QString thingDescription = connectionThing->name();
|
||||||
ThingDescriptor descriptor(inverterThingClassId, "Fronius Solar Inverter", thingDescription, connectionThing->id());
|
ThingDescriptor descriptor(inverterThingClassId, "Fronius Solar Inverter", thingDescription, connectionThing->id());
|
||||||
ParamList params;
|
ParamList params;
|
||||||
@ -298,7 +298,7 @@ void IntegrationPluginFronius::refreshConnection(FroniusSolarConnection *connect
|
|||||||
QVariantMap meterMap = bodyMap.value("Data").toMap().value("Meter").toMap();
|
QVariantMap meterMap = bodyMap.value("Data").toMap().value("Meter").toMap();
|
||||||
foreach (const QString &meterId, meterMap.keys()) {
|
foreach (const QString &meterId, meterMap.keys()) {
|
||||||
// Note: we use the id to identify for backwards compatibility
|
// 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
|
// Get the meter realtime data for details
|
||||||
FroniusNetworkReply *realtimeDataReply = connection->getMeterRealtimeData(meterId.toInt());
|
FroniusNetworkReply *realtimeDataReply = connection->getMeterRealtimeData(meterId.toInt());
|
||||||
connect(realtimeDataReply, &FroniusNetworkReply::finished, this, [=]() {
|
connect(realtimeDataReply, &FroniusNetworkReply::finished, this, [=]() {
|
||||||
@ -342,7 +342,7 @@ void IntegrationPluginFronius::refreshConnection(FroniusSolarConnection *connect
|
|||||||
QVariantMap storageMap = bodyMap.value("Data").toMap().value("Storage").toMap();
|
QVariantMap storageMap = bodyMap.value("Data").toMap().value("Storage").toMap();
|
||||||
foreach (const QString &storageId, storageMap.keys()) {
|
foreach (const QString &storageId, storageMap.keys()) {
|
||||||
// Note: we use the id to identify for backwards compatibility
|
// 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
|
// Get the meter realtime data for details
|
||||||
FroniusNetworkReply *realtimeDataReply = connection->getStorageRealtimeData(storageId.toInt());
|
FroniusNetworkReply *realtimeDataReply = connection->getStorageRealtimeData(storageId.toInt());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user