ESPHome 2025.5.0
Loading...
Searching...
No Matches
output.cpp
Go to the documentation of this file.
1#include "esphome/core/helpers.h" // for clamp() and lerp()
2#include "output.h"
3
4namespace esphome {
5namespace opentherm {
6
7static const char *const TAG = "opentherm.output";
8
10 ESP_LOGD(TAG, "Received state: %.2f. Min value: %.2f, max value: %.2f", state, min_value_, max_value_);
11 this->state = state < 0.003 && this->zero_means_zero_
12 ? 0.0
13 : clamp(lerp(state, min_value_, max_value_), min_value_, max_value_);
14 this->has_state_ = true;
15 ESP_LOGD(TAG, "Output %s set to %.2f", this->id_, this->state);
16}
17} // namespace opentherm
18} // namespace esphome
void write_state(float state) override
Definition output.cpp:9
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
float lerp(float completion, float start, float end)
Linearly interpolate between start and end by completion (between 0 and 1).
Definition helpers.cpp:95
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)
Definition helpers.h:101