-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix potential crashes and fix TxProfile during transaction #299
Conversation
This was a bit too strict since it does reject some valid charging profiles (like TxProfiles that omit the transaction id) Signed-off-by: Kai-Uwe Hermann <[email protected]>
…ibocpp Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
* Smart charging: set ignore_no_transaction in validate_profile call This was a bit too strict since it does reject some valid charging profiles (like TxProfiles that omit the transaction id) * Log an error if attempting to stop a transaction that is unknown to libocpp * Check if websocket is nullptr in authorize_id_token Signed-off-by: Kai-Uwe Hermann <[email protected]>
@@ -1865,7 +1865,7 @@ void ChargePointImpl::handleSetChargingProfileRequest(ocpp::Call<SetChargingProf | |||
<< call.msg.csChargingProfiles.chargingProfilePurpose; | |||
response.status = ChargingProfileStatus::Rejected; | |||
} else if (this->smart_charging_handler->validate_profile( | |||
profile, connector_id, false, this->configuration->getChargeProfileMaxStackLevel(), | |||
profile, connector_id, true, this->configuration->getChargeProfileMaxStackLevel(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows TxProfile(s) without a transaction_id, which I consider invalid for a SetChargingProfile.req .
The purpose of the ignore_no_transaction flag was to allow ChargingProfiles as part of RemoteStartTransaction.req messages, because in that case no transaction is active yet: https://github.com/EVerest/libocpp/blob/main/lib/ocpp/v16/charge_point_impl.cpp#L1606
Can you ellaborate why this had to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a part of the OCPP 1.6 spec that unfortunately leaves room for interpretation. Maybe we should keep this behavior behind an additional configuration key though.
The relevant section in the 1.6 spec (page 54 in edition 2 FINAL, 2017-09-28):
To prevent mismatch between transactions and a TxProfile, The Central System SHALL include the transactionId in a SetChargingProfile.req if the profile applies to a specific transaction.
If the CSMS just wants to limit a connector during a transaction (just for this transaction) but doesn't care about the specific transaction, at least in my interpretation, it is valid to not include the transaction id
No description provided.