From bb0c4344f5a542f5bfad0ebdf614ac630cce31c2 Mon Sep 17 00:00:00 2001 From: florinmihut Date: Tue, 22 Oct 2024 11:09:17 +0200 Subject: [PATCH] Fix for providing powermeter public key (#924) * Fix for providing powermeter public key - the key was missing in the transaction data and from the interface. EVSE Manager has to republish the key which is needed by other modules. --------- Signed-off-by: florinmihut --- interfaces/evse_manager.yaml | 7 +++++-- modules/EvseManager/evse/evse_managerImpl.cpp | 6 +++++- modules/LemDCBM400600/main/lem_dcbm_400600_controller.cpp | 1 + modules/LemDCBM400600/main/powermeterImpl.cpp | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/interfaces/evse_manager.yaml b/interfaces/evse_manager.yaml index 39c14a01e..2f4a439e2 100644 --- a/interfaces/evse_manager.yaml +++ b/interfaces/evse_manager.yaml @@ -26,7 +26,7 @@ cmds: type: boolean authorize_response: description: >- - Reports the result of an authorization request to the EvseManager. + Reports the result of an authorization request to the EvseManager. Contains the provided_token for which authorization was requested and the validation_result arguments: @@ -150,6 +150,9 @@ vars: description: Measured dataset type: object $ref: /powermeter#/Powermeter + powermeter_public_key_ocmf: + description: Powermeter public key + type: string evse_id: description: EVSE ID including the connector number, e.g. DE*PNX*E123456*1 type: string @@ -159,7 +162,7 @@ vars: $ref: /evse_board_support#/HardwareCapabilities iso15118_certificate_request: description: >- - The vehicle requests the SECC to deliver the certificate that belong + The vehicle requests the SECC to deliver the certificate that belong to the currently valid contract of the vehicle. Response will be reported async via set_get_certificate_response type: object diff --git a/modules/EvseManager/evse/evse_managerImpl.cpp b/modules/EvseManager/evse/evse_managerImpl.cpp index 168b678c5..a6b205615 100644 --- a/modules/EvseManager/evse/evse_managerImpl.cpp +++ b/modules/EvseManager/evse/evse_managerImpl.cpp @@ -112,10 +112,14 @@ void evse_managerImpl::init() { // /Interface to Node-RED debug UI if (mod->r_powermeter_billing().size() > 0) { - mod->r_powermeter_billing()[0]->subscribe_powermeter([this](const types::powermeter::Powermeter p) { + mod->r_powermeter_billing()[0]->subscribe_powermeter([this](const types::powermeter::Powermeter& p) { // Republish data on proxy powermeter struct publish_powermeter(p); }); + mod->r_powermeter_billing()[0]->subscribe_public_key_ocmf([this](const std::string& public_key_ocmf) { + // Republish data on proxy powermeter public_key_ocmf + publish_powermeter_public_key_ocmf(public_key_ocmf); + }); } } diff --git a/modules/LemDCBM400600/main/lem_dcbm_400600_controller.cpp b/modules/LemDCBM400600/main/lem_dcbm_400600_controller.cpp index bb54e6f36..7416668d7 100644 --- a/modules/LemDCBM400600/main/lem_dcbm_400600_controller.cpp +++ b/modules/LemDCBM400600/main/lem_dcbm_400600_controller.cpp @@ -176,6 +176,7 @@ LemDCBM400600Controller::stop_transaction(const std::string& transaction_id) { this->request_device_to_stop_transaction(tid); } auto signed_meter_value = types::units_signed::SignedMeterValue{fetch_ocmf_result(tid), "", "OCMF"}; + signed_meter_value.public_key.emplace(public_key_ocmf); return types::powermeter::TransactionStopResponse{types::powermeter::TransactionRequestStatus::OK, {}, // Empty start_signed_meter_value signed_meter_value}; diff --git a/modules/LemDCBM400600/main/powermeterImpl.cpp b/modules/LemDCBM400600/main/powermeterImpl.cpp index d08c3184e..7a074f227 100644 --- a/modules/LemDCBM400600/main/powermeterImpl.cpp +++ b/modules/LemDCBM400600/main/powermeterImpl.cpp @@ -32,11 +32,11 @@ void powermeterImpl::init() { void powermeterImpl::ready() { // Start the live_measure_publisher thread, which periodically publishes the live measurements of the device this->live_measure_publisher_thread = std::thread([this] { - this->publish_public_key_ocmf(this->controller->get_public_key_ocmf()); while (true) { try { if (!this->controller->is_initialized()) { this->controller->init(); + this->publish_public_key_ocmf(this->controller->get_public_key_ocmf()); std::this_thread::sleep_for( std::chrono::milliseconds(mod->config.resilience_initial_connection_retry_delay)); } else {