13 float preference_value = 0;
15 this->
result_ = preference_value;
23void IntegrationSensor::dump_config() { LOG_SENSOR(
"",
"Integration Sensor",
this); }
25 if (std::isnan(
value))
29 const double new_value =
value;
35 area = dt * (old_value + new_value) / 2.0;
38 area = dt * old_value;
41 area = dt * new_value;
45 this->last_update_ = now;
virtual void setup()
Where the component's initialization should happen.
ESPPreferenceObject make_entity_preference(uint32_t version=0)
Create a preference object for storing this entity's state/settings.
void process_sensor_value_(float value)
IntegrationMethod method_
void publish_and_save_(double result)
ESPPreferenceObject pref_
float state
This member variable stores the last state that has passed through all filters.
ESPHOME_LOG_TAG(TAG, "integration")
@ INTEGRATION_METHOD_TRAPEZOID
@ INTEGRATION_METHOD_LEFT
@ INTEGRATION_METHOD_RIGHT
uint32_t IRAM_ATTR HOT millis()