diff --git a/include/ocpp/v201/charge_point.hpp b/include/ocpp/v201/charge_point.hpp index b34095350..9d9e7aa08 100644 --- a/include/ocpp/v201/charge_point.hpp +++ b/include/ocpp/v201/charge_point.hpp @@ -735,7 +735,7 @@ class ChargePoint : public ChargePointInterface, private ocpp::ChargingStationBa std::shared_ptr smart_charging_handler; void handle_message(const EnhancedMessage& message); - void load_charging_profiles(); + void clear_invalid_charging_profiles(); public: /// \brief Construct a new ChargePoint object diff --git a/lib/ocpp/v201/charge_point.cpp b/lib/ocpp/v201/charge_point.cpp index cf82fbf5f..3f21e6ef5 100644 --- a/lib/ocpp/v201/charge_point.cpp +++ b/lib/ocpp/v201/charge_point.cpp @@ -183,8 +183,8 @@ void ChargePoint::start(BootReasonEnum bootreason) { // get transaction messages from db (if there are any) so they can be sent again. this->message_queue->get_persisted_messages_from_db(); this->boot_notification_req(bootreason); - // K01.27 - call load_charging_profiles when system boots - this->load_charging_profiles(); + // call clear_invalid_charging_profiles when system boots + this->clear_invalid_charging_profiles(); this->connectivity_manager->start(); const std::string firmware_version = @@ -4432,19 +4432,15 @@ void ChargePoint::execute_change_availability_request(ChangeAvailabilityRequest } } -// K01.27 - load profiles from database -void ChargePoint::load_charging_profiles() { +void ChargePoint::clear_invalid_charging_profiles() { try { auto evses = this->database_handler->get_all_charging_profiles_group_by_evse(); EVLOG_info << "Found " << evses.size() << " evse in the database"; for (const auto& [evse_id, profiles] : evses) { for (auto profile : profiles) { try { - if (this->smart_charging_handler->validate_profile(profile, evse_id) == + if (this->smart_charging_handler->validate_profile(profile, evse_id) != ProfileValidationResultEnum::Valid) { - this->smart_charging_handler->add_profile(profile, evse_id); - } else { - // delete if not valid anymore this->database_handler->delete_charging_profile(profile.id); } } catch (const QueryExecutionException& e) {