1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-08 14:22:21 +01:00

Optimize entity icon memory usage with USE_ENTITY_ICON flag (#9337)

This commit is contained in:
J. Nick Koston
2025-07-07 15:22:40 -05:00
committed by GitHub
parent 31f36df4ba
commit 053feb5e3b
6 changed files with 192 additions and 1 deletions

View File

@@ -27,12 +27,22 @@ void EntityBase::set_name(const char *name) {
// Entity Icon
std::string EntityBase::get_icon() const {
#ifdef USE_ENTITY_ICON
if (this->icon_c_str_ == nullptr) {
return "";
}
return this->icon_c_str_;
#else
return "";
#endif
}
void EntityBase::set_icon(const char *icon) {
#ifdef USE_ENTITY_ICON
this->icon_c_str_ = icon;
#else
// No-op when USE_ENTITY_ICON is not defined
#endif
}
void EntityBase::set_icon(const char *icon) { this->icon_c_str_ = icon; }
// Entity Object ID
std::string EntityBase::get_object_id() const {