diff --git a/esphome/components/mqtt/mqtt_sensor.cpp b/esphome/components/mqtt/mqtt_sensor.cpp index 2586e1ebc3..2f040bff9e 100644 --- a/esphome/components/mqtt/mqtt_sensor.cpp +++ b/esphome/components/mqtt/mqtt_sensor.cpp @@ -69,7 +69,7 @@ bool MQTTSensorComponent::send_initial_state() { } } bool MQTTSensorComponent::publish_state(float value) { - int8_t accuracy = this->sensor_->get_accuracy_decimals(); + int8_t accuracy = this->sensor_->get_accuracy_decimals(); if(std::isnan(value)) return this->publish(this->get_state_topic_(), "None"); return this->publish(this->get_state_topic_(), value_accuracy_to_string(value, accuracy));