Skip to content

Commit

Permalink
Fix missing backwards compatiblity layer for humidifier supported_fea…
Browse files Browse the repository at this point in the history
…tures (#107026)

fixes #107018
  • Loading branch information
bdraco committed Jan 4, 2024
1 parent bcc7570 commit 987663e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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"

0 comments on commit 987663e

Please sign in to comment.