KEBA: revert phase switching state for P30 variants (#23915)
This commit is contained in:
parent
3640a88549
commit
b37a067f09
2 changed files with 9 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue