HardyBarth: add template (#2891)

This commit is contained in:
andig 2022-03-15 13:39:26 +00:00 • committed by GitHub
parent 616514a741
commit 3cb9bacf70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 5 deletions

View file

@ -25,9 +25,10 @@ import (
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/charger/echarge"
"github.com/evcc-io/evcc/charger/obis"
"github.com/evcc-io/evcc/meter/obis"
"github.com/evcc-io/evcc/util"
"github.com/evcc-io/evcc/util/request"
"github.com/evcc-io/evcc/util/sponsor"
)
// http://apidoc.ecb1.de
@ -66,7 +67,7 @@ func NewHardyBarthFromConfig(other map[string]interface{}) (api.Charger, error)
// NewHardyBarth creates HardyBarth charger
func NewHardyBarth(uri string, chargecontrol, meter int) (api.Charger, error) {
log := util.NewLogger("hardybarth")
log := util.NewLogger("hardy")
wb := &HardyBarth{
Helper: request.NewHelper(log),
@ -76,9 +77,9 @@ func NewHardyBarth(uri string, chargecontrol, meter int) (api.Charger, error) {
current: 6,
}
// if !sponsor.IsAuthorized() {
// return nil, api.ErrSponsorRequired
// }
if !sponsor.IsAuthorized() {
return nil, api.ErrSponsorRequired
}
uri = fmt.Sprintf("%s/api/v1/chargecontrols/%d/mode", wb.uri, wb.chargecontrol)
data := url.Values{"mode": {echarge.ModeManual}}

View file

@ -0,0 +1,12 @@
template: hardybarth-cph1
products:
- brand: hardybarth-cph1
description:
generic: HardyBarth cPH1
params:
- name: host
required: true
example: 192.0.2.2
render: |
type: hardybarth
uri: http://{{ .host }}

View file

@ -0,0 +1,9 @@
product:
brand: hardybarth-cph1
description: HardyBarth cPH1
render:
- default: |
type: template
template: hardybarth-cph1
host: 192.0.2.2 # IP-Adresse oder Hostname