Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(charge): increase verbosity when skipping force charge #45

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/fronius/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ func ForceCharge(modbus_ip string, power_prc int16, port ...string) error {
}

} else if power_prc == 0 {
Setdefaults(modbus_ip, p)
u.Log.Info("percent of charging is <1%, skipping Force Charge and set defaults.")
err = Setdefaults(modbus_ip, p)
if err != nil {
u.Log.Errorln("Error Setting Defaults: %s ", err)
return err
}
} else {
err = errors.New("percent of charging is negative")
u.Log.Errorf("someting goes wrong when force charging, %s", err)
Expand Down
16 changes: 4 additions & 12 deletions pkg/fronius/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,10 @@ func SetFroniusChargeBatteryMode(pw_forecast float64, pw_batt2charge float64, pw
}
}

if ch_pc != 0 {
err = ForceCharge(fronius_ip, ch_pc, p)
if err != nil {
u.Log.Errorln("Error forcing charge: %s ", err)
return ch_pc, err
}
} else {
err = Setdefaults(fronius_ip, p)
if err != nil {
u.Log.Errorln("Error Setting Defaults: %s ", err)
return ch_pc, err
}
err = ForceCharge(fronius_ip, ch_pc, p)
if err != nil {
u.Log.Errorln("Error forcing charge: %s ", err)
return ch_pc, err
}

return ch_pc, nil
Expand Down
Loading