ocpp-go icon indicating copy to clipboard operation
ocpp-go copied to clipboard

Feature(s): OCPP 1.6 configuration manager

Open xBlaz3kx opened this issue 1 year ago • 5 comments

Proposed changes

Implemented OCPP 1.6 configuration manager, based on my project. Features:

  • List of mandatory and optional OCPP 1.6 configuration keys (per profile)
  • OCPP configuration key validation based on the supplied OCPP profiles
  • Custom configuration value validation
  • Update observer (triggering a function when a watched key is updated)
  • Storing and retrieving keys and their values

Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply

  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x] Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • [x] I have read the CONTRIBUTING doc
  • [ ] I have signed the CLA
  • [x] Lint and unit tests pass locally with my changes
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] I have added necessary documentation (if appropriate)
  • [x] Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

xBlaz3kx avatar Aug 01 '24 21:08 xBlaz3kx

It isn't clear to me why this needs be part of this module. If it is for sake of integration capabilities it might be better to add the required APIs here and have the implementation in a separate repo.

andig avatar Sep 06 '24 14:09 andig

It isn't clear to me why this needs be part of this module. If it is for sake of integration capabilities it might be better to add the required APIs here and have the implementation in a separate repo.

Hey @andig,

afaik, it is a part of the roadmap for this repository and I think it would be nice to have everything ocpp related included in one repository.

The configuration manager also adds configuration key validation based on the OCPP profile(s), as each OCPP profile requires some configuration keys to be present (in OCPP specs), which would allow for more standardization and ease of use.

xBlaz3kx avatar Sep 06 '24 19:09 xBlaz3kx

@lorenzodonini What are your thoughts on this feature?

xBlaz3kx avatar Mar 01 '25 15:03 xBlaz3kx

The configuration manager also adds configuration key validation based on the OCPP profile(s), as each OCPP profile requires some configuration keys to be present (in OCPP specs), which would allow for more standardization and ease of use.

It's still not clear to me what this actually does. The module already validates OCPP messages. Maybe we could clarify what "configuration management" refers to?

andig avatar Mar 30 '25 10:03 andig

The configuration manager also adds configuration key validation based on the OCPP profile(s), as each OCPP profile requires some configuration keys to be present (in OCPP specs), which would allow for more standardization and ease of use.

It's still not clear to me what this actually does. The module already validates OCPP messages. Maybe we could clarify what "configuration management" refers to?

Correct, the module only validates OCPP messages (if it conforms to the spec), but not the actual validity of the configuration itself (content, for example keys and/or values) according to business logic.

This feature would be mostly used on charge points to validate OCPP configuration keys and/or values, for example if a CPMS would send a ChangeConfiguration request and would like to change the SupportedFeatures (which is readonly and SHOULD NOT BE changed), it is the charge point's responsibility to reject the message and not this module's.

Example:

supportedProfiles := []string{core.ProfileName}
defaultConfig, err := ocpp_v16.DefaultConfigurationFromProfiles(supportedProfiles...)
if err != nil {
	log.Errorf("Error getting configuration value: %v", err)
	return
}

manager, err := ocpp_v16.NewV16ConfigurationManager(*defaultConfig, supportedProfiles...)
manager.RegisterCustomKeyValidator(func(key ocpp_v16.Key, value *string) bool {
		return key != ocpp_v16.SupportedFeatures // Prevent SupportedFeatures from being updated
})

The configuration management would provide a neat way to version and validate OCPP configuration values or keys and execute any registered callbacks when variable changes. Another useful thing is also mandatory key validation - each of the OCPP 1.6 profiles has mandatory keys that need to be present in the charge point, which the lib would validate and provide these values as a part of the module (as they're a part of the specification).

xBlaz3kx avatar Mar 30 '25 19:03 xBlaz3kx