Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.

Add helpers to set charge point common data#1026

Merged
hikinggrass merged 1 commit intoEVerest:mainfrom
mhei:feature/charger_information_for_2025-03-28
Jul 14, 2025
Merged

Add helpers to set charge point common data#1026
hikinggrass merged 1 commit intoEVerest:mainfrom
mhei:feature/charger_information_for_2025-03-28

Conversation

@mhei
Copy link
Copy Markdown
Contributor

@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

Copy link
Copy Markdown
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 thread include/ocpp/v16/charge_point_impl.hpp Outdated
Comment on lines +416 to +426
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
Copy Markdown
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

}
}

void ChargePointConfiguration::setChargepointInformation(const std::string& chargePointVendor,
Copy link
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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.

@Pietfried
Copy link
Copy Markdown
Contributor

Hi @mhei , are you planning to revisit this? Feel free to let us know if you need help with finishing this off

@mhei
Copy link
Copy Markdown
Contributor Author

mhei commented May 23, 2025

Hi @Pietfried , I just need more free time 😄 Actually, I rebased my working setup to latest main branch yesterday evening and I plan to work on it this weekend.
But one question came to my mind during rework: what would you prefer: a single setChargepointInformation method with all arguments, most of them as optional ones, or two/three methods... one for the common data, one for the meter related data and one for the modem related data? I tend to split into three, but I wondering what do you prefer?

@mhei mhei force-pushed the feature/charger_information_for_2025-03-28 branch from 2b58c86 to e87c465 Compare May 26, 2025 05:37
@mhei mhei force-pushed the feature/charger_information_for_2025-03-28 branch from e87c465 to 3005966 Compare June 7, 2025 13:08
Copy link
Copy Markdown
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 picking this up again! I like your decision of spliting the update into three separate methods and the general structure of the PR looks good!

I would prefer that you use just std::optional instead of NullOrOptionalString because it is more in line with the existing interface and implementation. I know that this provides a little less flexibility because it doesnt allow the consumer to clear exsting keys, but the existing interface also doesnt allow this and afaics the companion PR in everest-core also can not make use of the clearing functionality anyways.

We are considering to refactor the whole configuration interface and implementation at some point and this is easier to do that if there aren't multiple approaches to updating config keys.

My suggestion is to:

  • update the value if the optional is set
  • keep the existing value if the optional is not set

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

For this, 3 new methods are introduced which covers the
three common data domains like general common data,
modem and meter related data.

Signed-off-by: Michael Heimpold <[email protected]>
@mhei
Copy link
Copy Markdown
Contributor Author

mhei commented Jun 10, 2025

Hi @Pietfried , I agree to your approach and reworked it as you suggested. Now I squashed all into a single commit, I think/hope it will make the review easier. Indeed, the companion PR only use a subset of this new functionality, but I expect there additional reviews and a possible rework, too. Let's see.

@mhei mhei force-pushed the feature/charger_information_for_2025-03-28 branch from 3005966 to e51ee78 Compare June 10, 2025 20:36
Copy link
Copy Markdown
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.

Thanks for applying the changes, lgtm!

@hikinggrass hikinggrass merged commit bc6ecb2 into EVerest:main Jul 14, 2025
9 of 10 checks passed
@mhei mhei deleted the feature/charger_information_for_2025-03-28 branch July 21, 2025 10:29
stephenredhat pushed a commit to stephenredhat/libocpp that referenced this pull request Aug 11, 2025
The idea is to overwrite this data later, for example
if other data sources are available than those available
at the time of initialization.

For this, 3 new methods are introduced which covers the
three common data domains like general common data,
modem and meter related data.

Signed-off-by: Michael Heimpold <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants