From 8c5c963b9617c3d0419cd6e52e2ba7d6ba9aaba3 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Sat, 25 Apr 2020 18:07:15 +0200 Subject: [PATCH] Rename CoverDevice to CoverEntity (#34595) --- homeassistant/components/abode/cover.py | 4 ++-- homeassistant/components/ads/cover.py | 4 ++-- homeassistant/components/aladdin_connect/cover.py | 4 ++-- homeassistant/components/brunt/cover.py | 4 ++-- homeassistant/components/command_line/cover.py | 4 ++-- homeassistant/components/cover/__init__.py | 13 ++++++++++++- homeassistant/components/deconz/cover.py | 4 ++-- homeassistant/components/demo/cover.py | 4 ++-- homeassistant/components/dynalite/cover.py | 4 ++-- homeassistant/components/esphome/cover.py | 4 ++-- homeassistant/components/fibaro/cover.py | 4 ++-- homeassistant/components/garadget/cover.py | 4 ++-- homeassistant/components/gogogate2/cover.py | 4 ++-- homeassistant/components/group/cover.py | 4 ++-- .../components/homekit_controller/cover.py | 6 +++--- homeassistant/components/homematic/cover.py | 4 ++-- homeassistant/components/homematicip_cloud/cover.py | 10 +++++----- homeassistant/components/insteon/cover.py | 6 +++--- homeassistant/components/isy994/cover.py | 8 ++++---- homeassistant/components/knx/cover.py | 4 ++-- homeassistant/components/lcn/cover.py | 6 +++--- homeassistant/components/lutron/cover.py | 4 ++-- homeassistant/components/lutron_caseta/cover.py | 4 ++-- homeassistant/components/mqtt/cover.py | 4 ++-- homeassistant/components/myq/cover.py | 4 ++-- homeassistant/components/mysensors/cover.py | 4 ++-- homeassistant/components/opengarage/cover.py | 4 ++-- homeassistant/components/rflink/cover.py | 4 ++-- homeassistant/components/rfxtrx/cover.py | 4 ++-- homeassistant/components/rpi_gpio/cover.py | 4 ++-- homeassistant/components/scsgate/cover.py | 4 ++-- homeassistant/components/slide/cover.py | 4 ++-- homeassistant/components/smarthab/cover.py | 4 ++-- homeassistant/components/smartthings/cover.py | 4 ++-- homeassistant/components/soma/cover.py | 4 ++-- homeassistant/components/somfy/cover.py | 4 ++-- homeassistant/components/somfy_mylink/cover.py | 4 ++-- homeassistant/components/supla/cover.py | 6 +++--- homeassistant/components/tahoma/cover.py | 4 ++-- homeassistant/components/tellduslive/cover.py | 4 ++-- homeassistant/components/tellstick/cover.py | 4 ++-- homeassistant/components/template/cover.py | 4 ++-- homeassistant/components/tradfri/cover.py | 4 ++-- homeassistant/components/tuya/cover.py | 4 ++-- homeassistant/components/velbus/cover.py | 4 ++-- homeassistant/components/velux/cover.py | 4 ++-- homeassistant/components/vera/cover.py | 4 ++-- homeassistant/components/wink/cover.py | 10 +++++----- homeassistant/components/xiaomi_aqara/cover.py | 4 ++-- homeassistant/components/zha/cover.py | 4 ++-- homeassistant/components/zwave/cover.py | 6 +++--- tests/components/cover/test_init.py | 12 ++++++++++++ .../testing_config/custom_components/test/cover.py | 4 ++-- 53 files changed, 139 insertions(+), 116 deletions(-) create mode 100644 tests/components/cover/test_init.py diff --git a/homeassistant/components/abode/cover.py b/homeassistant/components/abode/cover.py index 6e38c11cfcc..d88c2fdd404 100644 --- a/homeassistant/components/abode/cover.py +++ b/homeassistant/components/abode/cover.py @@ -1,7 +1,7 @@ """Support for Abode Security System covers.""" import abodepy.helpers.constants as CONST -from homeassistant.components.cover import CoverDevice +from homeassistant.components.cover import CoverEntity from . import AbodeDevice from .const import DOMAIN @@ -19,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(entities) -class AbodeCover(AbodeDevice, CoverDevice): +class AbodeCover(AbodeDevice, CoverEntity): """Representation of an Abode cover.""" @property diff --git a/homeassistant/components/ads/cover.py b/homeassistant/components/ads/cover.py index 0fdcbc16ef8..1a350b3e39f 100644 --- a/homeassistant/components/ads/cover.py +++ b/homeassistant/components/ads/cover.py @@ -11,7 +11,7 @@ from homeassistant.components.cover import ( SUPPORT_OPEN, SUPPORT_SET_POSITION, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME import homeassistant.helpers.config_validation as cv @@ -78,7 +78,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class AdsCover(AdsEntity, CoverDevice): +class AdsCover(AdsEntity, CoverEntity): """Representation of ADS cover.""" def __init__( diff --git a/homeassistant/components/aladdin_connect/cover.py b/homeassistant/components/aladdin_connect/cover.py index eaa2dfc85f0..8b61d29b78a 100644 --- a/homeassistant/components/aladdin_connect/cover.py +++ b/homeassistant/components/aladdin_connect/cover.py @@ -8,7 +8,7 @@ from homeassistant.components.cover import ( PLATFORM_SCHEMA, SUPPORT_CLOSE, SUPPORT_OPEN, - CoverDevice, + CoverEntity, ) from homeassistant.const import ( CONF_PASSWORD, @@ -59,7 +59,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class AladdinDevice(CoverDevice): +class AladdinDevice(CoverEntity): """Representation of Aladdin Connect cover.""" def __init__(self, acc, device): diff --git a/homeassistant/components/brunt/cover.py b/homeassistant/components/brunt/cover.py index b3a007277c3..83c20ea1088 100644 --- a/homeassistant/components/brunt/cover.py +++ b/homeassistant/components/brunt/cover.py @@ -11,7 +11,7 @@ from homeassistant.components.cover import ( SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, - CoverDevice, + CoverEntity, ) from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME import homeassistant.helpers.config_validation as cv @@ -62,7 +62,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class BruntDevice(CoverDevice): +class BruntDevice(CoverEntity): """ Representation of a Brunt cover device. diff --git a/homeassistant/components/command_line/cover.py b/homeassistant/components/command_line/cover.py index 1edf141604f..6f2a038d051 100644 --- a/homeassistant/components/command_line/cover.py +++ b/homeassistant/components/command_line/cover.py @@ -4,7 +4,7 @@ import subprocess import voluptuous as vol -from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice +from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity from homeassistant.const import ( CONF_COMMAND_CLOSE, CONF_COMMAND_OPEN, @@ -63,7 +63,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(covers) -class CommandCover(CoverDevice): +class CommandCover(CoverEntity): """Representation a command line cover.""" def __init__( diff --git a/homeassistant/components/cover/__init__.py b/homeassistant/components/cover/__init__.py index cb2812f319b..84494e60c6a 100644 --- a/homeassistant/components/cover/__init__.py +++ b/homeassistant/components/cover/__init__.py @@ -153,7 +153,7 @@ async def async_unload_entry(hass, entry): return await hass.data[DOMAIN].async_unload_entry(entry) -class CoverDevice(Entity): +class CoverEntity(Entity): """Representation of a cover.""" @property @@ -318,3 +318,14 @@ class CoverDevice(Entity): await self.async_open_cover_tilt(**kwargs) else: await self.async_close_cover_tilt(**kwargs) + + +class CoverDevice(CoverEntity): + """Representation of a cover (for backwards compatibility).""" + + def __init_subclass__(cls, **kwargs): + """Print deprecation warning.""" + super().__init_subclass__(**kwargs) + _LOGGER.warning( + "CoverDevice is deprecated, modify %s to extend CoverEntity", cls.__name__, + ) diff --git a/homeassistant/components/deconz/cover.py b/homeassistant/components/deconz/cover.py index 7db3477c3bb..e01cfdbe5f8 100644 --- a/homeassistant/components/deconz/cover.py +++ b/homeassistant/components/deconz/cover.py @@ -5,7 +5,7 @@ from homeassistant.components.cover import ( SUPPORT_OPEN, SUPPORT_SET_POSITION, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -46,7 +46,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_cover(gateway.api.lights.values()) -class DeconzCover(DeconzDevice, CoverDevice): +class DeconzCover(DeconzDevice, CoverEntity): """Representation of a deCONZ cover.""" def __init__(self, device, gateway): diff --git a/homeassistant/components/demo/cover.py b/homeassistant/components/demo/cover.py index ab95cc978b3..e65d6e59ece 100644 --- a/homeassistant/components/demo/cover.py +++ b/homeassistant/components/demo/cover.py @@ -4,7 +4,7 @@ from homeassistant.components.cover import ( ATTR_TILT_POSITION, SUPPORT_CLOSE, SUPPORT_OPEN, - CoverDevice, + CoverEntity, ) from homeassistant.core import callback from homeassistant.helpers.event import async_track_utc_time_change @@ -35,7 +35,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): await async_setup_platform(hass, {}, async_add_entities) -class DemoCover(CoverDevice): +class DemoCover(CoverEntity): """Representation of a demo cover.""" def __init__( diff --git a/homeassistant/components/dynalite/cover.py b/homeassistant/components/dynalite/cover.py index dcf16ede58c..a5c25945aa8 100644 --- a/homeassistant/components/dynalite/cover.py +++ b/homeassistant/components/dynalite/cover.py @@ -1,7 +1,7 @@ """Support for the Dynalite channels as covers.""" from typing import Callable -from homeassistant.components.cover import DEVICE_CLASSES, CoverDevice +from homeassistant.components.cover import DEVICE_CLASSES, CoverEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback @@ -25,7 +25,7 @@ async def async_setup_entry( ) -class DynaliteCover(DynaliteBase, CoverDevice): +class DynaliteCover(DynaliteBase, CoverEntity): """Representation of a Dynalite Channel as a Home Assistant Cover.""" @property diff --git a/homeassistant/components/esphome/cover.py b/homeassistant/components/esphome/cover.py index 53014991de8..fcf7c22a2a2 100644 --- a/homeassistant/components/esphome/cover.py +++ b/homeassistant/components/esphome/cover.py @@ -14,7 +14,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_POSITION, SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType @@ -39,7 +39,7 @@ async def async_setup_entry( ) -class EsphomeCover(EsphomeEntity, CoverDevice): +class EsphomeCover(EsphomeEntity, CoverEntity): """A cover implementation for ESPHome.""" @property diff --git a/homeassistant/components/fibaro/cover.py b/homeassistant/components/fibaro/cover.py index d2f8094f26d..943df5b5681 100644 --- a/homeassistant/components/fibaro/cover.py +++ b/homeassistant/components/fibaro/cover.py @@ -5,7 +5,7 @@ from homeassistant.components.cover import ( ATTR_POSITION, ATTR_TILT_POSITION, DOMAIN, - CoverDevice, + CoverEntity, ) from . import FIBARO_DEVICES, FibaroDevice @@ -23,7 +23,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class FibaroCover(FibaroDevice, CoverDevice): +class FibaroCover(FibaroDevice, CoverEntity): """Representation a Fibaro Cover.""" def __init__(self, fibaro_device): diff --git a/homeassistant/components/garadget/cover.py b/homeassistant/components/garadget/cover.py index a1f324be1ff..34a9a13b8d9 100644 --- a/homeassistant/components/garadget/cover.py +++ b/homeassistant/components/garadget/cover.py @@ -4,7 +4,7 @@ import logging import requests import voluptuous as vol -from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice +from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity from homeassistant.const import ( CONF_ACCESS_TOKEN, CONF_COVERS, @@ -74,7 +74,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(covers) -class GaradgetCover(CoverDevice): +class GaradgetCover(CoverEntity): """Representation of a Garadget cover.""" def __init__(self, hass, args): diff --git a/homeassistant/components/gogogate2/cover.py b/homeassistant/components/gogogate2/cover.py index 62aea62bf84..68babd3debe 100644 --- a/homeassistant/components/gogogate2/cover.py +++ b/homeassistant/components/gogogate2/cover.py @@ -4,7 +4,7 @@ import logging from pygogogate2 import Gogogate2API as pygogogate2 import voluptuous as vol -from homeassistant.components.cover import SUPPORT_CLOSE, SUPPORT_OPEN, CoverDevice +from homeassistant.components.cover import SUPPORT_CLOSE, SUPPORT_OPEN, CoverEntity from homeassistant.const import ( CONF_IP_ADDRESS, CONF_NAME, @@ -57,7 +57,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class MyGogogate2Device(CoverDevice): +class MyGogogate2Device(CoverEntity): """Representation of a Gogogate2 cover.""" def __init__(self, mygogogate2, device, name): diff --git a/homeassistant/components/group/cover.py b/homeassistant/components/group/cover.py index d9efdfa53c6..c4e691eeff9 100644 --- a/homeassistant/components/group/cover.py +++ b/homeassistant/components/group/cover.py @@ -27,7 +27,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, SUPPORT_STOP_TILT, - CoverDevice, + CoverEntity, ) from homeassistant.const import ( ATTR_ASSUMED_STATE, @@ -66,7 +66,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities([CoverGroup(config[CONF_NAME], config[CONF_ENTITIES])]) -class CoverGroup(CoverDevice): +class CoverGroup(CoverEntity): """Representation of a CoverGroup.""" def __init__(self, name, entities): diff --git a/homeassistant/components/homekit_controller/cover.py b/homeassistant/components/homekit_controller/cover.py index 88885d49b8e..086f780b816 100644 --- a/homeassistant/components/homekit_controller/cover.py +++ b/homeassistant/components/homekit_controller/cover.py @@ -13,7 +13,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_POSITION, SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING from homeassistant.core import callback @@ -58,7 +58,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): conn.add_listener(async_add_service) -class HomeKitGarageDoorCover(HomeKitEntity, CoverDevice): +class HomeKitGarageDoorCover(HomeKitEntity, CoverEntity): """Representation of a HomeKit Garage Door.""" @property @@ -128,7 +128,7 @@ class HomeKitGarageDoorCover(HomeKitEntity, CoverDevice): return attributes -class HomeKitWindowCover(HomeKitEntity, CoverDevice): +class HomeKitWindowCover(HomeKitEntity, CoverEntity): """Representation of a HomeKit Window or Window Covering.""" def get_characteristic_types(self): diff --git a/homeassistant/components/homematic/cover.py b/homeassistant/components/homematic/cover.py index 0dea1181d73..a520c08e478 100644 --- a/homeassistant/components/homematic/cover.py +++ b/homeassistant/components/homematic/cover.py @@ -4,7 +4,7 @@ import logging from homeassistant.components.cover import ( ATTR_POSITION, ATTR_TILT_POSITION, - CoverDevice, + CoverEntity, ) from .const import ATTR_DISCOVER_DEVICES @@ -26,7 +26,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class HMCover(HMDevice, CoverDevice): +class HMCover(HMDevice, CoverEntity): """Representation a HomeMatic Cover.""" @property diff --git a/homeassistant/components/homematicip_cloud/cover.py b/homeassistant/components/homematicip_cloud/cover.py index 768c893a100..580e2d21a11 100644 --- a/homeassistant/components/homematicip_cloud/cover.py +++ b/homeassistant/components/homematicip_cloud/cover.py @@ -13,7 +13,7 @@ from homematicip.base.enums import DoorCommand, DoorState from homeassistant.components.cover import ( ATTR_POSITION, ATTR_TILT_POSITION, - CoverDevice, + CoverEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType @@ -51,7 +51,7 @@ async def async_setup_entry( async_add_entities(entities) -class HomematicipCoverShutter(HomematicipGenericDevice, CoverDevice): +class HomematicipCoverShutter(HomematicipGenericDevice, CoverEntity): """Representation of a HomematicIP Cloud cover shutter device.""" @property @@ -88,7 +88,7 @@ class HomematicipCoverShutter(HomematicipGenericDevice, CoverDevice): await self._device.set_shutter_stop() -class HomematicipCoverSlats(HomematicipCoverShutter, CoverDevice): +class HomematicipCoverSlats(HomematicipCoverShutter, CoverEntity): """Representation of a HomematicIP Cloud cover slats device.""" @property @@ -118,7 +118,7 @@ class HomematicipCoverSlats(HomematicipCoverShutter, CoverDevice): await self._device.set_shutter_stop() -class HomematicipGarageDoorModuleTormatic(HomematicipGenericDevice, CoverDevice): +class HomematicipGarageDoorModuleTormatic(HomematicipGenericDevice, CoverEntity): """Representation of a HomematicIP Garage Door Module for Tormatic.""" @property @@ -150,7 +150,7 @@ class HomematicipGarageDoorModuleTormatic(HomematicipGenericDevice, CoverDevice) await self._device.send_door_command(DoorCommand.STOP) -class HomematicipCoverShutterGroup(HomematicipCoverSlats, CoverDevice): +class HomematicipCoverShutterGroup(HomematicipCoverSlats, CoverEntity): """Representation of a HomematicIP Cloud cover shutter group.""" def __init__(self, hap: HomematicipHAP, device, post: str = "ShutterGroup") -> None: diff --git a/homeassistant/components/insteon/cover.py b/homeassistant/components/insteon/cover.py index 575799cbf67..b325a6ebd84 100644 --- a/homeassistant/components/insteon/cover.py +++ b/homeassistant/components/insteon/cover.py @@ -7,7 +7,7 @@ from homeassistant.components.cover import ( SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, - CoverDevice, + CoverEntity, ) from .insteon_entity import InsteonEntity @@ -34,12 +34,12 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= device.states[state_key].name, ) - new_entity = InsteonCoverDevice(device, state_key) + new_entity = InsteonCoverEntity(device, state_key) async_add_entities([new_entity]) -class InsteonCoverDevice(InsteonEntity, CoverDevice): +class InsteonCoverEntity(InsteonEntity, CoverEntity): """A Class for an Insteon device.""" @property diff --git a/homeassistant/components/isy994/cover.py b/homeassistant/components/isy994/cover.py index f5e052f6926..38688db21d2 100644 --- a/homeassistant/components/isy994/cover.py +++ b/homeassistant/components/isy994/cover.py @@ -2,7 +2,7 @@ import logging from typing import Callable -from homeassistant.components.cover import DOMAIN, CoverDevice +from homeassistant.components.cover import DOMAIN, CoverEntity from homeassistant.const import ( STATE_CLOSED, STATE_CLOSING, @@ -31,7 +31,7 @@ def setup_platform( """Set up the ISY994 cover platform.""" devices = [] for node in hass.data[ISY994_NODES][DOMAIN]: - devices.append(ISYCoverDevice(node)) + devices.append(ISYCoverEntity(node)) for name, status, actions in hass.data[ISY994_PROGRAMS][DOMAIN]: devices.append(ISYCoverProgram(name, status, actions)) @@ -39,7 +39,7 @@ def setup_platform( add_entities(devices) -class ISYCoverDevice(ISYDevice, CoverDevice): +class ISYCoverEntity(ISYDevice, CoverEntity): """Representation of an ISY994 cover device.""" @property @@ -72,7 +72,7 @@ class ISYCoverDevice(ISYDevice, CoverDevice): _LOGGER.error("Unable to close the cover") -class ISYCoverProgram(ISYCoverDevice): +class ISYCoverProgram(ISYCoverEntity): """Representation of an ISY994 cover program.""" def __init__(self, name: str, node: object, actions: object) -> None: diff --git a/homeassistant/components/knx/cover.py b/homeassistant/components/knx/cover.py index 5c4aa762b5c..92e7e599bcb 100644 --- a/homeassistant/components/knx/cover.py +++ b/homeassistant/components/knx/cover.py @@ -11,7 +11,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_POSITION, SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from homeassistant.const import CONF_NAME from homeassistant.core import callback @@ -94,7 +94,7 @@ def async_add_entities_config(hass, config, async_add_entities): async_add_entities([KNXCover(cover)]) -class KNXCover(CoverDevice): +class KNXCover(CoverEntity): """Representation of a KNX cover.""" def __init__(self, device): diff --git a/homeassistant/components/lcn/cover.py b/homeassistant/components/lcn/cover.py index 61ae05fa010..05ee17a7daf 100644 --- a/homeassistant/components/lcn/cover.py +++ b/homeassistant/components/lcn/cover.py @@ -1,7 +1,7 @@ """Support for LCN covers.""" import pypck -from homeassistant.components.cover import CoverDevice +from homeassistant.components.cover import CoverEntity from homeassistant.const import CONF_ADDRESS from . import LcnDevice @@ -32,7 +32,7 @@ async def async_setup_platform( async_add_entities(devices) -class LcnOutputsCover(LcnDevice, CoverDevice): +class LcnOutputsCover(LcnDevice, CoverEntity): """Representation of a LCN cover connected to output ports.""" def __init__(self, config, address_connection): @@ -111,7 +111,7 @@ class LcnOutputsCover(LcnDevice, CoverDevice): self.async_write_ha_state() -class LcnRelayCover(LcnDevice, CoverDevice): +class LcnRelayCover(LcnDevice, CoverEntity): """Representation of a LCN cover connected to relays.""" def __init__(self, config, address_connection): diff --git a/homeassistant/components/lutron/cover.py b/homeassistant/components/lutron/cover.py index cf8d4d16427..438a433fb0f 100644 --- a/homeassistant/components/lutron/cover.py +++ b/homeassistant/components/lutron/cover.py @@ -6,7 +6,7 @@ from homeassistant.components.cover import ( SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, - CoverDevice, + CoverEntity, ) from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice @@ -25,7 +25,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): return True -class LutronCover(LutronDevice, CoverDevice): +class LutronCover(LutronDevice, CoverEntity): """Representation of a Lutron shade.""" @property diff --git a/homeassistant/components/lutron_caseta/cover.py b/homeassistant/components/lutron_caseta/cover.py index 60c723b7b42..64c0aeac744 100644 --- a/homeassistant/components/lutron_caseta/cover.py +++ b/homeassistant/components/lutron_caseta/cover.py @@ -7,7 +7,7 @@ from homeassistant.components.cover import ( SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, - CoverDevice, + CoverEntity, ) from . import LUTRON_CASETA_SMARTBRIDGE, LutronCasetaDevice @@ -27,7 +27,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(entities, True) -class LutronCasetaCover(LutronCasetaDevice, CoverDevice): +class LutronCasetaCover(LutronCasetaDevice, CoverEntity): """Representation of a Lutron shade.""" @property diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index d5487bbe29f..4ed128f1ff3 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -16,7 +16,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, SUPPORT_STOP_TILT, - CoverDevice, + CoverEntity, ) from homeassistant.const import ( CONF_DEVICE, @@ -205,7 +205,7 @@ class MqttCover( MqttAvailability, MqttDiscoveryUpdate, MqttEntityDeviceInfo, - CoverDevice, + CoverEntity, ): """Representation of a cover that can be controlled using MQTT.""" diff --git a/homeassistant/components/myq/cover.py b/homeassistant/components/myq/cover.py index 04eb49c00a9..e351eca81ca 100644 --- a/homeassistant/components/myq/cover.py +++ b/homeassistant/components/myq/cover.py @@ -10,7 +10,7 @@ from homeassistant.components.cover import ( PLATFORM_SCHEMA, SUPPORT_CLOSE, SUPPORT_OPEN, - CoverDevice, + CoverEntity, ) from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( @@ -80,7 +80,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class MyQDevice(CoverDevice): +class MyQDevice(CoverEntity): """Representation of a MyQ cover.""" def __init__(self, coordinator, device): diff --git a/homeassistant/components/mysensors/cover.py b/homeassistant/components/mysensors/cover.py index b60cf9457a9..f2ede69793f 100644 --- a/homeassistant/components/mysensors/cover.py +++ b/homeassistant/components/mysensors/cover.py @@ -1,6 +1,6 @@ """Support for MySensors covers.""" from homeassistant.components import mysensors -from homeassistant.components.cover import ATTR_POSITION, DOMAIN, CoverDevice +from homeassistant.components.cover import ATTR_POSITION, DOMAIN, CoverEntity from homeassistant.const import STATE_OFF, STATE_ON @@ -15,7 +15,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= ) -class MySensorsCover(mysensors.device.MySensorsEntity, CoverDevice): +class MySensorsCover(mysensors.device.MySensorsEntity, CoverEntity): """Representation of the value of a MySensors Cover child node.""" @property diff --git a/homeassistant/components/opengarage/cover.py b/homeassistant/components/opengarage/cover.py index e34f98c87d2..5297d0ce05e 100644 --- a/homeassistant/components/opengarage/cover.py +++ b/homeassistant/components/opengarage/cover.py @@ -9,7 +9,7 @@ from homeassistant.components.cover import ( PLATFORM_SCHEMA, SUPPORT_CLOSE, SUPPORT_OPEN, - CoverDevice, + CoverEntity, ) from homeassistant.const import ( CONF_COVERS, @@ -74,7 +74,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(covers, True) -class OpenGarageCover(CoverDevice): +class OpenGarageCover(CoverEntity): """Representation of a OpenGarage cover.""" def __init__(self, args): diff --git a/homeassistant/components/rflink/cover.py b/homeassistant/components/rflink/cover.py index 794542cb9d4..5eacce3afa8 100644 --- a/homeassistant/components/rflink/cover.py +++ b/homeassistant/components/rflink/cover.py @@ -3,7 +3,7 @@ import logging import voluptuous as vol -from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice +from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity from homeassistant.const import CONF_NAME, CONF_TYPE, STATE_OPEN import homeassistant.helpers.config_validation as cv from homeassistant.helpers.restore_state import RestoreEntity @@ -112,7 +112,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(devices_from_config(config)) -class RflinkCover(RflinkCommand, CoverDevice, RestoreEntity): +class RflinkCover(RflinkCommand, CoverEntity, RestoreEntity): """Rflink entity which can switch on/stop/off (eg: cover).""" async def async_added_to_hass(self): diff --git a/homeassistant/components/rfxtrx/cover.py b/homeassistant/components/rfxtrx/cover.py index da19c42ed69..bd64d20fe46 100644 --- a/homeassistant/components/rfxtrx/cover.py +++ b/homeassistant/components/rfxtrx/cover.py @@ -2,7 +2,7 @@ import RFXtrx as rfxtrxmod import voluptuous as vol -from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice +from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity from homeassistant.const import CONF_NAME, STATE_OPEN from homeassistant.helpers import config_validation as cv from homeassistant.helpers.restore_state import RestoreEntity @@ -63,7 +63,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): RECEIVED_EVT_SUBSCRIBERS.append(cover_update) -class RfxtrxCover(RfxtrxDevice, CoverDevice, RestoreEntity): +class RfxtrxCover(RfxtrxDevice, CoverEntity, RestoreEntity): """Representation of a RFXtrx cover.""" async def async_added_to_hass(self): diff --git a/homeassistant/components/rpi_gpio/cover.py b/homeassistant/components/rpi_gpio/cover.py index 648171b9738..56e76959ecc 100644 --- a/homeassistant/components/rpi_gpio/cover.py +++ b/homeassistant/components/rpi_gpio/cover.py @@ -5,7 +5,7 @@ from time import sleep import voluptuous as vol from homeassistant.components import rpi_gpio -from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice +from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity from homeassistant.const import CONF_NAME import homeassistant.helpers.config_validation as cv @@ -71,7 +71,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(covers) -class RPiGPIOCover(CoverDevice): +class RPiGPIOCover(CoverEntity): """Representation of a Raspberry GPIO cover.""" def __init__( diff --git a/homeassistant/components/scsgate/cover.py b/homeassistant/components/scsgate/cover.py index f9ef2e12730..0c7d057316c 100644 --- a/homeassistant/components/scsgate/cover.py +++ b/homeassistant/components/scsgate/cover.py @@ -8,7 +8,7 @@ from scsgate.tasks import ( ) import voluptuous as vol -from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice +from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity from homeassistant.const import CONF_DEVICES, CONF_NAME import homeassistant.helpers.config_validation as cv @@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(covers) -class SCSGateCover(CoverDevice): +class SCSGateCover(CoverEntity): """Representation of SCSGate cover.""" def __init__(self, scs_id, name, logger, scsgate): diff --git a/homeassistant/components/slide/cover.py b/homeassistant/components/slide/cover.py index f50226b9f01..470cf9e5a1f 100644 --- a/homeassistant/components/slide/cover.py +++ b/homeassistant/components/slide/cover.py @@ -8,7 +8,7 @@ from homeassistant.components.cover import ( STATE_CLOSED, STATE_CLOSING, STATE_OPENING, - CoverDevice, + CoverEntity, ) from homeassistant.const import ATTR_ID @@ -32,7 +32,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(entities) -class SlideCover(CoverDevice): +class SlideCover(CoverEntity): """Representation of a Slide cover.""" def __init__(self, api, slide): diff --git a/homeassistant/components/smarthab/cover.py b/homeassistant/components/smarthab/cover.py index af55f2de7f9..09b8a7435ee 100644 --- a/homeassistant/components/smarthab/cover.py +++ b/homeassistant/components/smarthab/cover.py @@ -10,7 +10,7 @@ from homeassistant.components.cover import ( SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, - CoverDevice, + CoverEntity, ) from . import DATA_HUB, DOMAIN @@ -37,7 +37,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(entities, True) -class SmartHabCover(CoverDevice): +class SmartHabCover(CoverEntity): """Representation a cover.""" def __init__(self, cover): diff --git a/homeassistant/components/smartthings/cover.py b/homeassistant/components/smartthings/cover.py index a41d9d6b9f7..ddc52ec3f6c 100644 --- a/homeassistant/components/smartthings/cover.py +++ b/homeassistant/components/smartthings/cover.py @@ -16,7 +16,7 @@ from homeassistant.components.cover import ( SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, - CoverDevice, + CoverEntity, ) from homeassistant.const import ATTR_BATTERY_LEVEL @@ -61,7 +61,7 @@ def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]: return None -class SmartThingsCover(SmartThingsEntity, CoverDevice): +class SmartThingsCover(SmartThingsEntity, CoverEntity): """Define a SmartThings cover.""" def __init__(self, device): diff --git a/homeassistant/components/soma/cover.py b/homeassistant/components/soma/cover.py index 9bfe903e724..f2929dd8ddd 100644 --- a/homeassistant/components/soma/cover.py +++ b/homeassistant/components/soma/cover.py @@ -2,7 +2,7 @@ import logging -from homeassistant.components.cover import ATTR_POSITION, CoverDevice +from homeassistant.components.cover import ATTR_POSITION, CoverEntity from homeassistant.components.soma import API, DEVICES, DOMAIN, SomaEntity _LOGGER = logging.getLogger(__name__) @@ -18,7 +18,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class SomaCover(SomaEntity, CoverDevice): +class SomaCover(SomaEntity, CoverEntity): """Representation of a Soma cover device.""" def close_cover(self, **kwargs): diff --git a/homeassistant/components/somfy/cover.py b/homeassistant/components/somfy/cover.py index d0e555ed55c..cddde87d8f6 100644 --- a/homeassistant/components/somfy/cover.py +++ b/homeassistant/components/somfy/cover.py @@ -5,7 +5,7 @@ from pymfy.api.devices.category import Category from homeassistant.components.cover import ( ATTR_POSITION, ATTR_TILT_POSITION, - CoverDevice, + CoverEntity, ) from . import API, CONF_OPTIMISTIC, DEVICES, DOMAIN, SomfyEntity @@ -35,7 +35,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(await hass.async_add_executor_job(get_covers), True) -class SomfyCover(SomfyEntity, CoverDevice): +class SomfyCover(SomfyEntity, CoverEntity): """Representation of a Somfy cover device.""" def __init__(self, device, api, optimistic): diff --git a/homeassistant/components/somfy_mylink/cover.py b/homeassistant/components/somfy_mylink/cover.py index b4680cc06de..767abda2fd7 100644 --- a/homeassistant/components/somfy_mylink/cover.py +++ b/homeassistant/components/somfy_mylink/cover.py @@ -1,7 +1,7 @@ """Cover Platform for the Somfy MyLink component.""" import logging -from homeassistant.components.cover import ENTITY_ID_FORMAT, CoverDevice +from homeassistant.components.cover import ENTITY_ID_FORMAT, CoverEntity from homeassistant.util import slugify from . import CONF_DEFAULT_REVERSE, DATA_SOMFY_MYLINK @@ -40,7 +40,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(cover_list) -class SomfyShade(CoverDevice): +class SomfyShade(CoverEntity): """Object for controlling a Somfy cover.""" def __init__( diff --git a/homeassistant/components/supla/cover.py b/homeassistant/components/supla/cover.py index 659b78cc41a..1c0f2f60431 100644 --- a/homeassistant/components/supla/cover.py +++ b/homeassistant/components/supla/cover.py @@ -5,7 +5,7 @@ from pprint import pformat from homeassistant.components.cover import ( ATTR_POSITION, DEVICE_CLASS_GARAGE, - CoverDevice, + CoverEntity, ) from homeassistant.components.supla import SuplaChannel @@ -32,7 +32,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(entities) -class SuplaCover(SuplaChannel, CoverDevice): +class SuplaCover(SuplaChannel, CoverEntity): """Representation of a Supla Cover.""" @property @@ -67,7 +67,7 @@ class SuplaCover(SuplaChannel, CoverDevice): self.action("STOP") -class SuplaGateDoor(SuplaChannel, CoverDevice): +class SuplaGateDoor(SuplaChannel, CoverEntity): """Representation of a Supla gate door.""" @property diff --git a/homeassistant/components/tahoma/cover.py b/homeassistant/components/tahoma/cover.py index e13f9bb8859..2eec9160811 100644 --- a/homeassistant/components/tahoma/cover.py +++ b/homeassistant/components/tahoma/cover.py @@ -10,7 +10,7 @@ from homeassistant.components.cover import ( DEVICE_CLASS_GARAGE, DEVICE_CLASS_SHUTTER, DEVICE_CLASS_WINDOW, - CoverDevice, + CoverEntity, ) from homeassistant.util.dt import utcnow @@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class TahomaCover(TahomaDevice, CoverDevice): +class TahomaCover(TahomaDevice, CoverEntity): """Representation a Tahoma Cover.""" def __init__(self, tahoma_device, controller): diff --git a/homeassistant/components/tellduslive/cover.py b/homeassistant/components/tellduslive/cover.py index 6e31cd595bf..246b22dc157 100644 --- a/homeassistant/components/tellduslive/cover.py +++ b/homeassistant/components/tellduslive/cover.py @@ -2,7 +2,7 @@ import logging from homeassistant.components import cover, tellduslive -from homeassistant.components.cover import CoverDevice +from homeassistant.components.cover import CoverEntity from homeassistant.helpers.dispatcher import async_dispatcher_connect from .entry import TelldusLiveEntity @@ -25,7 +25,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class TelldusLiveCover(TelldusLiveEntity, CoverDevice): +class TelldusLiveCover(TelldusLiveEntity, CoverEntity): """Representation of a cover.""" @property diff --git a/homeassistant/components/tellstick/cover.py b/homeassistant/components/tellstick/cover.py index 0a5643fc1ea..bb25a601a2f 100644 --- a/homeassistant/components/tellstick/cover.py +++ b/homeassistant/components/tellstick/cover.py @@ -1,5 +1,5 @@ """Support for Tellstick covers.""" -from homeassistant.components.cover import CoverDevice +from homeassistant.components.cover import CoverEntity from . import ( ATTR_DISCOVER_CONFIG, @@ -28,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class TellstickCover(TellstickDevice, CoverDevice): +class TellstickCover(TellstickDevice, CoverEntity): """Representation of a Tellstick cover.""" @property diff --git a/homeassistant/components/template/cover.py b/homeassistant/components/template/cover.py index 3e3232f2b91..cea91ea2963 100644 --- a/homeassistant/components/template/cover.py +++ b/homeassistant/components/template/cover.py @@ -17,7 +17,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, SUPPORT_STOP_TILT, - CoverDevice, + CoverEntity, ) from homeassistant.const import ( CONF_DEVICE_CLASS, @@ -161,7 +161,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(covers) -class CoverTemplate(CoverDevice): +class CoverTemplate(CoverEntity): """Representation of a Template cover.""" def __init__( diff --git a/homeassistant/components/tradfri/cover.py b/homeassistant/components/tradfri/cover.py index 744ba2e13b1..6d8669eea91 100644 --- a/homeassistant/components/tradfri/cover.py +++ b/homeassistant/components/tradfri/cover.py @@ -1,6 +1,6 @@ """Support for IKEA Tradfri covers.""" -from homeassistant.components.cover import ATTR_POSITION, CoverDevice +from homeassistant.components.cover import ATTR_POSITION, CoverEntity from .base_class import TradfriBaseDevice from .const import ATTR_MODEL, CONF_GATEWAY_ID, KEY_API, KEY_GATEWAY @@ -19,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(TradfriCover(cover, api, gateway_id) for cover in covers) -class TradfriCover(TradfriBaseDevice, CoverDevice): +class TradfriCover(TradfriBaseDevice, CoverEntity): """The platform class required by Home Assistant.""" def __init__(self, device, api, gateway_id): diff --git a/homeassistant/components/tuya/cover.py b/homeassistant/components/tuya/cover.py index 35fd4719fdb..d7528cf6092 100644 --- a/homeassistant/components/tuya/cover.py +++ b/homeassistant/components/tuya/cover.py @@ -4,7 +4,7 @@ from homeassistant.components.cover import ( SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from . import DATA_TUYA, TuyaDevice @@ -27,7 +27,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices) -class TuyaCover(TuyaDevice, CoverDevice): +class TuyaCover(TuyaDevice, CoverEntity): """Tuya cover devices.""" def __init__(self, tuya): diff --git a/homeassistant/components/velbus/cover.py b/homeassistant/components/velbus/cover.py index 4478bb81c3c..efe4fdc964b 100644 --- a/homeassistant/components/velbus/cover.py +++ b/homeassistant/components/velbus/cover.py @@ -9,7 +9,7 @@ from homeassistant.components.cover import ( SUPPORT_OPEN, SUPPORT_SET_POSITION, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from . import VelbusEntity @@ -29,7 +29,7 @@ async def async_setup_entry(hass, entry, async_add_entities): async_add_entities(entities) -class VelbusCover(VelbusEntity, CoverDevice): +class VelbusCover(VelbusEntity, CoverEntity): """Representation a Velbus cover.""" @property diff --git a/homeassistant/components/velux/cover.py b/homeassistant/components/velux/cover.py index fe5b1dcf3af..52d2e497b7d 100644 --- a/homeassistant/components/velux/cover.py +++ b/homeassistant/components/velux/cover.py @@ -8,7 +8,7 @@ from homeassistant.components.cover import ( SUPPORT_OPEN, SUPPORT_SET_POSITION, SUPPORT_STOP, - CoverDevice, + CoverEntity, ) from homeassistant.core import callback @@ -25,7 +25,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(entities) -class VeluxCover(CoverDevice): +class VeluxCover(CoverEntity): """Representation of a Velux cover.""" def __init__(self, node): diff --git a/homeassistant/components/vera/cover.py b/homeassistant/components/vera/cover.py index 0d0edb841c1..a1f536d9cc1 100644 --- a/homeassistant/components/vera/cover.py +++ b/homeassistant/components/vera/cover.py @@ -6,7 +6,7 @@ from homeassistant.components.cover import ( ATTR_POSITION, DOMAIN as PLATFORM_DOMAIN, ENTITY_ID_FORMAT, - CoverDevice, + CoverEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant @@ -33,7 +33,7 @@ async def async_setup_entry( ) -class VeraCover(VeraDevice, CoverDevice): +class VeraCover(VeraDevice, CoverEntity): """Representation a Vera Cover.""" def __init__(self, vera_device, controller): diff --git a/homeassistant/components/wink/cover.py b/homeassistant/components/wink/cover.py index 1ce7f9b8875..f2f4241c64d 100644 --- a/homeassistant/components/wink/cover.py +++ b/homeassistant/components/wink/cover.py @@ -1,7 +1,7 @@ """Support for Wink covers.""" import pywink -from homeassistant.components.cover import ATTR_POSITION, CoverDevice +from homeassistant.components.cover import ATTR_POSITION, CoverEntity from . import DOMAIN, WinkDevice @@ -12,18 +12,18 @@ def setup_platform(hass, config, add_entities, discovery_info=None): for shade in pywink.get_shades(): _id = shade.object_id() + shade.name() if _id not in hass.data[DOMAIN]["unique_ids"]: - add_entities([WinkCoverDevice(shade, hass)]) + add_entities([WinkCoverEntity(shade, hass)]) for shade in pywink.get_shade_groups(): _id = shade.object_id() + shade.name() if _id not in hass.data[DOMAIN]["unique_ids"]: - add_entities([WinkCoverDevice(shade, hass)]) + add_entities([WinkCoverEntity(shade, hass)]) for door in pywink.get_garage_doors(): _id = door.object_id() + door.name() if _id not in hass.data[DOMAIN]["unique_ids"]: - add_entities([WinkCoverDevice(door, hass)]) + add_entities([WinkCoverEntity(door, hass)]) -class WinkCoverDevice(WinkDevice, CoverDevice): +class WinkCoverEntity(WinkDevice, CoverEntity): """Representation of a Wink cover device.""" async def async_added_to_hass(self): diff --git a/homeassistant/components/xiaomi_aqara/cover.py b/homeassistant/components/xiaomi_aqara/cover.py index da6b24d616a..52d2487e74f 100644 --- a/homeassistant/components/xiaomi_aqara/cover.py +++ b/homeassistant/components/xiaomi_aqara/cover.py @@ -1,7 +1,7 @@ """Support for Xiaomi curtain.""" import logging -from homeassistant.components.cover import ATTR_POSITION, CoverDevice +from homeassistant.components.cover import ATTR_POSITION, CoverEntity from . import PY_XIAOMI_GATEWAY, XiaomiDevice @@ -28,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices) -class XiaomiGenericCover(XiaomiDevice, CoverDevice): +class XiaomiGenericCover(XiaomiDevice, CoverEntity): """Representation of a XiaomiGenericCover.""" def __init__(self, device, name, data_key, xiaomi_hub): diff --git a/homeassistant/components/zha/cover.py b/homeassistant/components/zha/cover.py index 571741da7c3..0feaf14b3c5 100644 --- a/homeassistant/components/zha/cover.py +++ b/homeassistant/components/zha/cover.py @@ -5,7 +5,7 @@ import logging from zigpy.zcl.foundation import Status -from homeassistant.components.cover import ATTR_POSITION, DOMAIN, CoverDevice +from homeassistant.components.cover import ATTR_POSITION, DOMAIN, CoverEntity from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -42,7 +42,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): @STRICT_MATCH(channel_names=CHANNEL_COVER) -class ZhaCover(ZhaEntity, CoverDevice): +class ZhaCover(ZhaEntity, CoverEntity): """Representation of a ZHA cover.""" def __init__(self, unique_id, zha_device, channels, **kwargs): diff --git a/homeassistant/components/zwave/cover.py b/homeassistant/components/zwave/cover.py index e6aa8028849..688ee666676 100644 --- a/homeassistant/components/zwave/cover.py +++ b/homeassistant/components/zwave/cover.py @@ -6,7 +6,7 @@ from homeassistant.components.cover import ( DOMAIN, SUPPORT_CLOSE, SUPPORT_OPEN, - CoverDevice, + CoverEntity, ) from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -56,7 +56,7 @@ def get_device(hass, values, node_config, **kwargs): return None -class ZwaveRollershutter(ZWaveDeviceEntity, CoverDevice): +class ZwaveRollershutter(ZWaveDeviceEntity, CoverEntity): """Representation of an Z-Wave cover.""" def __init__(self, hass, values, invert_buttons, invert_percent): @@ -140,7 +140,7 @@ class ZwaveRollershutter(ZWaveDeviceEntity, CoverDevice): self._network.manager.releaseButton(self._open_id) -class ZwaveGarageDoorBase(ZWaveDeviceEntity, CoverDevice): +class ZwaveGarageDoorBase(ZWaveDeviceEntity, CoverEntity): """Base class for a Zwave garage door device.""" def __init__(self, values): diff --git a/tests/components/cover/test_init.py b/tests/components/cover/test_init.py new file mode 100644 index 00000000000..df8df2c4bf1 --- /dev/null +++ b/tests/components/cover/test_init.py @@ -0,0 +1,12 @@ +"""The tests for Cover.""" +import homeassistant.components.cover as cover + + +def test_deprecated_base_class(caplog): + """Test deprecated base class.""" + + class CustomCover(cover.CoverDevice): + pass + + CustomCover() + assert "CoverDevice is deprecated, modify CustomCover" in caplog.text diff --git a/tests/testing_config/custom_components/test/cover.py b/tests/testing_config/custom_components/test/cover.py index bdaacfa4e3c..f7b0dae15ee 100644 --- a/tests/testing_config/custom_components/test/cover.py +++ b/tests/testing_config/custom_components/test/cover.py @@ -12,7 +12,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, SUPPORT_STOP_TILT, - CoverDevice, + CoverEntity, ) from tests.common import MockEntity @@ -65,7 +65,7 @@ async def async_setup_platform( async_add_entities_callback(ENTITIES) -class MockCover(MockEntity, CoverDevice): +class MockCover(MockEntity, CoverEntity): """Mock Cover class.""" @property