fixed thing setup

This commit is contained in:
Boernsman 2021-04-21 20:30:37 +02:00 committed by Michael Zanetti
parent 7dded817c9
commit 799a831081
2 changed files with 4 additions and 4 deletions

View File

@ -71,8 +71,8 @@ IntegrationPluginEnergyMeters::IntegrationPluginEnergyMeters()
m_registerMaps.insert(pro380ThingClassId, pro380RegisterMap); m_registerMaps.insert(pro380ThingClassId, pro380RegisterMap);
m_registerMaps.insert(sdm630ThingClassId, sdm630RegisterMap); m_registerMaps.insert(sdm630ThingClassId, sdm630RegisterMap);
// Modbus RTU hardware resource // FIXME leads to crash, probably an issue in the modbus rtu resource
connect(hardwareManager()->modbusRtuResource(), &ModbusRtuHardwareResource::modbusRtuMasterRemoved, this, [=](const QUuid &modbusUuid){ /*connect(hardwareManager()->modbusRtuResource(), &ModbusRtuHardwareResource::modbusRtuMasterRemoved, this, [=] (const QUuid &modbusUuid){
qCDebug(dcEnergyMeters()) << "Modbus RTU master has been removed" << modbusUuid.toString(); qCDebug(dcEnergyMeters()) << "Modbus RTU master has been removed" << modbusUuid.toString();
// Check if there is any device using this resource // Check if there is any device using this resource
@ -86,7 +86,7 @@ IntegrationPluginEnergyMeters::IntegrationPluginEnergyMeters()
thing->setStateValue(m_connectionStateTypeIds[thing->thingClassId()], false); thing->setStateValue(m_connectionStateTypeIds[thing->thingClassId()], false);
} }
} }
}); }); */
} }
void IntegrationPluginEnergyMeters::discoverThings(ThingDiscoveryInfo *info) void IntegrationPluginEnergyMeters::discoverThings(ThingDiscoveryInfo *info)
@ -164,6 +164,7 @@ void IntegrationPluginEnergyMeters::setupThing(ThingSetupInfo *info)
m_energyMeters.insert(info->thing(), meter); m_energyMeters.insert(info->thing(), meter);
info->finish(Thing::ThingErrorNoError); info->finish(Thing::ThingErrorNoError);
}); });
meter->getEnergyConsumed();
return; return;
} else { } else {
Q_ASSERT_X(false, "setupThing", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8()); Q_ASSERT_X(false, "setupThing", QString("Unhandled thingClassId: %1").arg(thing->thingClassId().toString()).toUtf8());

View File

@ -73,7 +73,6 @@ private:
QHash<ThingClassId, QHash<ModbusRegisterType, ModbusRegisterDescriptor>> m_registerMaps; QHash<ThingClassId, QHash<ModbusRegisterType, ModbusRegisterDescriptor>> m_registerMaps;
QHash<Thing *, EnergyMeter *> m_energyMeters; QHash<Thing *, EnergyMeter *> m_energyMeters;
PluginTimer *m_pluginTimer = nullptr;
private slots: private slots:
void onConnectionStateChanged(bool status); void onConnectionStateChanged(bool status);