From b5efa1c6bf136c3ac5bc79197d7eaed84e35bada Mon Sep 17 00:00:00 2001 From: Soumya Subramanya Date: Tue, 7 Nov 2023 15:52:05 +0100 Subject: [PATCH] get average tx end values Signed-off-by: Soumya Subramanya --- lib/ocpp/v201/evse.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ocpp/v201/evse.cpp b/lib/ocpp/v201/evse.cpp index bb363130c1..c9ecc20211 100644 --- a/lib/ocpp/v201/evse.cpp +++ b/lib/ocpp/v201/evse.cpp @@ -127,12 +127,13 @@ void Evse::open_transaction(const std::string& transaction_id, const int32_t con if (aligned_data_tx_ended_interval > 0s) { transaction->aligned_tx_ended_meter_values_timer.interval_starting_from( [this] { - auto meter_value = this->get_meter_value(); + auto meter_value = this->aligned_data_tx_end.get_values(); for (auto& item : meter_value.sampledValue) { item.context = ReadingContextEnum::Sample_Clock; } this->database_handler->transaction_metervalues_insert(this->transaction->transactionId.get(), meter_value); + this->aligned_data_tx_end.clear_values(); }, aligned_data_tx_ended_interval, std::chrono::floor(date::utc_clock::to_sys(date::utc_clock::now())));