Skip to content

Commit

Permalink
Change homeload calculation again
Browse files Browse the repository at this point in the history
  • Loading branch information
GJSBRT committed Mar 17, 2024
1 parent b55fbf8 commit e95e41f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions control/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,7 @@ func (c *Control) Start() {
metrics.SetMetricValue("control", "action", map[string]string{"action": "pull_from_grid"}, 0)

// 1. Get current home energy consumption
inverterInputPower, err := metrics.GetMetricLastEntrySum("sun2000", "input_power")
if err != nil {
c.errChannel <- err
continue
}

batteryChargingStatus, err := metrics.GetMetricLastEntrySum("luna2000", "charging_status")
inverterInputPower, err := metrics.GetMetricLastEntrySum("sun2000", "active_power")
if err != nil {
c.errChannel <- err
continue
Expand All @@ -95,7 +89,7 @@ func (c *Control) Start() {
continue
}

avgHomeLoad := (inverterInputPower * 1000) - batteryChargingStatus - powerMeterActivePower
avgHomeLoad := (inverterInputPower * 1000) - powerMeterActivePower
if avgHomeLoad < 0 {
avgHomeLoad = 0
}
Expand Down

0 comments on commit e95e41f

Please sign in to comment.