mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Add compatibility code for deprecated WaterHeaterEntityEntityDescription (#133351)
This commit is contained in:
parent
b2170ad732
commit
e3cf5c47b2
@ -25,6 +25,7 @@ from homeassistant.const import (
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.deprecation import deprecated_class
|
||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.temperature import display_temp as show_temp
|
||||
@ -133,6 +134,13 @@ class WaterHeaterEntityDescription(EntityDescription, frozen_or_thawed=True):
|
||||
"""A class that describes water heater entities."""
|
||||
|
||||
|
||||
@deprecated_class("WaterHeaterEntityDescription", breaks_in_ha_version="2026.1")
|
||||
class WaterHeaterEntityEntityDescription(
|
||||
WaterHeaterEntityDescription, frozen_or_thawed=True
|
||||
):
|
||||
"""A (deprecated) class that describes water heater entities."""
|
||||
|
||||
|
||||
CACHED_PROPERTIES_WITH_ATTR_ = {
|
||||
"temperature_unit",
|
||||
"current_operation",
|
||||
|
@ -13,6 +13,8 @@ from homeassistant.components.water_heater import (
|
||||
SERVICE_SET_OPERATION_MODE,
|
||||
SET_TEMPERATURE_SCHEMA,
|
||||
WaterHeaterEntity,
|
||||
WaterHeaterEntityDescription,
|
||||
WaterHeaterEntityEntityDescription,
|
||||
WaterHeaterEntityFeature,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -204,3 +206,15 @@ async def test_operation_mode_validation(
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
water_heater_entity.set_operation_mode.assert_has_calls([mock.call("eco")])
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("class_name", "expected_log"),
|
||||
[(WaterHeaterEntityDescription, False), (WaterHeaterEntityEntityDescription, True)],
|
||||
)
|
||||
async def test_deprecated_entity_description(
|
||||
caplog: pytest.LogCaptureFixture, class_name: type, expected_log: bool
|
||||
) -> None:
|
||||
"""Test deprecated WaterHeaterEntityEntityDescription logs warning."""
|
||||
class_name(key="test")
|
||||
assert ("is a deprecated class" in caplog.text) is expected_log
|
||||
|
Loading…
x
Reference in New Issue
Block a user