Skip to content

Commit

Permalink
avoids nan for virtual_grid_power
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Dec 30, 2024
1 parent b660a55 commit fe28d37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/yasolr_mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ void publishData() {
if (ds18Sys)
mqtt->publish(baseTopic + "/router/temperature", std::to_string(ds18Sys->getTemperature().value_or(0)));
mqtt->publish(baseTopic + "/router/thdi", isnan(routerMeasurements.thdi) ? "0" : std::to_string(routerMeasurements.thdi));
mqtt->publish(baseTopic + "/router/virtual_grid_power", std::to_string(gridMetrics.power - routerMeasurements.power));
float virtual_grid_power = gridMetrics.power - routerMeasurements.power;
mqtt->publish(baseTopic + "/router/virtual_grid_power", isnan(virtual_grid_power) ? "0" : std::to_string(virtual_grid_power));
yield();

for (const auto& output : router.getOutputs()) {
Expand Down

0 comments on commit fe28d37

Please sign in to comment.