Skip to content

ESPHome 2026.3.0: get_device_class() and get_icon() unavailable on ESP8266 #9

@bdraco

Description

@bdraco

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions