Skip to content

Commit

Permalink
OCPP: update docs (evcc-io#3669)
Browse files Browse the repository at this point in the history
Co-authored-by: xantalor <[email protected]>
  • Loading branch information
xantalor and xantalor authored Jul 10, 2022
1 parent 551b870 commit ae09fbb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 15 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Evcc is an extensible EV Charge Controller with PV integration implemented in [G
- wide range of supported [chargers](https://docs.evcc.io/docs/devices/chargers):
- ABL eMH1, Alfen (Eve), Bender (CC612/613), cFos (PowerBrain), Daheimladen, Ebee (Wallbox), Ensto (Chago Wallbox), [EVSEWifi/ smartWB](https://www.evse-wifi.de), Garo (GLB, GLB+, LS4), go-eCharger, HardyBarth (eCB1, cPH1, cPH2), Heidelberg (Energy Control), Innogy (eBox), Juice (Charger Me), KEBA/BMW, Menneckes (Amedio, Amtron Premium/Xtra, Amtron ChargeConrol), NRGkick, [openWB (includes Pro)](https://openwb.de/), Optec (Mobility One), PC Electric (includes Garo), TechniSat (Technivolt), Ubitricity (Heinz), Vestel, Wallbe, Webasto (Live), Mobile Charger Connect
- experimental EEBus support (PMCC)
- experimental OCPP support
- Build-your-own: Phoenix (includes ESL Walli), [EVSE DIN](https://www.evse-wifi.de/produkt-schlagwort/simple-evse-wb/)
- Smart-Home outlets: FritzDECT, Shelly, Tasmota, TP-Link
- wide range of supported [meters](https://docs.evcc.io/docs/devices/meters) for grid, pv, battery and charger:
Expand Down
27 changes: 13 additions & 14 deletions charger/ocpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ func init() {
// NewOCPPFromConfig creates a OCPP charger from generic config
func NewOCPPFromConfig(other map[string]interface{}) (api.Charger, error) {
cc := struct {
StationId string
IdTag string
Connector int
MeterSupported bool
MeterInterval time.Duration
InitialReset core.ResetType
StationId string
IdTag string
Connector int
Meter bool
MeterInterval time.Duration
InitialReset core.ResetType
}{
Connector: 1,
MeterInterval: 0, // disable meter sample data as we are taking care on our own
Connector: 1,
}

if err := util.DecodeOther(other, &cc); err != nil {
Expand All @@ -58,7 +57,7 @@ func NewOCPPFromConfig(other map[string]interface{}) (api.Charger, error) {
return nil, fmt.Errorf("unknown configuration option detected for reset: %s", cc.InitialReset)
}

ocpp, err := NewOCPP(cc.StationId, cc.Connector, cc.IdTag, cc.MeterSupported, cc.MeterInterval, cc.InitialReset)
ocpp, err := NewOCPP(cc.StationId, cc.Connector, cc.IdTag, cc.Meter, cc.MeterInterval, cc.InitialReset)
if err != nil {
return ocpp, err
}
Expand All @@ -69,7 +68,7 @@ func NewOCPPFromConfig(other map[string]interface{}) (api.Charger, error) {
chargeRater func() (float64, error)
)

if cc.MeterSupported {
if cc.Meter {
meter = ocpp.currentPower
meterCurrent = ocpp.currents
chargeRater = ocpp.chargedEnergy
Expand All @@ -81,8 +80,8 @@ func NewOCPPFromConfig(other map[string]interface{}) (api.Charger, error) {
//go:generate go run ../cmd/tools/decorate.go -f decorateOCPP -b *OCPP -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterCurrent,Currents,func() (float64, float64, float64, error)" -t "api.ChargeRater,ChargedEnergy,func() (float64, error)"

// NewOCPP creates OCPP charger
func NewOCPP(id string, connector int, idtag string, meterSupported bool, meterInterval time.Duration, initialReset core.ResetType) (*OCPP, error) {
cp := ocpp.Instance().Register(id, meterSupported)
func NewOCPP(id string, connector int, idtag string, hasMeter bool, meterInterval time.Duration, initialReset core.ResetType) (*OCPP, error) {
cp := ocpp.Instance().Register(id, hasMeter)
c := &OCPP{
log: util.NewLogger(fmt.Sprintf("ocpp-%s:%d", id, connector)),
cp: cp,
Expand Down Expand Up @@ -142,7 +141,7 @@ func NewOCPP(id string, connector int, idtag string, meterSupported bool, meterI
}
}

if meterSupported {
if hasMeter {
if meterValuesSampledDataString != "Current.Import,Current.Offered,Energy.Active.Import.Register,Power.Active.Import,Temperature" {
c.log.TRACE.Printf("Current values \n\t%s != \n\t%+v", ocpp.ValuePreferedMeterValuesSampleData, meterValuesSampledDataString)
rc = make(chan error, 1)
Expand Down Expand Up @@ -182,7 +181,7 @@ func NewOCPP(id string, connector int, idtag string, meterSupported bool, meterI
}

// get inital meter values
if meterSupported {
if hasMeter {
ocpp.Instance().TriggerMeterValueRequest(cp)
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- charger: all charger templates
- meter: all meter templates
- vehicle: all vehicle templates
- docs: content is generated via `go generate ./..` using the above templates for the evcc documentation page to be used
- docs: content is generated via `go generate ./...` using the above templates for the evcc documentation page to be used

## Template Documentation

Expand Down
55 changes: 55 additions & 0 deletions templates/definition/charger/ocpp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
template: ocpp
products:
- description:
de: OCPP v1.6 kompatible Wallbox mit Smart Charging Profile
en: OCPP v1.6 compatible charger with smart charging profile
group: generic
requirements:
description:
de: |
Voraussetzungen:
* Löschen zuvor konfigurierter Ladeprofile (z.B. durch ein anderes Backend)
* Konfiguration des Backends der Wallbox: `ws://evcc.local:8887/`
en: |
Requirements:
* Deletion prior configured load profiles (e.g. from another backend)
* Backend configuration of the charger: `ws://evcc.local:8887/`
params:
- name: stationid
required: true
help:
en: The charger's unique station id
de: Die Stations-ID der Wallbox
example: EVB-P12354
- name: connector
default: 1
valuetype: int
advanced: true
help:
en: Connector number, usually 1 for first connector.
de: Verwendeter Ladepunkt, normalerweise 1 für den ersten Anschluss.
- name: meter
default: false
valuetype: bool
help:
en: Use of the integrated meter (if present)
de: Verwendung des integrierten Zählers (falls vorhanden)
- name: idtag
valuetype: string
advanced: true
help:
en: RFID token used for transactions (currently no authorization implemented)
de: ID des Tokens, welcher für Ladevorgänge genutzt werden soll, (aktuell nicht für Autorisierung verwendet) e.g
example: 04E6B78921BBA0
render: |
type: ocpp
stationid: {{ .stationid }}
{{- if ne .connector "1 "}}
connector: {{ .connector }}
{{- end }}
{{- if ne .idtag "" }}
idtag: {{ .idtag }}
{{- end }}
{{- if ne .meter "false" }}
meter: {{ .meter }}
{{- end }}
21 changes: 21 additions & 0 deletions templates/docs/charger/ocpp_0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
product:
description: OCPP v1.6 kompatible Wallbox mit Smart Charging Profile
group: Generische Unterstützung
description: |
Voraussetzungen:
* Löschen zuvor konfigurierter Ladeprofile (z.B. durch ein anderes Backend)
* Konfiguration des Backends der Wallbox: `ws://evcc.local:8887/`
render:
- default: |
type: template
template: ocpp
stationid: EVB-P12354 # Die Stations-ID der Wallbox
meter: false # Verwendung des integrierten Zählers (falls vorhanden) # Optional
advanced: |
type: template
template: ocpp
stationid: EVB-P12354 # Die Stations-ID der Wallbox
connector: 1 # Verwendeter Ladepunkt, normalerweise 1 für den ersten Anschluss. # Optional
meter: false # Verwendung des integrierten Zählers (falls vorhanden) # Optional
idtag: 04E6B78921BBA0 # ID des Tokens, welcher für Ladevorgänge genutzt werden soll, (aktuell nicht für Autorisierung verwendet) e.g # Optional

0 comments on commit ae09fbb

Please sign in to comment.