Fix negative PvPower Calcualtion if not Meter is installed.

This commit is contained in:
David 2022-07-03 10:48:11 +02:00 • committed by GitHub
parent 887394fc0e
commit e15bee407c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -353,6 +353,9 @@ func (site *Site) sitePower(totalChargePower float64) (float64, error) {
// allow using Grid and charge as estimate for pv power
if site.pvMeters == nil {
site.pvPower = totalChargePower - site.gridPower + site.ResidualPower
if site.pvPower < 0 {
site.pvPower = 0
}
site.log.DEBUG.Printf("pv power: %.0fW", site.pvPower)
site.publish("pvPower", site.pvPower)
}