Skip to content
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
4 changes: 2 additions & 2 deletions homeassistant/components/demo/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SUPPORT_AWAY_MODE,
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT

Expand All @@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
await async_setup_platform(hass, {}, async_add_entities)


class DemoWaterHeater(WaterHeaterDevice):
class DemoWaterHeater(WaterHeaterEntity):
"""Representation of a demo water_heater device."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/econet/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
STATE_PERFORMANCE,
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
Expand Down Expand Up @@ -120,7 +120,7 @@ def service_handle(service):
)


class EcoNetWaterHeater(WaterHeaterDevice):
class EcoNetWaterHeater(WaterHeaterEntity):
"""Representation of an EcoNet water heater."""

def __init__(self, water_heater):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/evohome/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from homeassistant.components.water_heater import (
SUPPORT_AWAY_MODE,
SUPPORT_OPERATION_MODE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import PRECISION_TENTHS, PRECISION_WHOLE, STATE_OFF, STATE_ON
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
Expand Down Expand Up @@ -43,7 +43,7 @@ async def async_setup_platform(
async_add_entities([new_entity], update_before_add=True)


class EvoDHW(EvoChild, WaterHeaterDevice):
class EvoDHW(EvoChild, WaterHeaterEntity):
"""Base for a Honeywell TCC DHW controller (aka boiler)."""

def __init__(self, evo_broker, evo_device) -> None:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/geniushub/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from homeassistant.components.water_heater import (
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import STATE_OFF
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
Expand Down Expand Up @@ -49,7 +49,7 @@ async def async_setup_platform(
)


class GeniusWaterHeater(GeniusHeatingZone, WaterHeaterDevice):
class GeniusWaterHeater(GeniusHeatingZone, WaterHeaterEntity):
"""Representation of a Genius Hub water_heater device."""

def __init__(self, broker, zone) -> None:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/hive/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
STATE_OFF,
STATE_ON,
SUPPORT_OPERATION_MODE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import TEMP_CELSIUS

Expand All @@ -29,7 +29,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devs)


class HiveWaterHeater(HiveEntity, WaterHeaterDevice):
class HiveWaterHeater(HiveEntity, WaterHeaterEntity):
"""Hive Water Heater Device."""

@property
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/incomfort/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from homeassistant.components.water_heater import (
DOMAIN as WATER_HEATER_DOMAIN,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.dispatcher import async_dispatcher_send
Expand All @@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([IncomfortWaterHeater(client, h) for h in heaters])


class IncomfortWaterHeater(IncomfortEntity, WaterHeaterDevice):
class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity):
"""Representation of an InComfort/Intouch water_heater device."""

def __init__(self, client, heater) -> None:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/melcloud/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from homeassistant.components.water_heater import (
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TEMP_CELSIUS
Expand All @@ -35,7 +35,7 @@ async def async_setup_entry(
)


class AtwWaterHeater(WaterHeaterDevice):
class AtwWaterHeater(WaterHeaterEntity):
"""Air-to-Water water heater."""

def __init__(self, api: MelCloudDevice, device: AtwDevice) -> None:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tado/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from homeassistant.components.water_heater import (
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
Expand Down Expand Up @@ -98,7 +98,7 @@ def create_water_heater_entity(tado, name: str, zone_id: int, zone: str):
return entity


class TadoWaterHeater(TadoZoneEntity, WaterHeaterDevice):
class TadoWaterHeater(TadoZoneEntity, WaterHeaterEntity):
"""Representation of a Tado water heater."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/vicare/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from homeassistant.components.water_heater import (
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS

Expand Down Expand Up @@ -60,7 +60,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
)


class ViCareWater(WaterHeaterDevice):
class ViCareWater(WaterHeaterEntity):
"""Representation of the ViCare domestic hot water device."""

def __init__(self, name, api, heating_type):
Expand Down
14 changes: 13 additions & 1 deletion homeassistant/components/water_heater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def async_unload_entry(hass, entry):
return await hass.data[DOMAIN].async_unload_entry(entry)


class WaterHeaterDevice(Entity):
class WaterHeaterEntity(Entity):
"""Representation of a water_heater device."""

@property
Expand Down Expand Up @@ -319,3 +319,15 @@ async def async_service_temperature_set(entity, service):
kwargs[value] = temp

await entity.async_set_temperature(**kwargs)


class WaterHeaterDevice(WaterHeaterEntity):
"""Representation of a water heater (for backwards compatibility)."""

def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"WaterHeaterDevice is deprecated, modify %s to extend WaterHeaterEntity",
cls.__name__,
)
4 changes: 2 additions & 2 deletions homeassistant/components/wink/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
SUPPORT_AWAY_MODE,
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE,
WaterHeaterDevice,
WaterHeaterEntity,
)
from homeassistant.const import STATE_OFF, STATE_UNKNOWN, TEMP_CELSIUS

Expand Down Expand Up @@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([WinkWaterHeater(water_heater, hass)])


class WinkWaterHeater(WinkDevice, WaterHeaterDevice):
class WinkWaterHeater(WinkDevice, WaterHeaterEntity):
"""Representation of a Wink water heater."""

@property
Expand Down
12 changes: 12 additions & 0 deletions tests/components/water_heater/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Tests for Water heater."""
from homeassistant.components import water_heater


def test_deprecated_base_class(caplog):
"""Test deprecated base class."""

class CustomWaterHeater(water_heater.WaterHeaterDevice):
pass

CustomWaterHeater()
assert "WaterHeaterDevice is deprecated, modify CustomWaterHeater" in caplog.text