Skip to content

Commit

Permalink
binary_sensor removed unused filter (#5039)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudanov committed Jul 2, 2023
1 parent c5eb394 commit cf98c49
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
9 changes: 0 additions & 9 deletions esphome/components/binary_sensor/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,6 @@ LambdaFilter::LambdaFilter(std::function<optional<bool>(bool)> f) : f_(std::move

optional<bool> LambdaFilter::new_value(bool value, bool is_initial) { return this->f_(value); }

optional<bool> UniqueFilter::new_value(bool value, bool is_initial) {
if (this->last_value_.has_value() && *this->last_value_ == value) {
return {};
} else {
this->last_value_ = value;
return value;
}
}

} // namespace binary_sensor

} // namespace esphome
8 changes: 0 additions & 8 deletions esphome/components/binary_sensor/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ class LambdaFilter : public Filter {
std::function<optional<bool>(bool)> f_;
};

class UniqueFilter : public Filter {
public:
optional<bool> new_value(bool value, bool is_initial) override;

protected:
optional<bool> last_value_{};
};

} // namespace binary_sensor

} // namespace esphome

0 comments on commit cf98c49

Please sign in to comment.