updated formatting

This commit is contained in:
Long Vo 2024-11-14 16:48:46 +07:00
parent 9f027103ed
commit 9af492c219

View file

@ -70,7 +70,7 @@ bool MQTTSensorComponent::send_initial_state() {
} }
bool MQTTSensorComponent::publish_state(float value) { 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)) if (std::isnan(value))
return this->publish(this->get_state_topic_(), "None"); return this->publish(this->get_state_topic_(), "None");
return this->publish(this->get_state_topic_(), value_accuracy_to_string(value, accuracy)); return this->publish(this->get_state_topic_(), value_accuracy_to_string(value, accuracy));
} }