7 namespace integration {
9 static const char *
const TAG =
"integration";
14 float preference_value = 0;
16 this->
result_ = preference_value;
26 if (std::isnan(value))
28 const uint32_t now =
millis();
30 const double new_value = value;
36 area = dt * (old_value + new_value) / 2.0;
39 area = dt * old_value;
42 area = dt * new_value;
46 this->last_update_ = now;
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
ESPPreferenceObject pref_
void publish_and_save_(double result)
void dump_config() override
void process_sensor_value_(float value)
uint32_t IRAM_ATTR HOT millis()
float state
This member variable stores the last state that has passed through all filters.
ESPPreferences * global_preferences
IntegrationMethod method_
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
Implementation of SPI Controller mode.
uint32_t get_object_id_hash()