Skip to content

[OCPP] Configuration key mapping from 1.6 to 2.x#1771

Open
james-ctc wants to merge 6 commits intomainfrom
jc/ocpp-v2-v16-combined-config
Open

[OCPP] Configuration key mapping from 1.6 to 2.x#1771
james-ctc wants to merge 6 commits intomainfrom
jc/ocpp-v2-v16-combined-config

Conversation

@james-ctc
Copy link
Member

Describe your changes

This builds upon #1714 incorporating the mapping of OCPP 1.6 configuration keys into v2.x device model component and variables.

#1714 should be merged first.

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

@james-ctc james-ctc added the OCPP label Jan 26, 2026
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is no longer needed

@james-ctc james-ctc force-pushed the jc/experimental-unified-config branch 5 times, most recently from 3608e0a to 2b4c1a3 Compare February 5, 2026 10:04
@james-ctc james-ctc force-pushed the jc/ocpp-v2-v16-combined-config branch from 9194945 to 6bdb50f Compare February 10, 2026 16:23
@james-ctc james-ctc force-pushed the jc/experimental-unified-config branch 3 times, most recently from f649cff to 1eed492 Compare February 12, 2026 08:30
@james-ctc james-ctc force-pushed the jc/ocpp-v2-v16-combined-config branch from ced68ca to 3fbb6a7 Compare February 12, 2026 09:02
Base automatically changed from jc/experimental-unified-config to main February 12, 2026 09:13
@james-ctc james-ctc force-pushed the jc/ocpp-v2-v16-combined-config branch 2 times, most recently from 9705896 to b8e8ae6 Compare February 12, 2026 16:27
@james-ctc
Copy link
Member Author

#1714 has been merged so ready for review

@james-ctc james-ctc force-pushed the jc/ocpp-v2-v16-combined-config branch from 9431ea2 to d26910c Compare February 20, 2026 15:33
@Pietfried
Copy link
Contributor

This PR provides a mapping overview: #1854 . I would also be fine if this is cherry-pick and incorporated as part of this PR.

I think we need to implement this mapping in parts of the ChargePointConfigurationDeviceModel (especially where configuration keys do not map to VariableAttribute but to VariableCharacteristics (valuesList and maxLimit)

@james-ctc james-ctc force-pushed the jc/ocpp-v2-v16-combined-config branch 4 times, most recently from 2283e27 to 055ce9a Compare February 25, 2026 15:06
@james-ctc
Copy link
Member Author

I think I have addressed the PR comments - ready for re-review

@james-ctc james-ctc requested a review from Pietfried February 26, 2026 08:47
Copy link
Contributor

@Pietfried Pietfried left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some variables now map to VariableCharacteristics. This should be adressed in the respective ChargePointConfigurationDeviceModel getters and setters.

// VariableCharacteristics of valuesList are added to the set of they exist
if (entry.variableCharacteristics) {
std::optional<std::string> csl = entry.variableCharacteristics.value().valuesList;
auto vec = v16::utils::from_csl(csl.value());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misses a check if opt has a value - could lead to bad optional access.

<< cv.variable->name << '\'';
}
}
map.insert({v16, {&cv, attribute}});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not insert if the the key already exists. If we want to to replace we can use insert_or_assign or we can change the warning and ignore a duplicate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OCPP 1.6 configuration keys are unique - the warnings are raised when there is a programming error and there is more than one mapping for a OCPP 1.6 configuration key.
Assuming that the code is correct then the errors/warnings should not occur.
switching to insert_or_assign so the code matches the text of the warning.

if (const auto it = reverse_map.find(name); it != reverse_map.end()) {
EVLOG_error << "V2 " << name << ": '" << it->second << "' replaced with '" << v16 << '\'';
}
reverse_map.insert({std::move(name), v16});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same like above

extern const RequiredComponentVariable GetConfigurationMaxKeys;
extern const ComponentVariable LightIntensity;
extern const ComponentVariable MinimumStatusDuration;
extern const RequiredComponentVariable NumberOfConnectors;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined here and in line L131

} else if (is_same(SampledDataTxStartedMeasurands, component, variable)) {
add_to_list(valid_measurands, entry);
} else {
// assume custom variable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would add lots of custom configuration keys to OCPP1.6 . I am not sure if we actually want to expose them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to add a Custom16LegacyCtrlr for custom configuration keys.

list.insert({std::move(s), count++});
}
}
std::vector<std::string> OrderedUniqueStringList::get() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be const

component.evse = std::move(evse);
auto value = get_optional<std::string>(*storage, component, variable, v2::AttributeEnum::Actual);
if (value) {
found = true; // atleast one instance exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
found = true; // atleast one instance exists
found = true; // at least one instance exists

std::string result;
try {
auto profiles = json::parse(value);
result = profiles[0]["ocppCsmsUrl"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be

Suggested change
result = profiles[0]["ocppCsmsUrl"];
result = profiles[0]["connectionData"]["ocppCsmsUrl"];

At a later point we should probably backport the functionality of multiple connection profiles to OCPP1.6

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now a custom legacy key

mapping(AuthorizationKey, BasicAuthPassword, Actual) \
mapping(CertificateSignedMaxChainSize, MaxCertificateChainSize, Actual) \
mapping(CpoName, OrganizationName, Actual) \
mapping(SecurityProfile, SecurityProfile, Actual) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the SecurityProfile and the CentralSystemURI I'm not quite sure how to map those best. OCPP2.1 introduces a dedicated components for the NetworkConfiguration with the configurationSlot being the instance of the component (see chapter 2.1.8)

The OCPP1.6 SecurityProfile could also map to NetworkConnectionProfile[0]["connectionData"]["SecurityProfile"]. This property is used for the websocket connection in OCPP2.x.

The SecurityCtrlr.SecurityProfile CV is ready-only and just reports the SecurityProfile in use.

While OCPP2.x supports multiple connection profiles, OCPP1.6 does not do it so far. For now we could add CentralSystemURI and SecurityProfile to the 1.6 legacy controller and once we introduce the new NetworkConfiguration components we can add this to our migration. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to keep SecurityProfile, AuthorizationKey and CentralSystemURI in OCPP16LegacyCtrlr and to not add a mapping to those for now

Introduce mapping layer to reuse OCPP 2.x device model storage for
OCPP 1.6 implementations. Adds OCPP16MavericksCtrlr component for
1.6 configuration keys without direct 2.x equivalents.

Signed-off-by: Piet Gömpel <pietgoempel@gmail.com>

feat: add mapping between OCPP V2 and V16 configuration keys

Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
SecurityProfile, AuthorizationKey and CentralSystemURI
now in OCPP16LegacyCtrlr

Signed-off-by: James Chapman <james.chapman@pionix.de>
@james-ctc james-ctc force-pushed the jc/ocpp-v2-v16-combined-config branch from 3fb3544 to 50de8ec Compare March 5, 2026 16:48
@james-ctc
Copy link
Member Author

@Pietfried I've addressed your latest comments - assuming the CI runs okay it is ready for re-review

@james-ctc james-ctc requested a review from Pietfried March 5, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants