Compilation error since update to ESPHome Device Builder 2026.7.0

I have some smart switches. They always gave following warning with compilation:

Compiling .pioenvs/lsc-powerplug-5/lib352/ESPAsyncWebServer/AsyncEventSource.cpp.o
/config/esphome/water-boiler2.yaml: In lambda function:
/config/esphome/water-boiler2.yaml:207:38: warning: 'esphome::select::Select::state' is deprecated: Use current_option() instead of .state. Will be removed in 2026.7.0 [-Wdeprecated-declarations]
  207 |               return strcmp(id(status_led_mode).state.c_str(), "Normal") == 0;
      |                                      ^~~~~
In file included from src/esphome/core/entity_includes.h:51,
                 from src/esphome/core/application.h:39,
                 from src/esphome/components/api/api_frame_helper.h:14,
                 from src/esphome/components/api/api_connection.h:5,
                 from src/esphome.h:4,
                 from src/main.cpp:3:
src/esphome/components/select/select.h:37:15: note: declared here
   37 |   std::string state{};
      |               ^~~~~

It won’t compile anymore (.state is removed). Who do I contact to fix this?

Thanks

HI.

You need to contact whoever wrote your YAML configuration — or simply update it yourself.

The compilation error points directly to /config/esphome/water-boiler2.yaml, line 207. Replace:

id(status_led_mode).state

with:

id(status_led_mode).current_option()

The complete line can be simplified to:

return id(status_led_mode).current_option() == "Normal";

This is not a smart-switch or ESPHome bug. Your configuration was using a deprecated API that ESPHome had already warned would be removed.

Kustonium, a big “Thank You”.

That solved the problem.

No problem :slight_smile: