1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-28 13:43:54 +00:00

[core] Use get_device_class_ref() in entity platform logging to avoid string allocations (#10531)

This commit is contained in:
J. Nick Koston
2025-09-02 21:26:53 -05:00
committed by GitHub
parent 5ba1c32242
commit 086f1982fa
8 changed files with 16 additions and 16 deletions

View File

@@ -22,8 +22,8 @@ void log_number(const char *tag, const char *prefix, const char *type, Number *o
ESP_LOGCONFIG(tag, "%s Unit of Measurement: '%s'", prefix, obj->traits.get_unit_of_measurement().c_str());
}
if (!obj->traits.get_device_class().empty()) {
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->traits.get_device_class().c_str());
if (!obj->traits.get_device_class_ref().empty()) {
ESP_LOGCONFIG(tag, "%s Device Class: '%s'", prefix, obj->traits.get_device_class_ref().c_str());
}
}