1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-14 14:50:32 +01:00
Oleg Tarasov 58d028ac13
Add OpenTherm component (part 3: rest of the sensors) (#7676)
Co-authored-by: FreeBear <freebear@tuxcnc.org>
Co-authored-by: FreeBear-nc <67865163+FreeBear-nc@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2024-11-12 16:19:42 +13:00

19 lines
660 B
C++

#include "esphome/core/helpers.h" // for clamp() and lerp()
#include "output.h"
namespace esphome {
namespace opentherm {
static const char *const TAG = "opentherm.output";
void opentherm::OpenthermOutput::write_state(float state) {
ESP_LOGD(TAG, "Received state: %.2f. Min value: %.2f, max value: %.2f", state, min_value_, max_value_);
this->state = state < 0.003 && this->zero_means_zero_
? 0.0
: clamp(lerp(state, min_value_, max_value_), min_value_, max_value_);
this->has_state_ = true;
ESP_LOGD(TAG, "Output %s set to %.2f", this->id_, this->state);
}
} // namespace opentherm
} // namespace esphome