mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 16:38:16 +01:00
mqtt_sensor: properly send state_class via MQTT (#2228)
This commit is contained in:
parent
910f812737
commit
b01bc76dc5
1 changed files with 2 additions and 2 deletions
|
@ -61,8 +61,8 @@ void MQTTSensorComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryCo
|
|||
if (this->sensor_->get_force_update())
|
||||
root["force_update"] = true;
|
||||
|
||||
if (this->sensor_->state_class == sensor::STATE_CLASS_MEASUREMENT)
|
||||
root["state_class"] = "measurement";
|
||||
if (this->sensor_->state_class != STATE_CLASS_NONE)
|
||||
root["state_class"] = state_class_to_string(this->sensor_->state_class);
|
||||
|
||||
config.command_topic = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue