Skip to content

Commit

Permalink
Do not publish charger information at all when it is "null" (#676)
Browse files Browse the repository at this point in the history
This could happen when the charger information file is not configured or invalid

Signed-off-by: Kai-Uwe Hermann <[email protected]>
Co-authored-by: Piet Gömpel <[email protected]>
  • Loading branch information
hikinggrass and Pietfried authored May 8, 2024
1 parent 4fee565 commit c11fc73
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/API/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,9 @@ void API::init() {
while (this->running) {
json connectors_array = connectors;
this->mqtt.publish(var_connectors, connectors_array.dump());
this->mqtt.publish(var_info, this->charger_information.dump());
if (not this->charger_information.is_null()) {
this->mqtt.publish(var_info, this->charger_information.dump());
}
{
std::scoped_lock lock(ocpp_data_mutex);
this->mqtt.publish(var_ocpp_connection_status, this->ocpp_connection_status);
Expand Down

0 comments on commit c11fc73

Please sign in to comment.