From b38d641cf3adf633ac4ceaa3bab1f0edbfbef920 Mon Sep 17 00:00:00 2001 From: andig Date: Mon, 12 Sep 2022 13:25:44 +0200 Subject: [PATCH] =?UTF-8?q?HardyBarth:=20add=20echarge=20brand,=20cP=CE=BC?= =?UTF-8?q?2=20(#4393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- charger/hardybarth-salia.go | 24 ++++++++++++------- .../definition/charger/hardybarth-ecb1.yaml | 5 +++- .../definition/charger/hardybarth-salia.yaml | 5 +++- templates/docs/charger/hardybarth-ecb1_0.yaml | 2 +- templates/docs/charger/hardybarth-ecb1_1.yaml | 9 +++++++ .../docs/charger/hardybarth-salia_0.yaml | 2 +- .../docs/charger/hardybarth-salia_1.yaml | 9 +++++++ templates/evcc.io/brands.json | 1 + 8 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 templates/docs/charger/hardybarth-ecb1_1.yaml create mode 100644 templates/docs/charger/hardybarth-salia_1.yaml diff --git a/charger/hardybarth-salia.go b/charger/hardybarth-salia.go index 34e55bfdb..72527b89f 100644 --- a/charger/hardybarth-salia.go +++ b/charger/hardybarth-salia.go @@ -18,6 +18,7 @@ package charger // SOFTWARE. import ( + "errors" "fmt" "net/http" "strconv" @@ -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 @@ -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 { @@ -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() diff --git a/templates/definition/charger/hardybarth-ecb1.yaml b/templates/definition/charger/hardybarth-ecb1.yaml index b11c9154c..9e26955b2 100644 --- a/templates/definition/charger/hardybarth-ecb1.yaml +++ b/templates/definition/charger/hardybarth-ecb1.yaml @@ -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: diff --git a/templates/definition/charger/hardybarth-salia.yaml b/templates/definition/charger/hardybarth-salia.yaml index c95e39878..a3d7d2785 100644 --- a/templates/definition/charger/hardybarth-salia.yaml +++ b/templates/definition/charger/hardybarth-salia.yaml @@ -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: diff --git a/templates/docs/charger/hardybarth-ecb1_0.yaml b/templates/docs/charger/hardybarth-ecb1_0.yaml index 1116b7415..fbb3cb859 100644 --- a/templates/docs/charger/hardybarth-ecb1_0.yaml +++ b/templates/docs/charger/hardybarth-ecb1_0.yaml @@ -1,6 +1,6 @@ product: brand: HardyBarth - description: cPH1 (eCB1 Controller) + description: cPH1 requirements: ["sponsorship"] render: - default: | diff --git a/templates/docs/charger/hardybarth-ecb1_1.yaml b/templates/docs/charger/hardybarth-ecb1_1.yaml new file mode 100644 index 000000000..07c4436ec --- /dev/null +++ b/templates/docs/charger/hardybarth-ecb1_1.yaml @@ -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 diff --git a/templates/docs/charger/hardybarth-salia_0.yaml b/templates/docs/charger/hardybarth-salia_0.yaml index 5c4b0b49d..6505c88fe 100644 --- a/templates/docs/charger/hardybarth-salia_0.yaml +++ b/templates/docs/charger/hardybarth-salia_0.yaml @@ -1,6 +1,6 @@ product: brand: HardyBarth - description: cPH2 (Salia PLCC Controller) + description: cPH2, cPμ2 requirements: ["sponsorship"] render: - default: | diff --git a/templates/docs/charger/hardybarth-salia_1.yaml b/templates/docs/charger/hardybarth-salia_1.yaml new file mode 100644 index 000000000..6b0552380 --- /dev/null +++ b/templates/docs/charger/hardybarth-salia_1.yaml @@ -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 diff --git a/templates/evcc.io/brands.json b/templates/evcc.io/brands.json index 1806eef6b..97988f151 100644 --- a/templates/evcc.io/brands.json +++ b/templates/evcc.io/brands.json @@ -11,6 +11,7 @@ "DaheimLaden", "Easee", "Ebee", + "echarge", "Ensto", "Etrel", "Garo",