diff --git a/dependencies.yaml b/dependencies.yaml index e306667ab..05b91fff3 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -38,7 +38,7 @@ RISE-V2G: # OCPP libocpp: git: https://github.com/EVerest/libocpp.git - git_tag: v0.8.5 + git_tag: v0.8.6 # Josev Josev: git: https://github.com/EVerest/ext-switchev-iso15118.git diff --git a/modules/API/API.cpp b/modules/API/API.cpp index 7be426569..ecee570a3 100644 --- a/modules/API/API.cpp +++ b/modules/API/API.cpp @@ -247,7 +247,7 @@ void API::init() { &session_info](types::evse_manager::SessionEvent session_event) { auto event = types::evse_manager::session_event_enum_to_string(session_event.event); if (session_event.error) { - session_info->update_state(event, types::evse_manager::error_to_string(session_event.error.value())); + session_info->update_state(event, types::evse_manager::error_enum_to_string(session_event.error.value().error_code)); } else { session_info->update_state(event, ""); } diff --git a/modules/EvseManager/Charger.cpp b/modules/EvseManager/Charger.cpp index 9273f7fde..76f85b806 100644 --- a/modules/EvseManager/Charger.cpp +++ b/modules/EvseManager/Charger.cpp @@ -162,7 +162,7 @@ void Charger::runStateMachine() { } else { // unsupported charging mode, give up here. currentState = EvseState::Error; - errorState = types::evse_manager::Error::Internal; + errorState = types::evse_manager::ErrorEnum::Internal; } if (hlc_use_5percent_current_session) { @@ -277,7 +277,7 @@ void Charger::runStateMachine() { // unsupported charging mode, give up here. EVLOG_error << "Unsupported charging mode."; currentState = EvseState::Error; - errorState = types::evse_manager::Error::Internal; + errorState = types::evse_manager::ErrorEnum::Internal; } } else if (AuthorizedPnC()) { @@ -306,7 +306,7 @@ void Charger::runStateMachine() { // unsupported charging mode, give up here. EVLOG_error << "Unsupported charging mode."; currentState = EvseState::Error; - errorState = types::evse_manager::Error::Internal; + errorState = types::evse_manager::ErrorEnum::Internal; } } @@ -662,27 +662,27 @@ void Charger::processCPEventsIndependent(ControlPilotEvent cp_event) { break; case ControlPilotEvent::Error_E: currentState = EvseState::Error; - errorState = types::evse_manager::Error::Car; + errorState = types::evse_manager::ErrorEnum::Car; break; case ControlPilotEvent::Error_DF: currentState = EvseState::Error; - errorState = types::evse_manager::Error::CarDiodeFault; + errorState = types::evse_manager::ErrorEnum::CarDiodeFault; break; case ControlPilotEvent::Error_Relais: currentState = EvseState::Error; - errorState = types::evse_manager::Error::Relais; + errorState = types::evse_manager::ErrorEnum::Relais; break; case ControlPilotEvent::Error_RCD: currentState = EvseState::Error; - errorState = types::evse_manager::Error::RCD; + errorState = types::evse_manager::ErrorEnum::RCD; break; case ControlPilotEvent::Error_VentilationNotAvailable: currentState = EvseState::Error; - errorState = types::evse_manager::Error::VentilationNotAvailable; + errorState = types::evse_manager::ErrorEnum::VentilationNotAvailable; break; case ControlPilotEvent::Error_OverCurrent: currentState = EvseState::Error; - errorState = types::evse_manager::Error::OverCurrent; + errorState = types::evse_manager::ErrorEnum::OverCurrent; break; default: break; @@ -1049,7 +1049,7 @@ bool Charger::DeAuthorize() { return false; } -types::evse_manager::Error Charger::getErrorState() { +types::evse_manager::ErrorEnum Charger::getErrorState() { std::lock_guard lock(stateMutex); return errorState; } @@ -1182,7 +1182,7 @@ void Charger::checkSoftOverCurrent() { currentDrawnByVehicle[0], currentDrawnByVehicle[1], currentDrawnByVehicle[2], limit)); currentState = EvseState::Error; - errorState = types::evse_manager::Error::OverCurrent; + errorState = types::evse_manager::ErrorEnum::OverCurrent; } } diff --git a/modules/EvseManager/Charger.hpp b/modules/EvseManager/Charger.hpp index 2d80dd533..3252a3b51 100644 --- a/modules/EvseManager/Charger.hpp +++ b/modules/EvseManager/Charger.hpp @@ -146,7 +146,7 @@ class Charger { sigslot::signal<> signal_DC_supply_off; // Request more details about the error that happend - types::evse_manager::Error getErrorState(); + types::evse_manager::ErrorEnum getErrorState(); void processEvent(types::board_support::Event event); @@ -186,7 +186,7 @@ class Charger { EvseState getCurrentState(); sigslot::signal signalState; - sigslot::signal signalError; + sigslot::signal signalError; // /Deprecated void inform_new_evse_max_hlc_limits(const types::iso15118_charger::DC_EVSEMaximumLimits& l); @@ -230,7 +230,7 @@ class Charger { EvseState currentState; EvseState lastState; - types::evse_manager::Error errorState{types::evse_manager::Error::Internal}; + types::evse_manager::ErrorEnum errorState{types::evse_manager::ErrorEnum::Internal}; std::chrono::system_clock::time_point currentStateStarted; float ampereToDutyCycle(float ampere); diff --git a/modules/EvseManager/evse/evse_managerImpl.cpp b/modules/EvseManager/evse/evse_managerImpl.cpp index ef1b950c9..b3294da5b 100644 --- a/modules/EvseManager/evse/evse_managerImpl.cpp +++ b/modules/EvseManager/evse/evse_managerImpl.cpp @@ -224,7 +224,9 @@ void evse_managerImpl::ready() { se.transaction_finished.emplace(transaction_finished); } else if (e == types::evse_manager::SessionEventEnum::Error) { - se.error = mod->charger->getErrorState(); + types::evse_manager::Error error; + error.error_code = mod->charger->getErrorState(); + se.error = error; } se.uuid = session_uuid; @@ -252,11 +254,11 @@ void evse_managerImpl::ready() { static_cast(s)); }); - mod->charger->signalError.connect([this](types::evse_manager::Error s) { + mod->charger->signalError.connect([this](types::evse_manager::ErrorEnum s) { mod->mqtt.publish(fmt::format("everest_external/nodered/{}/state/error_type", mod->config.connector_id), static_cast(s)); mod->mqtt.publish(fmt::format("everest_external/nodered/{}/state/error_string", mod->config.connector_id), - types::evse_manager::error_to_string(s)); + types::evse_manager::error_enum_to_string(s)); }); // /Deprecated } diff --git a/modules/OCPP/OCPP.cpp b/modules/OCPP/OCPP.cpp index 19a6afb05..bc49f06c1 100644 --- a/modules/OCPP/OCPP.cpp +++ b/modules/OCPP/OCPP.cpp @@ -32,6 +32,8 @@ static ocpp::v16::ChargePointErrorCode get_ocpp_error_code(const std::string& ev return ocpp::v16::ChargePointErrorCode::EVCommunicationError; } else if (evse_error == "HLC") { return ocpp::v16::ChargePointErrorCode::EVCommunicationError; + } else if (evse_error == "NoError") { + return ocpp::v16::ChargePointErrorCode::NoError; } else { return ocpp::v16::ChargePointErrorCode::OtherError; } @@ -518,9 +520,15 @@ void OCPP::init() { } else if (event == "Error") { EVLOG_debug << "Connector#" << connector << ": " << "Received Error"; - const auto evse_error = types::evse_manager::error_to_string(session_event.error.value()); + const auto evse_error = types::evse_manager::error_enum_to_string(session_event.error.value().error_code); ocpp::v16::ChargePointErrorCode ocpp_error_code = get_ocpp_error_code(evse_error); this->charge_point->on_error(connector, ocpp_error_code); + } else if (event == "AllErrorsCleared") { + this->charge_point->on_fault(connector, ocpp::v16::ChargePointErrorCode::NoError); + } else if (event == "PermanentFault") { + const auto evse_error = types::evse_manager::error_enum_to_string(session_event.error.value().error_code); + ocpp::v16::ChargePointErrorCode ocpp_error_code = get_ocpp_error_code(evse_error); + this->charge_point->on_fault(connector, ocpp_error_code); } else if (event == "ReservationStart") { this->charge_point->on_reservation_start(connector); } else if (event == "ReservationEnd") { diff --git a/types/evse_manager.yaml b/types/evse_manager.yaml index ce3dd6b08..c13e38428 100644 --- a/types/evse_manager.yaml +++ b/types/evse_manager.yaml @@ -101,9 +101,9 @@ types: ChargingFinished: Charging is finished. Essentially the same as TransactionFinished, but emitted for clarity TransactionFinished: Signaled when the transaction finished. Transaction finishes at the point where one of the preconditions for charging irrevocably becomes false: When a user swipes to stop the transaction and the stop is authorized. SessionFinished: Session finishes at the point that the EVSE is available again (no cable plugged) - Error: Signaled when an error occured + Error: Signaled when an error occured. An error doesnt prevent further charging operations. AllErrorsCleared: Signalled when all errors are cleared - PermanentFault: Signaled when there is a permanent fault at the EVSE + PermanentFault: Signaled when there is a permanent fault at the EVSE. A permanent fault prevents further charging operations ReservationStart: Signaled when a reservation starts ReservationEnd: Signaled when a reservation ends ReplugStarted: Signaled when the EVSE Manager virtually replugs without interrupting the session or transaction @@ -208,7 +208,7 @@ types: id_tag: description: Id tag that was used to stop the transaction type: string - Error: + ErrorEnum: description: >- Details on error type Car: Signals a car error @@ -231,6 +231,22 @@ types: - Internal - SLAC - HLC + - Other + Error: + description: >- + Error object that contains information about the error and optional vendor error information + type: object + additionalProperties: false + required: + - error_code + properties: + error_code: + description: The error enum + type: string + $ref: /evse_manager#/ErrorEnum + vendor_error: + description: The error code of the vendor + type: string SessionEvent: description: Emits all events related to sessions type: object @@ -266,7 +282,7 @@ types: $ref: /evse_manager#/TransactionFinished error: description: Details on error type - type: string + type: object $ref: /evse_manager#/Error Limits: description: Limits of this EVSE