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