KEBA: revert phase switching state for P30 variants (#23915)

This commit is contained in:
Martin 2025-09-28 15:11:41 +02:00 • committed by GitHub
parent 3640a88549
commit b37a067f09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -44,6 +44,7 @@ type Keba struct {
current uint16
regEnable uint16
energyFactor float64
state1p uint32
}
const (
@ -117,11 +118,13 @@ func NewKebaFromConfig(ctx context.Context, other map[string]interface{}) (api.C
// P30
hasEnergyMeter = productCodeStr[4] != '0'
hasRFID = productCodeStr[5] == '1'
wb.state1p = 0
} else if len(productCodeStr) == 7 && productCodeStr[0] == '4' {
// P40
wb.regEnable = kebaRegMaxCurrent
hasEnergyMeter = productCodeStr[4] != '0'
hasRFID = productCodeStr[5] == '1'
wb.state1p = 1
b, err := wb.conn.ReadHoldingRegisters(kebaRegFirmware, 2)
if err != nil {
@ -395,7 +398,11 @@ func (wb *Keba) getPhases() (int, error) {
if err != nil {
return 0, err
}
return int(binary.BigEndian.Uint32(b)), nil
if binary.BigEndian.Uint32(b) == wb.state1p {
return 1, nil
}
return 3, nil
}
var _ api.Diagnosis = (*Keba)(nil)

View file

@ -1301,7 +1301,7 @@ func (lp *Loadpoint) pvScalePhases(sitePower, minCurrent, maxCurrent float64) in
// scale up phases
if targetCurrent := powerToCurrent(availablePower, maxPhases); targetCurrent >= minCurrent && scalable {
lp.log.DEBUG.Printf("available power %.0fW > %.0fW min %dp threshold", availablePower, 3*Voltage*minCurrent, maxPhases)
lp.log.DEBUG.Printf("available power %.0fW > %.0fW min %dp threshold", availablePower, float64(maxPhases)*Voltage*minCurrent, maxPhases)
if !lp.charging() { // scale immediately if not charging
lp.phaseTimer = elapsed