-
Notifications
You must be signed in to change notification settings - Fork 21
ESPHome 2026.3.0: get_device_class() and get_icon() unavailable on ESP8266 #9
Copy link
Copy link
Open
Description
Summary
ESPHome 2026.3.0 moves entity icon and device class strings to PROGMEM on ESP8266 (PR #14437, PR #14443). The old get_device_class() and get_icon() methods that return std::string now produce a static_assert error on ESP8266 to prevent unnecessary RAM copies from flash.
Current usage
In esphome/components/lora_mqtt/lora_mqtt.cpp and esphome/components/now_mqtt/now_mqtt.cpp:
line += obj->get_device_class().c_str();
if (obj->get_icon().length() != 0)
line += obj->get_icon();Recommended migration
// Before:
line += obj->get_device_class().c_str();
if (obj->get_icon().length() != 0)
line += obj->get_icon();
// After:
char dc_buf[64];
obj->get_device_class_to(dc_buf);
line += dc_buf;
char icon_buf[64];
obj->get_icon_to(icon_buf);
if (icon_buf[0] != '\0')
line += icon_buf;On non-ESP8266 platforms, the old get_device_class() and get_icon() methods still work but are deprecated (removal in 2026.9.0).
References
- ESPHome PR (icons): [core] Move entity icon strings to PROGMEM on ESP8266 esphome/esphome#14437
- ESPHome PR (device class): [core] Move device class strings to PROGMEM on ESP8266 esphome/esphome#14443
- Developer blog post: Add blog post: ESP8266 PROGMEM icon and device class getter migration esphome/developers.esphome.io#105
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels