Skip to content

Commit

Permalink
Improve EEBUS isCharging detection (evcc-io#9354)
Browse files Browse the repository at this point in the history
- Make sure the check using an external meter is identical to using an internal meter
- Fix check using internal meter to compare sum of all charge currents to idlefactor * min. single phase charge current
  • Loading branch information
DerAndereAndi authored Aug 13, 2023
1 parent 802fa15 commit 184e70d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions charger/eebus.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func (c *EEBus) isCharging() bool { // d *communication.EVSEClientDataType
if timeDiff.Seconds() >= 10 {
c.lastIsChargingCheck = time.Now()
c.lastIsChargingResult = false
// compare charge power for all phases to 0.6 * min. charge power of a single phase
if c.lp.GetChargePower() > c.lp.GetMinPower()*idleFactor {
c.lastIsChargingResult = true
return true
Expand All @@ -207,21 +208,20 @@ func (c *EEBus) isCharging() bool { // d *communication.EVSEClientDataType
return false
}
limitsMin, _, _, err := c.emobility.EVCurrentLimits()
if err != nil {
if err != nil || limitsMin == nil || len(limitsMin) == 0 {
return false
}

for index, phaseCurrent := range currents {
if len(limitsMin) <= index {
break
}
limitMin := limitsMin[index]
if phaseCurrent > limitMin*idleFactor {
return true
}
var phasesCurrent float64
for _, phaseCurrent := range currents {
phasesCurrent += phaseCurrent
}

return false
// require sum of all phase currents to be > 0.6 * a single phase minimum
// in some scenarions, e.g. Cayenne Hybrid, sometimes the meter of a PMCC device
// reported 600W, even tough the car was not charging
limitMin := limitsMin[0]
return phasesCurrent > limitMin*idleFactor
}

func (c *EEBus) updateState() (api.ChargeStatus, error) {
Expand Down

0 comments on commit 184e70d

Please sign in to comment.