11#define SUB_SENSOR_WITH_DEDUP(name, dedup_type) \
13 sensor::SensorWithDedup<dedup_type> name##_sensor_{}; \
16 void set_##name##_sensor(sensor::Sensor *sensor) { this->name##_sensor_.set_sensor(sensor); }
18#define LOG_SENSOR_WITH_DEDUP(prefix, type, s) LOG_SENSOR(prefix, type, (s).get_sensor())
30 if (this->
sens_ !=
nullptr && this->
dedup_.next(state)) {
36 if (this->
sens_ !=
nullptr && this->
dedup_.next_unknown()) {
Helper class to deduplicate items in a series of values.
Base-class for all sensors.
void publish_state(float state)
Publish a new state to the front-end.
A sensor pointer that may be null plus the last value it published, stored inline.
void publish_state_unknown()
void set_sensor(Sensor *sens)
Sensor * get_sensor() const
void publish_state_if_not_dup(T state)