1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-12 10:42:03 +00:00

Compare commits

...

1 Commits

Author SHA1 Message Date
J. Nick Koston
d4fda33b19 [web_server] Guard icon JSON field with USE_ENTITY_ICON
Skip emitting the "icon" key in set_json_id() when USE_ENTITY_ICON
is not defined. This avoids the ArduinoJson .set() call overhead and
sending empty "icon":"" in every JSON response for builds without icons.
2026-02-11 22:18:51 -06:00

View File

@@ -557,7 +557,9 @@ static void set_json_id(JsonObject &root, EntityBase *obj, const char *prefix, J
root[ESPHOME_F("device")] = device_name;
}
#endif
#ifdef USE_ENTITY_ICON
root[ESPHOME_F("icon")] = obj->get_icon_ref();
#endif
root[ESPHOME_F("entity_category")] = obj->get_entity_category();
bool is_disabled = obj->is_disabled_by_default();
if (is_disabled)