Fix phase usage estimation from power (#2144)
Some checks failed
Default / Build UI (push) Failing after 2m8s
Default / Build (push) Failing after 15m4s
Release / call-build-workflow (push) Has been cancelled
Release / Publish Docker :release (push) Has been cancelled
Release / Publish Github & APT release (push) Has been cancelled

This commit is contained in:
premultiply 2021-12-29 15:18:42 +01:00 • committed by GitHub
parent 7195103d1c
commit f07b32da83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1190,7 +1190,7 @@ func (lp *LoadPoint) updateChargeCurrents() {
// guess active phases from power consumption
// assumes that chargePower has been updated before
if lp.charging() && lp.chargeCurrent > 0 {
phases := int(math.Round(lp.chargePower / Voltage / lp.chargeCurrent))
phases := int(math.Ceil(lp.chargePower / Voltage / lp.chargeCurrent))
if phases >= 1 && phases <= 3 {
lp.activePhases = phases
lp.log.DEBUG.Printf("detected phases: %dp (%.1fA @ %.0fW)", lp.activePhases, lp.chargeCurrent, lp.chargePower)