@@ -97,7 +97,7 @@ type Loadpoint struct {
9797
9898 Soc loadpoint.SocConfig
9999 Enable , Disable loadpoint.ThresholdConfig
100- ui loadpoint.UIConfig // display-only, not used in control logic
100+ Ui loadpoint.UIConfig // display-only, not used in control logic
101101
102102 // from yaml
103103 DefaultMode api.ChargeMode `mapstructure:"mode"` // Default charge mode, used for disconnect
@@ -389,7 +389,7 @@ func (lp *Loadpoint) restoreSettings() {
389389
390390 var ui loadpoint.UIConfig
391391 if err := lp .settings .Json (keys .UI , & ui ); err == nil {
392- lp .ui = ui
392+ lp .Ui = ui
393393 }
394394
395395 t , err1 := lp .settings .Time (keys .PlanTime )
@@ -705,7 +705,7 @@ func (lp *Loadpoint) Prepare(site site.API, uiChan chan<- util.Param, pushChan c
705705 lp .publish (keys .EnableDelay , lp .Enable .Delay )
706706 lp .publish (keys .DisableDelay , lp .Disable .Delay )
707707
708- lp .publish (keys .UI , lp .ui )
708+ lp .publish (keys .UI , lp .Ui )
709709
710710 if phases := lp .getChargerPhysicalPhases (); phases != 0 {
711711 if lp .phasesConfigured != phases && lp .phasesConfigured != 0 {
@@ -723,6 +723,7 @@ func (lp *Loadpoint) Prepare(site site.API, uiChan chan<- util.Param, pushChan c
723723 lp .publish (keys .SmartFeedInPriorityLimit , lp .smartFeedInPriorityLimit )
724724 lp .publishTimer (phaseTimer , 0 , timerInactive )
725725 lp .publishTimer (pvTimer , 0 , timerInactive )
726+ lp .publishEnergyStats ()
726727
727728 // charger features
728729 for _ , f := range api .FeatureValues () {
@@ -1851,6 +1852,25 @@ func (lp *Loadpoint) publishChargeProgress() {
18511852 lp .chargeEnergy .SetSocTemp (v , lp .chargerHasFeature (api .Heating ))
18521853 }
18531854 }
1855+
1856+ lp .publishEnergyStats ()
1857+ }
1858+
1859+ // publishEnergyStats publishes time-based energy statistics in Wh
1860+ func (lp * Loadpoint ) publishEnergyStats () {
1861+ if lp .chargeEnergy == nil {
1862+ return
1863+ }
1864+
1865+ stats , err := lp .chargeEnergy .EnergyStats ()
1866+ if err != nil {
1867+ lp .log .ERROR .Printf ("energy stats: %v" , err )
1868+ return
1869+ }
1870+
1871+ lp .publish (keys .TodayEnergy , math .Round (stats .Today * 1e3 ))
1872+ lp .publish (keys .Last24hEnergy , math .Round (stats .Last24h * 1e3 ))
1873+ lp .publish (keys .Last7dEnergy , math .Round (stats .Last7d * 1e3 ))
18541874}
18551875
18561876// publish state of charge, remaining charge duration and range
0 commit comments