Ocpp: Alfen: override idtag with plug&charge setting (#5021)

This commit is contained in:
tarelda 2022-11-02 15:48:25 +01:00 • committed by GitHub
parent 8db2d1b5a0
commit 24f49585b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -32,6 +32,8 @@ type OCPP struct {
phaseSwitching bool
}
const defaultIdTag = "evcc"
func init() {
registry.Add("ocpp", NewOCPPFromConfig)
}
@ -50,7 +52,7 @@ func NewOCPPFromConfig(other map[string]interface{}) (api.Charger, error) {
Timeout time.Duration
}{
Connector: 1,
IdTag: "evcc",
IdTag: defaultIdTag,
Timeout: time.Minute,
}
@ -192,6 +194,12 @@ func NewOCPP(id string, connector int, idtag string, meterValues string, meterIn
if val, err = strconv.ParseBool(*opt.Value); err == nil {
c.phaseSwitching = val
}
case ocpp.KeyAlfenPlugAndChargeIdentifier:
if c.idtag == defaultIdTag {
c.idtag = *opt.Value
c.log.DEBUG.Printf("overriding default `idTag` with Alfen-specific value: %s", c.idtag)
}
}
if err != nil {

View file

@ -27,6 +27,9 @@ const (
KeyChargingScheduleMaxPeriods = "ChargingScheduleMaxPeriods"
KeyConnectorSwitch3to1PhaseSupported = "ConnectorSwitch3to1PhaseSupported"
KeyMaxChargingProfilesInstalled = "MaxChargingProfilesInstalled"
// Alfen specific keys
KeyAlfenPlugAndChargeIdentifier = "PlugAndChargeIdentifier"
)
type CP struct {