mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Remove deprecated supported features warning in AlarmControlPanel (#132665)
This commit is contained in:
parent
24b1eeb900
commit
427db02029
@ -355,12 +355,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
|
||||
@cached_property
|
||||
def supported_features(self) -> AlarmControlPanelEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
features = self._attr_supported_features
|
||||
if type(features) is int: # noqa: E721
|
||||
new_features = AlarmControlPanelEntityFeature(features)
|
||||
self._report_deprecated_supported_features_values(new_features)
|
||||
return new_features
|
||||
return features
|
||||
return self._attr_supported_features
|
||||
|
||||
@final
|
||||
@property
|
||||
|
@ -54,29 +54,6 @@ async def help_test_async_alarm_control_panel_service(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) -> None:
|
||||
"""Test deprecated supported features ints."""
|
||||
|
||||
class MockAlarmControlPanelEntity(alarm_control_panel.AlarmControlPanelEntity):
|
||||
_attr_supported_features = 1
|
||||
|
||||
entity = MockAlarmControlPanelEntity()
|
||||
assert (
|
||||
entity.supported_features
|
||||
is alarm_control_panel.AlarmControlPanelEntityFeature(1)
|
||||
)
|
||||
assert "MockAlarmControlPanelEntity" in caplog.text
|
||||
assert "is using deprecated supported features values" in caplog.text
|
||||
assert "Instead it should use" in caplog.text
|
||||
assert "AlarmControlPanelEntityFeature.ARM_HOME" in caplog.text
|
||||
caplog.clear()
|
||||
assert (
|
||||
entity.supported_features
|
||||
is alarm_control_panel.AlarmControlPanelEntityFeature(1)
|
||||
)
|
||||
assert "is using deprecated supported features values" not in caplog.text
|
||||
|
||||
|
||||
async def test_set_mock_alarm_control_panel_options(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
|
Loading…
x
Reference in New Issue
Block a user