9 this->source_sensor_->add_on_state_callback([
this](
float value) { this->
process_(value); });
10 if (this->source_sensor_->has_state())
11 this->
process_(this->source_sensor_->state);
13void NTC::dump_config() { LOG_SENSOR(
"",
"NTC Sensor",
this); }
15 if (std::isnan(
value)) {
21 double v = this->
a_ + this->
b_ * lr + this->
c_ * lr *
lr *
lr;
22 auto temp = float(1.0 / v - 273.15);
24 ESP_LOGV(TAG,
"'%s' - Temperature: %.1f°C", LOG_STR_ARG(this->
get_log_name()), temp);
const LogString * get_log_name() const
Get the name for a "%s" log argument (LOG_STR_ARG).
void process_(float value)
void publish_state(float state)
Publish a new state to the front-end.
ESPHOME_LOG_TAG(TAG, "ntc")