Skip to content

Commit

Permalink
HardyBarth: add echarge brand, cPμ2 (#4393)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Sep 12, 2022
1 parent 851b3c9 commit b38d641
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 12 deletions.
24 changes: 16 additions & 8 deletions charger/hardybarth-salia.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package charger
// SOFTWARE.

import (
"errors"
"fmt"
"net/http"
"strconv"
Expand All @@ -32,7 +33,6 @@ import (
"github.com/evcc-io/evcc/util/sponsor"
)

// http://apidoc.ecb1.de
// https://github.com/evcc-io/evcc/discussions/778

// Salia charger implementation
Expand All @@ -55,13 +55,10 @@ func init() {
// NewSaliaFromConfig creates a Salia cPH2 charger from generic config
func NewSaliaFromConfig(other map[string]interface{}) (api.Charger, error) {
cc := struct {
URI string
ChargeControl int
Meter int
Cache time.Duration
URI string
Cache time.Duration
}{
ChargeControl: 1,
Meter: 1,
Cache: time.Second,
}

if err := util.DecodeOther(other, &cc); err != nil {
Expand Down Expand Up @@ -89,7 +86,18 @@ func NewSalia(uri string, cache time.Duration) (api.Charger, error) {
return nil, api.ErrSponsorRequired
}

err := wb.post(salia.ChargeMode, echarge.ModeManual)
// set chargemode manual
res, err := wb.get()
if err == nil && res.Secc.Port0.Salia.ChargeMode != echarge.ModeManual {
if err = wb.post(salia.ChargeMode, echarge.ModeManual); err == nil {
res, err = wb.get()
}

if err == nil && res.Secc.Port0.Salia.ChargeMode != echarge.ModeManual {
err = errors.New("could not change chargemode to manual")
}
}

if err == nil {
go wb.heartbeat()

Expand Down
5 changes: 4 additions & 1 deletion templates/definition/charger/hardybarth-ecb1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ template: hardybarth-ecb1
products:
- brand: HardyBarth
description:
generic: cPH1 (eCB1 Controller)
generic: cPH1
- brand: echarge
description:
generic: cPH1
requirements:
evcc: ["sponsorship"]
params:
Expand Down
5 changes: 4 additions & 1 deletion templates/definition/charger/hardybarth-salia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ template: hardybarth-salia
products:
- brand: HardyBarth
description:
generic: cPH2 (Salia PLCC Controller)
generic: cPH2, cPμ2
- brand: echarge
description:
generic: cPH2, cPμ2
requirements:
evcc: ["sponsorship"]
params:
Expand Down
2 changes: 1 addition & 1 deletion templates/docs/charger/hardybarth-ecb1_0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
product:
brand: HardyBarth
description: cPH1 (eCB1 Controller)
description: cPH1
requirements: ["sponsorship"]
render:
- default: |
Expand Down
9 changes: 9 additions & 0 deletions templates/docs/charger/hardybarth-ecb1_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
product:
brand: echarge
description: cPH1
requirements: ["sponsorship"]
render:
- default: |
type: template
template: hardybarth-ecb1
host: 192.0.2.2 # IP-Adresse oder Hostname
2 changes: 1 addition & 1 deletion templates/docs/charger/hardybarth-salia_0.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
product:
brand: HardyBarth
description: cPH2 (Salia PLCC Controller)
description: cPH2, cPμ2
requirements: ["sponsorship"]
render:
- default: |
Expand Down
9 changes: 9 additions & 0 deletions templates/docs/charger/hardybarth-salia_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
product:
brand: echarge
description: cPH2, cPμ2
requirements: ["sponsorship"]
render:
- default: |
type: template
template: hardybarth-salia
host: 192.0.2.2 # IP-Adresse oder Hostname
1 change: 1 addition & 0 deletions templates/evcc.io/brands.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"DaheimLaden",
"Easee",
"Ebee",
"echarge",
"Ensto",
"Etrel",
"Garo",
Expand Down

0 comments on commit b38d641

Please sign in to comment.