Skip to content

Add helpers to set charge point common data #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mhei
Copy link

@mhei mhei commented Mar 30, 2025

Describe your changes

The idea is to overwrite this data later, for example if other data sources are available than those available at the time of initialization. This PR adds the required helper methods for the OCPP 1.6 implementation.

Note: since I currently only have a OCPP 1.6 test environment at hand and my knowledge about OCPP 2.x is still limited, help with OCPP 2.x part would be welcome.

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
  • If OCPP 2.0.1 or OCPP2.1: I have updated the OCPP 2.x status document
  • I read the contribution documentation and made sure that my changes meet its requirements

The idea is to overwrite this data later, for example
if other data sources are available than those available
at the time of initialization.

Signed-off-by: Michael Heimpold <[email protected]>
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.

Hi @mhei , thanks for adding this extension! Please see the comments in line.

Comment on lines +416 to +418
void update_chargepoint_information(const std::string& chargepoint_vendor, const std::string& chargepoint_model,
const std::string& chargepoint_serialnumber,
const std::optional<std::string>& firmware_version);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would prefer vendor, model, serialnumber since `chargepoint is already part of the function name

@@ -262,6 +262,18 @@ void ChargePointConfiguration::init_supported_measurands() {
}
}

void ChargePointConfiguration::setChargepointInformation(const std::string& chargePointVendor,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add other properties of the BootNotification as well:

  • iccid
  • imsi
  • meterSerialNumber
  • meterType
  • chargeBoxSerialNumber

Copy link
Author

Choose a reason for hiding this comment

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

ok, will add as std::optional parameter

Comment on lines +269 to +274
this->config["Internal"]["ChargePointVendor"] = chargePointVendor;
this->config["Internal"]["ChargePointModel"] = chargePointModel;
this->config["Internal"]["ChargePointSerialNumber"] = chargePointSerialNumber;
if (firmwareVersion.has_value()) {
this->config["Internal"]["FirmwareVersion"] = firmwareVersion.value();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to persist these changes they need to be written into the user_config.json. This can be done using the set_in_user_config function.

Copy link
Author

Choose a reason for hiding this comment

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

I guess you refer to ChargePointConfiguration::setInUserConfig ? Hm, I'm unsure about this. When I call this function for each parameter, then this would result in multiple writes to the same file on disk. So if you insist that this should be made persistent, then I'd merge this functionality into a combined write.

But on the other hand: in my target use-case, it is not necessary to make these changes persistent since this function would be called during each boot and thus the data is always refreshed. Actually, the idea behind is that there is some common place outside the EVerest environment where such common charger data is stored permanently. Thus storing it again in the OCPP configuration file would not make sense, and especially not for e.g. IMSI or meter serial number (components which could be replaced during e.g maintenance...).

On the other hand, it would be written anyway as part of yet another key change...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I was indeed refering to setInUserConfig.

I understand your use case, but libocpp itself is not aware of your target use case that calls the function on each boot, so I would like to treat the changes of these configuration keys like all the others. Otherwise this functionality should rather go into the start function or the ChargePoint constructor.

Of course you can merge the persisting functionality into a combined write. We are aware that the configuration handling for ocpp1.6 has some room for improvements in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants