Skip to content

Commit

Permalink
Fix energy_Wh_import_signed handling
Browse files Browse the repository at this point in the history
Signed-off-by: Kai-Uwe Hermann <[email protected]>
  • Loading branch information
hikinggrass committed Feb 22, 2024
1 parent 1afcdb4 commit 473c086
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/OCPP201/OCPP201.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ ocpp::v201::MeterValue get_meter_value(const types::powermeter::Powermeter& powe

// Energy.Active.Import.Register
if (power_meter.energy_Wh_import_signed.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Energy_Active_Import_Register,
"Wh", std::nullopt);
const auto& energy_Wh_import_signed = power_meter.energy_Wh_import_signed.value();
if (energy_Wh_import_signed.total.has_value()) {
sampled_value.signedMeterValue = get_signed_meter_value(energy_Wh_import_signed.total.value());
}
meter_value.sampledValue.push_back(sampled_value);
}
meter_value.sampledValue.push_back(sampled_value);

if (power_meter.energy_Wh_import.L1.has_value()) {
sampled_value = get_sampled_value(reading_context, ocpp::v201::MeasurandEnum::Energy_Active_Import_Register,
Expand Down

0 comments on commit 473c086

Please sign in to comment.