mirror of
https://github.com/esphome/esphome.git
synced 2024-12-01 19:24:14 +01:00
binary_sensor removed unused filter (#5039)
This commit is contained in:
parent
c5eb3941b9
commit
cf98c497d5
2 changed files with 0 additions and 17 deletions
|
@ -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> 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 binary_sensor
|
||||||
|
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
|
@ -105,14 +105,6 @@ class LambdaFilter : public Filter {
|
||||||
std::function<optional<bool>(bool)> f_;
|
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 binary_sensor
|
||||||
|
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
Loading…
Reference in a new issue