Fix ClimateTraits API for ESPHome 2026.5+ compatibility - #15
Open
nightstalker80-glitch wants to merge 5 commits into
Open
Conversation
The 2026.5+ fix used add_feature_flags() and the entity-level Climate::set_supported_custom_fan_modes(), neither of which exists on older ESPHome, so the component no longer compiled on pre-2025.11 / pre-2026.4 versions. Wrap both migrations in ESPHOME_VERSION_CODE guards so the new APIs are used on recent ESPHome while older versions fall back to the previous accessors: - add_feature_flags(CLIMATE_SUPPORTS_CURRENT_TEMPERATURE): since 2025.11.0, falls back to set_supports_current_temperature(true) on older. - Climate::set_supported_custom_fan_modes(): since 2026.4.0, falls back to ClimateTraits::set_supported_custom_fan_modes() on older (still present, removal planned for 2026.11.0). Also restore the class-body indentation on handle_register_power_selection() and set_power_select() that was dropped in an earlier commit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
@nightstalker80-glitch can you confirm if the changes are fine? |
Author
I‘m running it on the latest ESPHome version, works great! |
Contributor
|
I have added these changes to my fork as well. I can confirm it all works just fine (latest ESPHome). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ESPHome 2026.5.0 removed the deprecated
ClimateTraits::set_supports_*accessors, breaking the build with:
Changes
set_supports_current_temperature(true)withadd_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE)set_supports_two_point_target_temperature(false)andset_supports_action(false)(both were false/default, no replacement needed)supported_traits_.set_supported_custom_fan_modes()to
this->set_supported_custom_fan_modes()on the Climate entity(scheduled for removal in ESPHome 2026.11.0)
Tested
✅ Compiled successfully with ESPHome 2026.5.3
✅ Flashed via OTA on ESP32 (esp32dev, esp-idf framework)
✅ Connected to real Toshiba indoor unit (RAS-10PKVPG-E) via UART (9600 8E1, 5V with level shifter)
✅ AC fully controllable from Home Assistant (mode, temperature, fan, swing, special modes)
✅ Sensor values (outdoor temp, FCU/CDU data) received correctly from unit