Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing backwards compatiblity layer for humidifier supported_features #107026

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/humidifier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def state_attributes(self) -> dict[str, Any]:
if self.target_humidity is not None:
data[ATTR_HUMIDITY] = self.target_humidity

if HumidifierEntityFeature.MODES in self.supported_features:
if HumidifierEntityFeature.MODES in self.supported_features_compat:
data[ATTR_MODE] = self.mode

return data
Expand Down
5 changes: 5 additions & 0 deletions tests/components/humidifier/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from homeassistant.components import humidifier
from homeassistant.components.humidifier import (
ATTR_MODE,
HumidifierEntity,
HumidifierEntityFeature,
)
Expand Down Expand Up @@ -75,6 +76,8 @@ def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) ->
"""Test deprecated supported features ints."""

class MockHumidifierEntity(HumidifierEntity):
_attr_mode = "mode1"

@property
def supported_features(self) -> int:
"""Return supported features."""
Expand All @@ -89,3 +92,5 @@ def supported_features(self) -> int:
caplog.clear()
assert entity.supported_features_compat is HumidifierEntityFeature(1)
assert "is using deprecated supported features values" not in caplog.text

assert entity.state_attributes[ATTR_MODE] == "mode1"