Fixes
parent
034f90d7a9
commit
a34dd7642b
|
|
@ -102,7 +102,7 @@ Q_DECLARE_METATYPE(PowerBalanceLogEntries)
|
||||||
|
|
||||||
class ThingPowerLogEntry {
|
class ThingPowerLogEntry {
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_PROPERTY(QDateTime timstamp READ timestamp)
|
Q_PROPERTY(QDateTime timestamp READ timestamp)
|
||||||
Q_PROPERTY(QUuid thingId READ thingId)
|
Q_PROPERTY(QUuid thingId READ thingId)
|
||||||
Q_PROPERTY(double currentPower READ currentPower)
|
Q_PROPERTY(double currentPower READ currentPower)
|
||||||
Q_PROPERTY(double totalConsumption READ totalConsumption)
|
Q_PROPERTY(double totalConsumption READ totalConsumption)
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,8 @@ ThingPowerLogEntries EnergyLogger::thingPowerLogs(SampleRate sampleRate, const Q
|
||||||
QVariantList bindValues;
|
QVariantList bindValues;
|
||||||
bindValues << sampleRate;
|
bindValues << sampleRate;
|
||||||
|
|
||||||
|
qCDebug(dcEnergyExperience()) << "Fetching thing power logs for" << thingIds;
|
||||||
|
|
||||||
QStringList thingsQuery;
|
QStringList thingsQuery;
|
||||||
foreach (const ThingId &thingId, thingIds) {
|
foreach (const ThingId &thingId, thingIds) {
|
||||||
thingsQuery.append("thingId = ?");
|
thingsQuery.append("thingId = ?");
|
||||||
|
|
@ -598,7 +600,7 @@ bool EnergyLogger::insertPowerBalance(const QDateTime ×tamp, SampleRate sam
|
||||||
query.addBindValue(totalReturn);
|
query.addBindValue(totalReturn);
|
||||||
query.exec();
|
query.exec();
|
||||||
if (query.lastError().isValid()) {
|
if (query.lastError().isValid()) {
|
||||||
qCWarning(dcEnergyExperience()) << "Error logging consumption sample:" << query.lastError();
|
qCWarning(dcEnergyExperience()) << "Error logging consumption sample:" << query.lastError() << query.executedQuery();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
emit powerBalanceEntryAdded(sampleRate, PowerBalanceLogEntry(timestamp, consumption, production, acquisition, storage, totalConsumption, totalProduction, totalAcquisition, totalReturn));
|
emit powerBalanceEntryAdded(sampleRate, PowerBalanceLogEntry(timestamp, consumption, production, acquisition, storage, totalConsumption, totalProduction, totalAcquisition, totalReturn));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue