Powerwall: fix Wh to kWh conversion (#6103)

This commit is contained in:
andig 2023-02-08 10:53:27 +01:00 • committed by GitHub
parent d073107785
commit cfb4ef1c92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,7 @@ func NewPowerWall(uri, usage, user, password string) (api.Meter, error) {
}
batteryCapacity = func() float64 {
return float64(res.NominalFullPackEnergy)
return float64(res.NominalFullPackEnergy) / 1e3
}
}
@ -125,9 +125,9 @@ func (m *PowerWall) totalEnergy() (float64, error) {
if o, ok := res[m.usage]; ok {
switch m.usage {
case "load":
return float64(o.EnergyImported), nil
return float64(o.EnergyImported) / 1e3, nil
case "solar":
return float64(o.EnergyExported), nil
return float64(o.EnergyExported) / 1e3, nil
}
}