Remove smart meter states
parent
015d69a150
commit
8c8b9d0f73
|
|
@ -163,8 +163,6 @@ void IntegrationPluginSchrack::setupThing(ThingSetupInfo *info)
|
|||
|
||||
connect(cionConnection, &CionModbusRtuConnection::u1VoltageChanged, thing, [=](float u1Voltage){
|
||||
qCDebug(dcSchrack()) << "U1 voltage changed:" << u1Voltage;
|
||||
updateCurrentPower(thing);
|
||||
qCDebug(dcSchrack()) << "******** Charging duration:" << cionConnection->chargingDuration();
|
||||
});
|
||||
|
||||
connect(cionConnection, &CionModbusRtuConnection::pluggedInDurationChanged, thing, [=](quint32 pluggedInDuration){
|
||||
|
|
@ -260,26 +258,3 @@ void IntegrationPluginSchrack::finishAction(const StateTypeId &stateTypeId)
|
|||
}
|
||||
}
|
||||
|
||||
void IntegrationPluginSchrack::updateCurrentPower(Thing *thing)
|
||||
{
|
||||
CionModbusRtuConnection *cionConnection = m_cionConnections.value(thing);
|
||||
|
||||
QDateTime lastUpdate = thing->property("lastUpdate").toDateTime();
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
if (lastUpdate.isValid()) {
|
||||
double lastCurrentPower = thing->stateValue(cionCurrentPowerStateTypeId).toDouble();
|
||||
double lastTotal = thing->stateValue(cionTotalEnergyConsumedStateTypeId).toDouble();
|
||||
qlonglong msecsSinceLast = lastUpdate.msecsTo(now);
|
||||
double wattMs = lastCurrentPower * msecsSinceLast;
|
||||
double kWh = wattMs / 60 / 60;
|
||||
thing->setStateValue(cionTotalEnergyConsumedStateTypeId, lastTotal + kWh);
|
||||
}
|
||||
thing->setProperty("lastUpdate", now);
|
||||
|
||||
if (cionConnection->chargingDuration() > 0) {
|
||||
thing->setStateValue(cionCurrentPowerStateTypeId, 1.0 * cionConnection->u1Voltage() * cionConnection->currentChargingCurrentE3());
|
||||
} else {
|
||||
thing->setStateValue(cionCurrentPowerStateTypeId, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@ public:
|
|||
private:
|
||||
void waitForActionFinish(ThingActionInfo *info, ModbusRtuReply *reply, const StateTypeId &stateTypeId);
|
||||
void finishAction(const StateTypeId &stateTypeId);
|
||||
|
||||
void updateCurrentPower(Thing *thing);
|
||||
private:
|
||||
PluginTimer *m_refreshTimer = nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -74,24 +74,6 @@
|
|||
"maxValue": 32,
|
||||
"writable": true
|
||||
},
|
||||
{
|
||||
"id": "db5c951f-47e0-4cdc-8b8b-285f7ed95285",
|
||||
"name": "currentPower",
|
||||
"displayName": "Current power consumption",
|
||||
"displayNameEvent": "Current power consumption changed",
|
||||
"type": "double",
|
||||
"unit": "Watt",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "8390c005-a8ba-4db6-bb94-8f765ddcc784",
|
||||
"name": "totalEnergyConsumed",
|
||||
"displayName": "Total consumed energy",
|
||||
"displayNameEvent": "Total consumed energy changed",
|
||||
"type": "double",
|
||||
"unit": "KiloWattHour",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "13423618-4314-49be-b48c-42d9415199a8",
|
||||
"name": "pluggedIn",
|
||||
|
|
|
|||
Loading…
Reference in New Issue