mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	timeout filter: return value (#5612)
This commit is contained in:
		| @@ -1,8 +1,8 @@ | |||||||
| #include "filter.h" | #include "filter.h" | ||||||
|  | #include <cmath> | ||||||
| #include "esphome/core/hal.h" | #include "esphome/core/hal.h" | ||||||
| #include "esphome/core/log.h" | #include "esphome/core/log.h" | ||||||
| #include "sensor.h" | #include "sensor.h" | ||||||
| #include <cmath> |  | ||||||
|  |  | ||||||
| namespace esphome { | namespace esphome { | ||||||
| namespace sensor { | namespace sensor { | ||||||
| @@ -376,9 +376,7 @@ void OrFilter::initialize(Sensor *parent, Filter *next) { | |||||||
| // TimeoutFilter | // TimeoutFilter | ||||||
| optional<float> TimeoutFilter::new_value(float value) { | optional<float> TimeoutFilter::new_value(float value) { | ||||||
|   this->set_timeout("timeout", this->time_period_, [this]() { this->output(this->value_); }); |   this->set_timeout("timeout", this->time_period_, [this]() { this->output(this->value_); }); | ||||||
|   this->output(value); |   return value; | ||||||
|  |  | ||||||
|   return {}; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| TimeoutFilter::TimeoutFilter(uint32_t time_period, float new_value) : time_period_(time_period), value_(new_value) {} | TimeoutFilter::TimeoutFilter(uint32_t time_period, float new_value) : time_period_(time_period), value_(new_value) {} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user