Go-E: fix session energy reset on disconnect (BC) (#5119)

This commit is contained in:
andig 2022-11-10 11:47:04 +01:00 • committed by GitHub
parent f236ba7253
commit 65c11a7d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 12 deletions

View file

@ -77,15 +77,12 @@ func NewGoE(uri, token string, cache time.Duration) (api.Charger, error) {
c.api = goe.NewLocal(log, util.DefaultScheme(uri, "http"), cache)
}
if c.api.IsV2() {
var phases func(int) error
if sponsor.IsAuthorized() {
phases = c.phases1p3p
} else {
log.WARN.Println("automatic 1p3p phase switching requires sponsor token")
}
if !sponsor.IsAuthorized() {
return nil, api.ErrSponsorRequired
}
return decorateGoE(c, c.totalEnergy, phases), nil
if c.api.IsV2() {
return decorateGoE(c, c.totalEnergy, c.phases1p3p), nil
}
return c, nil

View file

@ -36,6 +36,8 @@ func TestGoEV1(t *testing.T) {
h := &handler{}
srv := httptest.NewServer(h)
sponsor.Subject = "foo"
wb, err := NewGoE(srv.URL, "", 0)
if err != nil {
t.Error(err)

View file

@ -1523,7 +1523,11 @@ func (lp *LoadPoint) updateChargeCurrents() {
// publish charged energy and duration
func (lp *LoadPoint) publishChargeProgress() {
if f, err := lp.chargeRater.ChargedEnergy(); err == nil {
lp.setChargedEnergy(1e3 * f) // convert to Wh
// workaround for Go-E resetting during disconnect, see
// https://github.com/evcc-io/evcc/issues/5092
if f > 0 {
lp.setChargedEnergy(1e3 * f) // convert to Wh
}
} else {
lp.log.ERROR.Printf("charge rater: %v", err)
}

View file

@ -9,12 +9,13 @@ requirements:
de: |
Benötigt mindestens Firmware 052.1 oder neuer.
Für 1P/3P-Phasenumschaltung muss die HTTP API v2 im Charger aktiviert sein und es wird ein Sponsortoken benötigt. 💚
Für 1P/3P-Phasenumschaltung muss die HTTP API v2 im Charger aktiviert sein.
en: |
Requires firmware 052.1 or later.
For 1P/3P-Phase switching the HTTP API v2 in the charger setup needs to be activated and a sponsor token is required. 💚
For 1P/3P-Phase switching the HTTP API v2 in the charger setup needs to be activated.
uri: https://docs.evcc.io/docs/devices/chargers#go-echarger
evcc: ["sponsorship"]
params:
- name: host
render: |

View file

@ -8,6 +8,7 @@ requirements:
description:
en: Requires firmware 040.0 or later.
de: Benötigt mindestens Firmware 040.0 oder neuer.
evcc: ["sponsorship"]
params:
- name: host
render: |

View file

@ -2,10 +2,11 @@ product:
brand: go-eCharger
description: HOME+, HOMEfix (V3)
capabilities: ["1p3p", "rfid"]
requirements: ["sponsorship"]
description: |
Benötigt mindestens Firmware 052.1 oder neuer.
Für 1P/3P-Phasenumschaltung muss die HTTP API v2 im Charger aktiviert sein und es wird ein Sponsortoken benötigt. 💚
Für 1P/3P-Phasenumschaltung muss die HTTP API v2 im Charger aktiviert sein.
render:
- default: |

View file

@ -2,6 +2,7 @@ product:
brand: go-eCharger
description: HOME+, HOMEfix, Pro
capabilities: ["rfid"]
requirements: ["sponsorship"]
description: |
Benötigt mindestens Firmware 040.0 oder neuer.
render: