ESPHome 2026.5.1
Loading...
Searching...
No Matches
esphome::text_sensor::SubstituteFilter< N > Class Template Reference

A simple filter that replaces a substring with another substring. More...

#include <filter.h>

Inheritance diagram for esphome::text_sensor::SubstituteFilter< N >:
esphome::text_sensor::Filter

Public Member Functions

 SubstituteFilter (const std::initializer_list< Substitution > &substitutions)
 
bool new_value (std::string &value) override
 
- Public Member Functions inherited from esphome::text_sensor::Filter
virtual void initialize (TextSensor *parent, Filter *next)
 Initialize this filter, please note this can be called more than once.
 
void input (std::string value)
 
void output (std::string &value)
 

Protected Attributes

std::array< Substitution, N > substitutions_ {}
 
- Protected Attributes inherited from esphome::text_sensor::Filter
friend TextSensor
 
Filternext_ {nullptr}
 
TextSensorparent_ {nullptr}
 

Detailed Description

template<size_t N>
class esphome::text_sensor::SubstituteFilter< N >

A simple filter that replaces a substring with another substring.

N is set by code generation to match the exact number of substitutions configured in YAML.

Definition at line 131 of file filter.h.

Constructor & Destructor Documentation

◆ SubstituteFilter()

template<size_t N>
esphome::text_sensor::SubstituteFilter< N >::SubstituteFilter ( const std::initializer_list< Substitution > & substitutions)
inlineexplicit

Definition at line 133 of file filter.h.

Member Function Documentation

◆ new_value()

template<size_t N>
bool esphome::text_sensor::SubstituteFilter< N >::new_value ( std::string & value)
inlineoverridevirtual

Implements esphome::text_sensor::Filter.

Definition at line 136 of file filter.h.

Field Documentation

◆ substitutions_

template<size_t N>
std::array<Substitution, N> esphome::text_sensor::SubstituteFilter< N >::substitutions_ {}
protected

Definition at line 139 of file filter.h.


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