diff --git a/modules/API/API.cpp b/modules/API/API.cpp index f681452f9..1917c71c1 100644 --- a/modules/API/API.cpp +++ b/modules/API/API.cpp @@ -490,10 +490,8 @@ void API::init() { } }); - this->r_ocpp.at(0)->subscribe_charging_schedules([this, &var_ocpp_schedule](json schedule) { - std::scoped_lock lock(ocpp_data_mutex); - this->ocpp_charging_schedule = schedule; - }); + this->r_ocpp.at(0)->subscribe_charging_schedules( + [this, &var_ocpp_schedule](json schedule) { this->mqtt.publish(var_ocpp_schedule, schedule.dump()); }); } std::string var_info = api_base + "info/var/info"; @@ -519,7 +517,6 @@ void API::init() { { std::scoped_lock lock(ocpp_data_mutex); this->mqtt.publish(var_ocpp_connection_status, this->ocpp_connection_status); - this->mqtt.publish(var_ocpp_schedule, ocpp_charging_schedule.dump()); } next_tick += NOTIFICATION_PERIOD; diff --git a/modules/API/API.hpp b/modules/API/API.hpp index 8f51ab425..6568800f1 100644 --- a/modules/API/API.hpp +++ b/modules/API/API.hpp @@ -188,7 +188,6 @@ class API : public Everest::ModuleBase { std::unique_ptr limit_decimal_places; std::mutex ocpp_data_mutex; - json ocpp_charging_schedule; std::string ocpp_connection_status = "unknown"; // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 };