ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::sensor::SensorWithDedup< T > Class Template Reference

A sensor pointer that may be null plus the last value it published, stored inline. More...

#include <sensor_with_dedup.h>

Public Member Functions

void set_sensor (Sensor *sens)
 
void publish_state_if_not_dup (T state)
 
void publish_state_unknown ()
 
bool has_sensor () const
 
Sensor * get_sensor () const
 

Protected Attributes

Sensor * sens_ {nullptr}
 
Deduplicator< T > dedup_
 

Detailed Description

template<typename T>
class esphome::sensor::SensorWithDedup< T >

A sensor pointer that may be null plus the last value it published, stored inline.

Publishing does nothing when no sensor is set, and skips a value equal to the last one.

Definition at line 22 of file sensor_with_dedup.h.

Member Function Documentation

◆ get_sensor()

template<typename T >
Sensor * esphome::sensor::SensorWithDedup< T >::get_sensor ( ) const
inline

Definition at line 42 of file sensor_with_dedup.h.

◆ has_sensor()

template<typename T >
bool esphome::sensor::SensorWithDedup< T >::has_sensor ( ) const
inline

Definition at line 41 of file sensor_with_dedup.h.

◆ publish_state_if_not_dup()

template<typename T >
void esphome::sensor::SensorWithDedup< T >::publish_state_if_not_dup ( T state)
inline

Definition at line 29 of file sensor_with_dedup.h.

◆ publish_state_unknown()

template<typename T >
void esphome::sensor::SensorWithDedup< T >::publish_state_unknown ( )
inline

Definition at line 35 of file sensor_with_dedup.h.

◆ set_sensor()

template<typename T >
void esphome::sensor::SensorWithDedup< T >::set_sensor ( Sensor * sens)
inline

Definition at line 24 of file sensor_with_dedup.h.

Field Documentation

◆ dedup_

template<typename T >
Deduplicator<T> esphome::sensor::SensorWithDedup< T >::dedup_
protected

Definition at line 46 of file sensor_with_dedup.h.

◆ sens_

template<typename T >
Sensor* esphome::sensor::SensorWithDedup< T >::sens_ {nullptr}
protected

Definition at line 45 of file sensor_with_dedup.h.


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