Skip to content

Commit

Permalink
Ocpp: re-add current getter
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Sep 16, 2024
1 parent 3eb1ae0 commit 98c26c4
Show file tree
Hide file tree
Showing 2 changed files with 941 additions and 73 deletions.
12 changes: 6 additions & 6 deletions charger/ocpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ func NewOCPPFromConfig(other map[string]interface{}) (api.Charger, error) {
phasesS = c.phases1p3p
}

// var currentG func() (float64, error)
// if c.cp.HasMeasurement(types.MeasurandCurrentOffered) {
// currentG = c.conn.GetMaxCurrent
// }
var currentG func() (float64, error)
if c.cp.HasMeasurement(types.MeasurandCurrentOffered) {
currentG = c.conn.GetMaxCurrent
}

return decorateOCPP(c, powerG, totalEnergyG, currentsG, voltagesG, phasesS, socG), nil
return decorateOCPP(c, powerG, totalEnergyG, currentsG, voltagesG, currentG, phasesS, socG), nil
}

//go:generate go run ../cmd/tools/decorate.go -f decorateOCPP -b *OCPP -r api.Charger -t "api.Meter,CurrentPower,func() (float64, error)" -t "api.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.Battery,Soc,func() (float64, 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.MeterEnergy,TotalEnergy,func() (float64, error)" -t "api.PhaseCurrents,Currents,func() (float64, float64, float64, error)" -t "api.PhaseVoltages,Voltages,func() (float64, float64, float64, error)" -t "api.CurrentGetter,GetMaxCurrent,func() (float64, error)" -t "api.PhaseSwitcher,Phases1p3p,func(int) error" -t "api.Battery,Soc,func() (float64, error)"

// NewOCPP creates OCPP charger
func NewOCPP(id string, connector int, idTag string,
Expand Down
Loading

0 comments on commit 98c26c4

Please sign in to comment.