35 void setup()
override;
void dump_config() override
ESPPreferenceObject pref_
void set_alpha(float alpha)
void set_time_constant(uint32_t time_constant_ms)
When non-zero, each sample is weighted by the time since the previous one instead of by a fixed alpha...
void process_(float value, uint32_t now)
uint32_t time_constant_ms_
void set_time_weighting(TimeWeighting weighting)
void reset()
Clear the average; the next sample starts it again.
void set_restore(bool restore)
TimeWeighting time_weighting_
ExponentialMovingAverageSensor(sensor::Sensor *source)
void publish_and_save_(float value)
Base-class for all sensors.
ScaledDuration scale_duration(uint32_t ms)
const LogString * time_weighting_to_string(TimeWeighting weighting)
TimeWeighting
Which value is assumed to apply during the time between two readings, when a time constant is used.
@ TIME_WEIGHTING_PREVIOUS
A duration in the largest of ms, s, min or h that keeps the value at 1 or more.