Rename CoverDevice to CoverEntity (#34595)

This commit is contained in:
Erik Montnemery 2020-04-25 18:07:15 +02:00 committed by GitHub
parent 6f7f5b4034
commit 8c5c963b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 139 additions and 116 deletions

View file

@ -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

View file

@ -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__(

View file

@ -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):

View file

@ -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.

View file

@ -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__(

View file

@ -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__,
)

View file

@ -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):

View file

@ -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__(

View file

@ -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

View file

@ -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

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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:

View file

@ -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):

View file

@ -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):

View file

@ -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

View file

@ -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

View file

@ -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."""

View file

@ -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):

View file

@ -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

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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__(

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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__(

View file

@ -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

View file

@ -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):

View file

@ -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

View file

@ -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

View file

@ -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__(

View file

@ -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):

View file

@ -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):

View file

@ -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

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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

View file

@ -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