ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
filter_lifetime.h
Go to the documentation of this file.
1#pragma once
2
6#ifdef USE_BINARY_SENSOR
8#endif
9
11
13 public:
14 void setup() override;
15 void update() override;
16 void dump_config() override;
17 void on_shutdown() override;
18 void reset_filter();
19
20 void set_max_lifetime(uint32_t minutes) { this->max_lifetime_minutes_ = minutes; }
21 void set_is_on_lambda(bool (*is_on)()) { this->is_on_lambda_ = is_on; }
22#ifdef USE_BINARY_SENSOR
24#endif
25 void set_current_speed_lambda(float (*speed)()) { this->current_speed_lambda_ = speed; }
29
30 protected:
31 bool get_is_on_();
32 float get_current_speed_();
33 void publish_values_();
34
35 bool (*is_on_lambda_)(){nullptr};
36 float (*current_speed_lambda_)(){nullptr};
37#ifdef USE_BINARY_SENSOR
39#endif
46 uint32_t runtime_seconds_{0}; // Speed-weighted running time, persisted
47 uint32_t carry_ms_{0}; // Weighted milliseconds not yet counted as a second
48};
49
50} // namespace esphome::filter_lifetime
This class simplifies creating components that periodically check a state.
Definition component.h:514
Base class for all binary_sensor-type classes.
void set_runtime_hours_sensor(sensor::Sensor *sensor)
binary_sensor::BinarySensor * is_on_sensor_
void set_current_speed_sensor(sensor::Sensor *sensor)
void set_remaining_days_sensor(sensor::Sensor *sensor)
void set_is_on_sensor(binary_sensor::BinarySensor *sensor)
Base-class for all sensors.
Definition sensor.h:47
int speed
Definition fan.h:3
static void uint32_t