Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise a CommunicationFault if we can't communicate with the LEM modul… #790

Merged
merged 6 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions modules/LemDCBM400600/main/powermeterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,23 @@ void powermeterImpl::ready() {
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
try {
this->publish_powermeter(this->controller->get_powermeter());
// if the communication error is set, clear the error
if (this->error_state_monitor->is_error_active("powermeter/CommunicationFault",
"Communication timed out")) {
clear_error("powermeter/CommunicationFault", "Communication timed out");
}
} catch (LemDCBM400600Controller::DCBMUnexpectedResponseException& dcbm_exception) {
EVLOG_error << "Failed to publish powermeter value due to an invalid device response: "
<< dcbm_exception.what();
} catch (HttpClientError& client_error) {
EVLOG_error << "Failed to publish powermeter value due to an http error: " << client_error.what();
if (!this->error_state_monitor->is_error_active("powermeter/CommunicationFault",
"Communication timed out")) {
auto error =
this->error_factory->create_error("powermeter/CommunicationFault", "Communication timed out",
"This error is raised due to communication timeout");
raise_error(error);
}
}
}
});
Expand Down
Loading