8000 fix: serve the native climate temperature API by kris-anderson · Pull Request #203 · iprak/winix · GitHub
[go: up one dir, main page]

Skip to content

fix: serve the native climate temperature API - #203

Merged
iprak merged 2 commits into
iprak:mainfrom
kris-anderson:fix/climate-native-temperature
Nov 6, 2026
Merged

iprak merged 2 commits into
iprak:mainfrom
kris-anderson:fix/climate-native-temperature

Conversation

@kris-anderson
@kris-anderson kris-anderson commented Nov 5, 2026 •
Copy link
Copy Markdown
Contributor

Fixes #202.

WinixAirConditioner keeps 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.

  • Home Assistant 2026.11+ reads the native members and logs no deprecation warning when a class provides both (migrate_deprecated_entity_members in homeassistant/helpers/deprecation.py).
  • Older versions (the integration supports 2024.8+) keep reading the original members. They can be removed once the minimum HA version reaches 2026.11.

Tests:

  • test_current_and_target_temperature also checks the native members and the unit.
  • New test_no_deprecated_temperature_api_warning defines a subclass under caplog and asserts no "provides the deprecated" warning. It only bites on HA 2026.11+.
  • Full suite on homeassistant==2026.10.0 (pytest-homeassistant-custom-component==0.13.371, the custom-integration-image pins): 302 passed.
  • There is no pytest-homeassistant-custom-component release for 2026.11.0 yet, so I checked 2026.11.0 directly instead. I imported the climate module and read the entity's state_attributes:
    • v2.0.1 logs the 3 warnings;
    • this branch logs none;
    • both report current_temperature 26 and temperature 24.
  • ruff check and ruff format --check pass with the custom-integration-image ruff config.

🤖 Generated with Claude Code

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>
Comment thread custom_components/winix/climate.py Outdated
class WinixAirConditioner(WinixEntity, ClimateEntity):
"""Representation of a Winix window/portable air conditioner."""

_attr_native_temperature_unit = UnitOfTemperature.CELSIUS
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the addition of this new attribute, is the old _attr_temperature_unit still neded?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread custom_components/winix/climate.py Resolved
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>
@iprak
iprak merged commit 1d7e56d into iprak:main Nov 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Climate entity uses the deprecated temperature API (stops working in HA 2027.11)

2 participants

0