ESPHome
2024.10.3
|
This class allows for creation of simple template filters. More...
#include <filter.h>
Public Member Functions | |
LambdaFilter (lambda_filter_t lambda_filter) | |
optional< float > | new_value (float value) override |
const lambda_filter_t & | get_lambda_filter () const |
void | set_lambda_filter (const lambda_filter_t &lambda_filter) |
Public Member Functions inherited from esphome::sensor::Filter | |
virtual void | initialize (Sensor *parent, Filter *next) |
Initialize this filter, please note this can be called more than once. More... | |
void | input (float value) |
void | output (float value) |
Protected Attributes | |
lambda_filter_t | lambda_filter_ |
Protected Attributes inherited from esphome::sensor::Filter | |
friend | Sensor |
Filter * | next_ {nullptr} |
Sensor * | parent_ {nullptr} |
This class allows for creation of simple template filters.
The constructor accepts a lambda of the form float -> optional<float>. It will be called with each new value in the filter chain and returns the modified value that shall be passed down the filter chain. Returning an empty Optional means that the value shall be discarded.
|
explicit |
Definition at line 280 of file filter.cpp.
const lambda_filter_t & esphome::sensor::LambdaFilter::get_lambda_filter | ( | ) | const |
Definition at line 281 of file filter.cpp.
|
overridevirtual |
Implements esphome::sensor::Filter.
Definition at line 284 of file filter.cpp.
void esphome::sensor::LambdaFilter::set_lambda_filter | ( | const lambda_filter_t & | lambda_filter | ) |
Definition at line 282 of file filter.cpp.
|
protected |