Repository navigation
fix: serve the native climate temperature API - #203
Merged
Merged
Conversation
Home Assistant 2026.11 deprecates current_temperature, target_temperature and _attr_temperature_unit on climate entities in favour of their native_ counterparts, and logs a warning for WinixAirConditioner at import; the old members stop working in 2027.11. Provide the native members and keep the old names pointing at them. HA 2026.11+ uses the native ones without a warning when a class provides both, and older HA versions (the integration supports 2024.8+) keep reading the old names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
iprak
requested changes
Nov 5, 2026
| class WinixAirConditioner(WinixEntity, ClimateEntity): | ||
| """Representation of a Winix window/portable air conditioner.""" | ||
|
|
||
| _attr_native_temperature_unit = UnitOfTemperature.CELSIUS |
Owner
There was a problem hiding this comment.
With the addition of this new attribute, is the old _attr_temperature_unit still neded?
Contributor
Author
There was a problem hiding this comment.
Yes, for as long as the integration supports HA before 2026.11. Those versions only read _attr_temperature_unit; with only the native attribute set, HA 2026.10.0 raises an AttributeError when it reads the unit. 2026.11+ reads the native one, and because the class provides both, it logs no warning. Once the minimum HA version reaches 2026.11, the old one can go.
Review feedback on iprak#203: the rename read as a breaking change. Restore the original current_temperature, target_temperature and _attr_temperature_unit unchanged, and add the native members alongside them as aliases, so the diff against main only adds lines. Behaviour is the same: HA before 2026.11 reads the original members, 2026.11+ reads the native ones without a deprecation warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.<
3281
/span>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.
Fixes #202.
WinixAirConditionerkeeps its existing temperature members exactly as they were (current_temperature,target_temperature,_attr_temperature_unit) and adds the native climate temperature API alongside them as aliases (native_current_temperature,native_target_temperature,_attr_native_temperature_unit). The diff only adds lines.migrate_deprecated_entity_membersinhomeassistant/helpers/deprecation.py).Tests:
test_current_and_target_temperaturealso checks the native members and the unit.test_no_deprecated_temperature_api_warningdefines a subclass undercaplogand asserts no "provides the deprecated" warning. It only bites on HA 2026.11+.homeassistant==2026.10.0(pytest-homeassistant-custom-component==0.13.371, the custom-integration-image pins): 302 passed.pytest-homeassistant-custom-componentrelease for 2026.11.0 yet, so I checked 2026.11.0 directly instead. I imported the climate module and read the entity'sstate_attributes:current_temperature26 andtemperature24.ruff checkandruff format --checkpass with the custom-integration-image ruff config.🤖 Generated with Claude Code