fixed auto device setup

This commit is contained in:
Boernsman 2021-02-24 15:45:27 +01:00 committed by Simon Stürz
parent 74b33b2d2c
commit 1d2bd72cad
2 changed files with 10 additions and 4 deletions

View File

@ -227,6 +227,9 @@ void IntegrationPluginSma::onDevicesReceived(const QString &messageId, QList<Sun
Q_FOREACH(SunnyWebBox::Device device, devices){
qCDebug(dcSma()) << " - Device received" << device.name << device.key;
ThingDescriptor descriptor(inverterThingClassId, device.name, device.key ,thing->id());
ParamList params;
params << Param(inverterThingIdParamTypeId, device.key);
descriptor.setParams(params);
descriptors.append(descriptor);
}
emit autoThingsAppeared(descriptors);

View File

@ -132,16 +132,19 @@ void SunnyWebBox::parseMessage(const QString &messageId, const QString &messageT
qCDebug(dcSma()) << "SunnyWebBox: GetPlantOverview";
Q_FOREACH(QVariant value, overviewList) {
QVariantMap map = value.toMap();
if (map["meta"].toString() == "GriPwr") {
overview.power = map["value"].toString().toInt();
QString unit = map["unit"].toString();
qCDebug(dcSma()) << "SunnyWebBox: - Power" << overview.power << unit;
} else if (map["meta"].toString() == "GriEgyTdy") {
overview.dailyYield = map["value"].toString().toInt();
qCDebug(dcSma()) << "SunnyWebBox: - Daily yield" << overview.dailyYield;
overview.dailyYield = map["value"].toString().toDouble();
QString unit = map["unit"].toString();
qCDebug(dcSma()) << "SunnyWebBox: - Daily yield" << overview.dailyYield << unit;
} else if (map["meta"].toString() == "GriEgyTot") {
overview.totalYield = map["value"].toString().toInt();
qCDebug(dcSma()) << "SunnyWebBox: - Total yield" << overview.totalYield;
overview.totalYield = map["value"].toString().toDouble();
QString unit = map["unit"].toString();
qCDebug(dcSma()) << "SunnyWebBox: - Total yield" << overview.totalYield << unit;
} else if (map["meta"].toString() == "OpStt") {
overview.status = map["value"].toString();
qCDebug(dcSma()) << "SunnyWebBox: - Status" << overview.status;