Merge PR #108: SMA: fix power parsing for SunnyWebBox
commit
efcad41a0c
|
|
@ -562,12 +562,11 @@ void IntegrationPluginSma::onConnectedChanged(bool connected)
|
|||
void IntegrationPluginSma::onPlantOverviewReceived(const QString &messageId, SunnyWebBox::Overview overview)
|
||||
{
|
||||
Q_UNUSED(messageId)
|
||||
|
||||
qCDebug(dcSma()) << "Plant overview received" << overview.status;
|
||||
Thing *thing = m_sunnyWebBoxes.key(static_cast<SunnyWebBox *>(sender()));
|
||||
if (!thing)
|
||||
return;
|
||||
|
||||
qCDebug(dcSma()) << "Plant overview received for" << thing;
|
||||
thing->setStateValue(sunnyWebBoxCurrentPowerStateTypeId, -overview.power);
|
||||
thing->setStateValue(sunnyWebBoxDayEnergyProducedStateTypeId, overview.dailyYield);
|
||||
thing->setStateValue(sunnyWebBoxTotalEnergyProducedStateTypeId, overview.totalYield);
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ void SunnyWebBox::parseMessage(const QString &messageId, const QString &messageT
|
|||
QVariantMap map = value.toMap();
|
||||
|
||||
if (map["meta"].toString() == "GriPwr") {
|
||||
overview.power = map["value"].toString().toInt();
|
||||
overview.power = map["value"].toString().toDouble();
|
||||
QString unit = map["unit"].toString();
|
||||
qCDebug(dcSma()) << "SunnyWebBox: - Power" << overview.power << unit;
|
||||
} else if (map["meta"].toString() == "GriEgyTdy") {
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ class SunnyWebBox : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
struct Overview {
|
||||
int power;
|
||||
double power;
|
||||
double dailyYield;
|
||||
int totalYield;
|
||||
double totalYield;
|
||||
QString status;
|
||||
QString error;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue