Skip to content

Commit

Permalink
ewh: publish error code only on change
Browse files Browse the repository at this point in the history
  • Loading branch information
dentra committed Jun 24, 2024
1 parent 7aac35b commit 4753d7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/ewh/ewh_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ void EWHComponent::on_state(const ewh_state_t &state) {
#endif
#ifdef USE_SENSOR
if (this->error_code_) {
this->error_code_->publish_state(state.error);
if (std::isnan(this->error_code_->state) || static_cast<uint8_t>(this->error_code_->state) != state.error) {
this->error_code_->publish_state(state.error);
}
}
#endif
}
Expand Down

0 comments on commit 4753d7b

Please sign in to comment.