ESPHome
2024.11.2
|
Simple exponential moving average filter. More...
#include <filter.h>
Public Member Functions | |
ExponentialMovingAverageFilter (float alpha, size_t send_every, size_t send_first_at) | |
optional< float > | new_value (float value) override |
void | set_send_every (size_t send_every) |
void | set_alpha (float alpha) |
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 | |
bool | first_value_ {true} |
float | accumulator_ {NAN} |
size_t | send_every_ |
size_t | send_at_ |
float | alpha_ |
Protected Attributes inherited from esphome::sensor::Filter | |
friend | Sensor |
Filter * | next_ {nullptr} |
Sensor * | parent_ {nullptr} |
Simple exponential moving average filter.
Essentially just takes the average of the last few values using exponentially decaying weights. Use alpha to adjust decay rate.
esphome::sensor::ExponentialMovingAverageFilter::ExponentialMovingAverageFilter | ( | float | alpha, |
size_t | send_every, | ||
size_t | send_first_at | ||
) |
Definition at line 225 of file filter.cpp.
|
overridevirtual |
Implements esphome::sensor::Filter.
Definition at line 227 of file filter.cpp.
void esphome::sensor::ExponentialMovingAverageFilter::set_alpha | ( | float | alpha | ) |
Definition at line 248 of file filter.cpp.
void esphome::sensor::ExponentialMovingAverageFilter::set_send_every | ( | size_t | send_every | ) |
Definition at line 247 of file filter.cpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |