Skip to content

Commit

Permalink
Increase verbosity on new power demand callback
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Jun 7, 2023
1 parent 4178585 commit da853e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/solax_meter_gateway/solax_meter_gateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ void SolaxMeterGateway::on_solax_meter_modbus_data(const std::vector<uint8_t> &d

void SolaxMeterGateway::setup() {
this->power_sensor_->add_on_state_callback([this](float state) {
if (std::isnan(state))
if (std::isnan(state)) {
ESP_LOGVV(TAG, "Invalid power demand received: NaN");
return;
}

this->power_demand_ = state;
this->last_power_demand_received_ = millis();
ESP_LOGVV(TAG, "New power demand received (%.2f). Resetting inactivity timeout (%d)", this->power_demand_,
this->last_power_demand_received_);
});
}

Expand Down

0 comments on commit da853e7

Please sign in to comment.