From 88657c791cef68bf2e327a1a2b9ed3a798a7a76b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Thu, 18 Aug 2022 09:47:06 +0200 Subject: [PATCH] Add energy counter for meter and use display name instead of name for meter --- kostal/integrationpluginkostal.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kostal/integrationpluginkostal.cpp b/kostal/integrationpluginkostal.cpp index 935c655..af6a059 100644 --- a/kostal/integrationpluginkostal.cpp +++ b/kostal/integrationpluginkostal.cpp @@ -236,7 +236,7 @@ void IntegrationPluginKostal::postSetupThing(Thing *thing) qCDebug(dcKostal()) << "There is a meter connected but not set up yet. Creating a meter..."; // No meter thing created for this inverter, lets create one with the inverter as parent ThingClass meterThingClass = thingClass(kostalMeterThingClassId); - ThingDescriptor descriptor(kostalMeterThingClassId, meterThingClass.name(), QString(), thing->id()); + ThingDescriptor descriptor(kostalMeterThingClassId, meterThingClass.displayName(), QString(), thing->id()); // No params required, all we need is the connection emit autoThingsAppeared(ThingDescriptors() << descriptor); } else { @@ -428,8 +428,6 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info) if (meterThings.count() == 1) { Thing *meterThing = meterThings.first(); - // TODO: set total energy consumed/produced - // Power meterThing->setStateValue(kostalMeterCurrentPhaseAStateTypeId, kostalConnection->powerMeterCurrentPhase1()); meterThing->setStateValue(kostalMeterCurrentPhaseBStateTypeId, kostalConnection->powerMeterCurrentPhase2()); @@ -447,6 +445,9 @@ void IntegrationPluginKostal::setupKostalConnection(ThingSetupInfo *info) meterThing->setStateValue(kostalMeterFrequencyStateTypeId, kostalConnection->gridFrequencyPowerMeter()); + // TODO: Not sure where to get the exported energy + meterThing->setStateValue(kostalMeterTotalEnergyConsumedStateTypeId, kostalConnection->totalHomeConsumptionFromGrid() / 1000.0); // kWh + // Set the power as last value meterThing->setStateValue(kostalMeterCurrentPowerStateTypeId, kostalConnection->powerMeterTotalActivePower()); }