Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ClimateDevice to ClimateEntity #34591

Merged
merged 1 commit into from
Apr 25, 2020
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/ambiclimate/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ambiclimate
import voluptuous as vol

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
Expand Down Expand Up @@ -130,7 +130,7 @@ async def set_temperature_mode(service):
)


class AmbiclimateEntity(ClimateDevice):
class AmbiclimateEntity(ClimateEntity):
"""Representation of a Ambiclimate Thermostat device."""

def __init__(self, heater, store):
Expand Down
22 changes: 17 additions & 5 deletions homeassistant/components/climate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@


async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up climate devices."""
"""Set up climate entities."""
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
)
Expand Down Expand Up @@ -156,8 +156,8 @@ async def async_unload_entry(hass: HomeAssistantType, entry):
return await hass.data[DOMAIN].async_unload_entry(entry)


class ClimateDevice(Entity):
"""Representation of a climate device."""
class ClimateEntity(Entity):
"""Representation of a climate entity."""

@property
def state(self) -> str:
Expand Down Expand Up @@ -509,7 +509,7 @@ def max_humidity(self) -> int:


async def async_service_aux_heat(
entity: ClimateDevice, service: ServiceDataType
entity: ClimateEntity, service: ServiceDataType
) -> None:
"""Handle aux heat service."""
if service.data[ATTR_AUX_HEAT]:
Expand All @@ -519,7 +519,7 @@ async def async_service_aux_heat(


async def async_service_temperature_set(
entity: ClimateDevice, service: ServiceDataType
entity: ClimateEntity, service: ServiceDataType
) -> None:
"""Handle set temperature service."""
hass = entity.hass
Expand All @@ -534,3 +534,15 @@ async def async_service_temperature_set(
kwargs[value] = temp

await entity.async_set_temperature(**kwargs)


class ClimateDevice(ClimateEntity):
"""Representation of a climate entity (for backwards compatibility)."""

def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"ClimateDevice is deprecated, modify %s to extend ClimateEntity",
cls.__name__,
)
4 changes: 2 additions & 2 deletions homeassistant/components/coolmaster/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pycoolmasternet import CoolMasterNet

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_COOL,
HVAC_MODE_DRY,
Expand Down Expand Up @@ -60,7 +60,7 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
async_add_devices(all_devices, True)


class CoolmasterClimate(ClimateDevice):
class CoolmasterClimate(ClimateEntity):
"""Representation of a coolmaster climate device."""

def __init__(self, device, supported_modes):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/daikin/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pydaikin import appliance
import voluptuous as vol

from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
ATTR_FAN_MODE,
ATTR_HVAC_MODE,
Expand Down Expand Up @@ -86,7 +86,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities([DaikinClimate(daikin_api)], update_before_add=True)


class DaikinClimate(ClimateDevice):
class DaikinClimate(ClimateEntity):
"""Representation of a Daikin HVAC."""

def __init__(self, api):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/deconz/climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for deCONZ climate devices."""
from pydeconz.sensor import Thermostat

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_HEAT,
Expand Down Expand Up @@ -58,7 +58,7 @@ def async_add_climate(sensors, new=True):
async_add_climate(gateway.api.sensors.values())


class DeconzThermostat(DeconzDevice, ClimateDevice):
class DeconzThermostat(DeconzDevice, ClimateEntity):
"""Representation of a deCONZ thermostat."""

@property
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/demo/climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Demo platform that offers a fake climate device."""
import logging

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
Expand Down Expand Up @@ -97,7 +97,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
await async_setup_platform(hass, {}, async_add_entities)


class DemoClimate(ClimateDevice):
class DemoClimate(ClimateEntity):
"""Representation of a demo climate device."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/dyson/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from libpurecool.dyson_pure_hotcool_link import DysonPureHotCoolLink
from libpurecool.dyson_pure_state import DysonPureHotCoolState

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
CURRENT_HVAC_COOL,
CURRENT_HVAC_HEAT,
Expand Down Expand Up @@ -43,7 +43,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
)


class DysonPureHotCoolLinkDevice(ClimateDevice):
class DysonPureHotCoolLinkDevice(ClimateEntity):
"""Representation of a Dyson climate fan."""

def __init__(self, device):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/ecobee/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import voluptuous as vol

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
Expand Down Expand Up @@ -249,7 +249,7 @@ def resume_program_set_service(service):
)


class Thermostat(ClimateDevice):
class Thermostat(ClimateEntity):
"""A thermostat class for Ecobee."""

def __init__(self, data, thermostat_index):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/elkm1/climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for control of Elk-M1 connected thermostats."""
from elkm1_lib.const import ThermostatFan, ThermostatMode, ThermostatSetting

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
Expand Down Expand Up @@ -39,7 +39,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities, True)


class ElkThermostat(ElkEntity, ClimateDevice):
class ElkThermostat(ElkEntity, ClimateEntity):
"""Representation of an Elk-M1 Thermostat."""

def __init__(self, element, elk, elk_data):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/ephember/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
import voluptuous as vol

from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
Expand Down Expand Up @@ -70,7 +70,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return


class EphEmberThermostat(ClimateDevice):
class EphEmberThermostat(ClimateEntity):
"""Representation of a EphEmber thermostat."""

def __init__(self, ember, zone):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/eq3btsmart/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import eq3bt as eq3 # pylint: disable=import-error
import voluptuous as vol

from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_HEAT,
Expand Down Expand Up @@ -76,7 +76,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True)


class EQ3BTSmartThermostat(ClimateDevice):
class EQ3BTSmartThermostat(ClimateEntity):
"""Representation of an eQ-3 Bluetooth Smart thermostat."""

def __init__(self, _mac, _name):
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/esphome/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ClimateSwingMode,
)

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE,
ATTR_TARGET_TEMP_HIGH,
Expand Down Expand Up @@ -75,7 +75,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities,
component_key="climate",
info_type=ClimateInfo,
entity_type=EsphomeClimateDevice,
entity_type=EsphomeClimateEntity,
state_type=ClimateState,
)

Expand Down Expand Up @@ -129,7 +129,7 @@ def _swing_modes():
}


class EsphomeClimateDevice(EsphomeEntity, ClimateDevice):
class EsphomeClimateEntity(EsphomeEntity, ClimateEntity):
"""A climate implementation for ESPHome."""

@property
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/evohome/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from typing import List, Optional

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
Expand Down Expand Up @@ -122,7 +122,7 @@ async def async_setup_platform(
async_add_entities([controller] + zones, update_before_add=True)


class EvoClimateDevice(EvoDevice, ClimateDevice):
class EvoClimateEntity(EvoDevice, ClimateEntity):
"""Base for an evohome Climate device."""

def __init__(self, evo_broker, evo_device) -> None:
Expand All @@ -142,7 +142,7 @@ def preset_modes(self) -> Optional[List[str]]:
return self._preset_modes


class EvoZone(EvoChild, EvoClimateDevice):
class EvoZone(EvoChild, EvoClimateEntity):
"""Base for a Honeywell TCC Zone."""

def __init__(self, evo_broker, evo_device) -> None:
Expand Down Expand Up @@ -315,7 +315,7 @@ async def async_update(self) -> None:
self._device_state_attrs[attr] = getattr(self._evo_device, attr)


class EvoController(EvoClimateDevice):
class EvoController(EvoClimateEntity):
"""Base for a Honeywell TCC Controller/Location.

The Controller (aka TCS, temperature control system) is the parent of all the child
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/fibaro/climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for Fibaro thermostats."""
import logging

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_COOL,
Expand Down Expand Up @@ -104,7 +104,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
)


class FibaroThermostat(FibaroDevice, ClimateDevice):
class FibaroThermostat(FibaroDevice, ClimateEntity):
"""Representation of a Fibaro Thermostat."""

def __init__(self, fibaro_device):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/flexit/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pyflexit.pyflexit import pyflexit
import voluptuous as vol

from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_COOL,
SUPPORT_FAN_MODE,
Expand Down Expand Up @@ -42,7 +42,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([Flexit(hub, modbus_slave, name)], True)


class Flexit(ClimateDevice):
class Flexit(ClimateEntity):
"""Representation of a Flexit AC unit."""

def __init__(self, hub, modbus_slave, name):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/fritzbox/climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for AVM Fritz!Box smarthome thermostate devices."""
import requests

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE,
HVAC_MODE_HEAT,
Expand Down Expand Up @@ -61,7 +61,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities)


class FritzboxThermostat(ClimateDevice):
class FritzboxThermostat(ClimateEntity):
"""The thermostat class for Fritzbox smarthome thermostates."""

def __init__(self, device, fritz):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/generic_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import voluptuous as vol

from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
ATTR_PRESET_MODE,
CURRENT_HVAC_COOL,
Expand Down Expand Up @@ -127,7 +127,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
)


class GenericThermostat(ClimateDevice, RestoreEntity):
class GenericThermostat(ClimateEntity, RestoreEntity):
"""Representation of a Generic Thermostat device."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/geniushub/climate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for Genius Hub climate devices."""
from typing import List, Optional

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
Expand Down Expand Up @@ -45,7 +45,7 @@ async def async_setup_platform(
)


class GeniusClimateZone(GeniusHeatingZone, ClimateDevice):
class GeniusClimateZone(GeniusHeatingZone, ClimateEntity):
"""Representation of a Genius Hub climate device."""

def __init__(self, broker, zone) -> None:
Expand Down
Loading