mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Remove deprecated water heater constants (#131805)
This commit is contained in:
parent
a67045ee6c
commit
3866176e1d
@ -25,12 +25,6 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.deprecation import (
|
|
||||||
DeprecatedConstantEnum,
|
|
||||||
all_with_deprecated_constants,
|
|
||||||
check_if_deprecated_constant,
|
|
||||||
dir_with_deprecated_constants,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.temperature import display_temp as show_temp
|
from homeassistant.helpers.temperature import display_temp as show_temp
|
||||||
@ -70,18 +64,6 @@ class WaterHeaterEntityFeature(IntFlag):
|
|||||||
ON_OFF = 8
|
ON_OFF = 8
|
||||||
|
|
||||||
|
|
||||||
# These SUPPORT_* constants are deprecated as of Home Assistant 2022.5.
|
|
||||||
# Please use the WaterHeaterEntityFeature enum instead.
|
|
||||||
_DEPRECATED_SUPPORT_TARGET_TEMPERATURE = DeprecatedConstantEnum(
|
|
||||||
WaterHeaterEntityFeature.TARGET_TEMPERATURE, "2025.1"
|
|
||||||
)
|
|
||||||
_DEPRECATED_SUPPORT_OPERATION_MODE = DeprecatedConstantEnum(
|
|
||||||
WaterHeaterEntityFeature.OPERATION_MODE, "2025.1"
|
|
||||||
)
|
|
||||||
_DEPRECATED_SUPPORT_AWAY_MODE = DeprecatedConstantEnum(
|
|
||||||
WaterHeaterEntityFeature.AWAY_MODE, "2025.1"
|
|
||||||
)
|
|
||||||
|
|
||||||
ATTR_MAX_TEMP = "max_temp"
|
ATTR_MAX_TEMP = "max_temp"
|
||||||
ATTR_MIN_TEMP = "min_temp"
|
ATTR_MIN_TEMP = "min_temp"
|
||||||
ATTR_AWAY_MODE = "away_mode"
|
ATTR_AWAY_MODE = "away_mode"
|
||||||
@ -437,11 +419,3 @@ async def async_service_temperature_set(
|
|||||||
kwargs[value] = temp
|
kwargs[value] = temp
|
||||||
|
|
||||||
await entity.async_set_temperature(**kwargs)
|
await entity.async_set_temperature(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
# These can be removed if no deprecated constant are in this module anymore
|
|
||||||
__getattr__ = ft.partial(check_if_deprecated_constant, module_globals=globals())
|
|
||||||
__dir__ = ft.partial(
|
|
||||||
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
|
|
||||||
)
|
|
||||||
__all__ = all_with_deprecated_constants(globals())
|
|
||||||
|
@ -8,7 +8,6 @@ from unittest.mock import AsyncMock, MagicMock
|
|||||||
import pytest
|
import pytest
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import water_heater
|
|
||||||
from homeassistant.components.water_heater import (
|
from homeassistant.components.water_heater import (
|
||||||
ATTR_OPERATION_LIST,
|
ATTR_OPERATION_LIST,
|
||||||
ATTR_OPERATION_MODE,
|
ATTR_OPERATION_MODE,
|
||||||
@ -30,8 +29,6 @@ from tests.common import (
|
|||||||
MockModule,
|
MockModule,
|
||||||
MockPlatform,
|
MockPlatform,
|
||||||
async_mock_service,
|
async_mock_service,
|
||||||
help_test_all,
|
|
||||||
import_and_test_deprecated_constant_enum,
|
|
||||||
mock_integration,
|
mock_integration,
|
||||||
mock_platform,
|
mock_platform,
|
||||||
)
|
)
|
||||||
@ -211,29 +208,6 @@ async def test_operation_mode_validation(
|
|||||||
water_heater_entity.set_operation_mode.assert_has_calls([mock.call("eco")])
|
water_heater_entity.set_operation_mode.assert_has_calls([mock.call("eco")])
|
||||||
|
|
||||||
|
|
||||||
def test_all() -> None:
|
|
||||||
"""Test module.__all__ is correctly set."""
|
|
||||||
help_test_all(water_heater)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
("enum"),
|
|
||||||
[
|
|
||||||
WaterHeaterEntityFeature.TARGET_TEMPERATURE,
|
|
||||||
WaterHeaterEntityFeature.OPERATION_MODE,
|
|
||||||
WaterHeaterEntityFeature.AWAY_MODE,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_deprecated_constants(
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
enum: WaterHeaterEntityFeature,
|
|
||||||
) -> None:
|
|
||||||
"""Test deprecated constants."""
|
|
||||||
import_and_test_deprecated_constant_enum(
|
|
||||||
caplog, water_heater, enum, "SUPPORT_", "2025.1"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_deprecated_supported_features_ints(
|
def test_deprecated_supported_features_ints(
|
||||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user