9static 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;
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
uint32_t get_object_id_hash()
void process_sensor_value_(float value)
IntegrationMethod method_
void publish_and_save_(double result)
void dump_config() override
ESPPreferenceObject pref_
void add_on_state_callback(std::function< void(float)> &&callback)
Add a callback that will be called every time a filtered value arrives.
float state
This member variable stores the last state that has passed through all filters.
@ INTEGRATION_METHOD_TRAPEZOID
@ INTEGRATION_METHOD_LEFT
@ INTEGRATION_METHOD_RIGHT
Providing packet encoding functions for exchanging data with a remote host.
ESPPreferences * global_preferences
uint32_t IRAM_ATTR HOT millis()