ESPHome 2026.3.2
Loading...
Searching...
No Matches
esphome::sensor::ValueListFilter Class Reference

Base class for filters that compare sensor values against a list of configured values. More...

#include <filter.h>

Inheritance diagram for esphome::sensor::ValueListFilter:
esphome::sensor::Filter esphome::sensor::FilterOutValueFilter esphome::sensor::ThrottleWithPriorityFilter

Protected Member Functions

 ValueListFilter (std::initializer_list< TemplatableValue< float > > values)
 
bool value_matches_any_ (float sensor_value)
 Check if sensor value matches any configured value (with accuracy rounding)
 

Protected Attributes

FixedVector< TemplatableValue< float > > values_
 
- Protected Attributes inherited from esphome::sensor::Filter
friend Sensor
 
Filternext_ {nullptr}
 
Sensorparent_ {nullptr}
 

Additional Inherited Members

- Public Member Functions inherited from esphome::sensor::Filter
virtual optional< float > new_value (float value)=0
 This will be called every time the filter receives a new value.
 
virtual void initialize (Sensor *parent, Filter *next)
 Initialize this filter, please note this can be called more than once.
 
void input (float value)
 
void output (float value)
 

Detailed Description

Base class for filters that compare sensor values against a list of configured values.

This base class provides common functionality for filters that need to check if a sensor value matches any value in a configured list, with proper handling of NaN values and accuracy-based rounding for comparisons.

Definition at line 342 of file filter.h.

Constructor & Destructor Documentation

◆ ValueListFilter()

esphome::sensor::ValueListFilter::ValueListFilter ( std::initializer_list< TemplatableValue< float > > values)
explicitprotected

Definition at line 240 of file filter.cpp.

Member Function Documentation

◆ value_matches_any_()

bool esphome::sensor::ValueListFilter::value_matches_any_ ( float sensor_value)
protected

Check if sensor value matches any configured value (with accuracy rounding)

Definition at line 242 of file filter.cpp.

Field Documentation

◆ values_

FixedVector<TemplatableValue<float> > esphome::sensor::ValueListFilter::values_
protected

Definition at line 349 of file filter.h.


The documentation for this class was generated from the following files: