Go-E: fix session energy reset on disconnect (BC) (#5119)
This commit is contained in:
parent
f236ba7253
commit
65c11a7d12
7 changed files with 19 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: |
|
||||
|
|
|
|||
|
|
@ -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: |
|
||||
|
|
|
|||
|
|
@ -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: |
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue