Skip to content

Commit

Permalink
fix montly energy meter
Browse files Browse the repository at this point in the history
  • Loading branch information
KipK committed Mar 29, 2023
1 parent 8e17e58 commit bee3c35
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/energy_meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void EnergyMeterData::deserialize(StaticJsonDocument<capacity> &doc)
if (doc.containsKey("we") && doc["we"].is<double>())
{
// weekly
daily = doc["we"];
weekly = doc["we"];
}
if (doc.containsKey("mo") && doc["mo"].is<double>())
{
Expand Down Expand Up @@ -287,13 +287,14 @@ bool EnergyMeter::update()
// convert to w/h
double wh = mws / 3600000UL;
_data.session += wh;
_data.total += wh / 1000;
double kwh = wh / 1000UL;
_data.total += kwh;
DBUGVAR(_data.session);

_data.daily += wh / 1000;
_data.weekly += wh / 1000;
_data.monthly += wh / 1000;
_data.yearly += wh / 1000;
double kwh = kwh;
_data.daily += kwh;
_data.weekly += kwh;
_data.monthly += kwh;
_data.yearly += kwh;

_last_upd = curms;
DBUGF("session_wh = %.2f, total_kwh = %.2f", _data.session, _data.total);
Expand Down

0 comments on commit bee3c35

Please sign in to comment.