mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Rename CoverDevice to CoverEntity (#34595)
This commit is contained in:
parent
6f7f5b4034
commit
8c5c963b96
@ -1,7 +1,7 @@
|
|||||||
"""Support for Abode Security System covers."""
|
"""Support for Abode Security System covers."""
|
||||||
import abodepy.helpers.constants as CONST
|
import abodepy.helpers.constants as CONST
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverDevice
|
from homeassistant.components.cover import CoverEntity
|
||||||
|
|
||||||
from . import AbodeDevice
|
from . import AbodeDevice
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -19,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class AbodeCover(AbodeDevice, CoverDevice):
|
class AbodeCover(AbodeDevice, CoverEntity):
|
||||||
"""Representation of an Abode cover."""
|
"""Representation of an Abode cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME
|
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
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."""
|
"""Representation of ADS cover."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -8,7 +8,7 @@ from homeassistant.components.cover import (
|
|||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_PASSWORD,
|
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."""
|
"""Representation of Aladdin Connect cover."""
|
||||||
|
|
||||||
def __init__(self, acc, device):
|
def __init__(self, acc, device):
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
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.
|
Representation of a Brunt cover device.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import subprocess
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice
|
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_COMMAND_CLOSE,
|
CONF_COMMAND_CLOSE,
|
||||||
CONF_COMMAND_OPEN,
|
CONF_COMMAND_OPEN,
|
||||||
@ -63,7 +63,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(covers)
|
add_entities(covers)
|
||||||
|
|
||||||
|
|
||||||
class CommandCover(CoverDevice):
|
class CommandCover(CoverEntity):
|
||||||
"""Representation a command line cover."""
|
"""Representation a command line cover."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -153,7 +153,7 @@ async def async_unload_entry(hass, entry):
|
|||||||
return await hass.data[DOMAIN].async_unload_entry(entry)
|
return await hass.data[DOMAIN].async_unload_entry(entry)
|
||||||
|
|
||||||
|
|
||||||
class CoverDevice(Entity):
|
class CoverEntity(Entity):
|
||||||
"""Representation of a cover."""
|
"""Representation of a cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -318,3 +318,14 @@ class CoverDevice(Entity):
|
|||||||
await self.async_open_cover_tilt(**kwargs)
|
await self.async_open_cover_tilt(**kwargs)
|
||||||
else:
|
else:
|
||||||
await self.async_close_cover_tilt(**kwargs)
|
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__,
|
||||||
|
)
|
||||||
|
@ -5,7 +5,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
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())
|
async_add_cover(gateway.api.lights.values())
|
||||||
|
|
||||||
|
|
||||||
class DeconzCover(DeconzDevice, CoverDevice):
|
class DeconzCover(DeconzDevice, CoverEntity):
|
||||||
"""Representation of a deCONZ cover."""
|
"""Representation of a deCONZ cover."""
|
||||||
|
|
||||||
def __init__(self, device, gateway):
|
def __init__(self, device, gateway):
|
||||||
|
@ -4,7 +4,7 @@ from homeassistant.components.cover import (
|
|||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.event import async_track_utc_time_change
|
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)
|
await async_setup_platform(hass, {}, async_add_entities)
|
||||||
|
|
||||||
|
|
||||||
class DemoCover(CoverDevice):
|
class DemoCover(CoverEntity):
|
||||||
"""Representation of a demo cover."""
|
"""Representation of a demo cover."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for the Dynalite channels as covers."""
|
"""Support for the Dynalite channels as covers."""
|
||||||
from typing import Callable
|
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.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
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."""
|
"""Representation of a Dynalite Channel as a Home Assistant Cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -14,7 +14,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
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."""
|
"""A cover implementation for ESPHome."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -5,7 +5,7 @@ from homeassistant.components.cover import (
|
|||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import FIBARO_DEVICES, FibaroDevice
|
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."""
|
"""Representation a Fibaro Cover."""
|
||||||
|
|
||||||
def __init__(self, fibaro_device):
|
def __init__(self, fibaro_device):
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice
|
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_ACCESS_TOKEN,
|
CONF_ACCESS_TOKEN,
|
||||||
CONF_COVERS,
|
CONF_COVERS,
|
||||||
@ -74,7 +74,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(covers)
|
add_entities(covers)
|
||||||
|
|
||||||
|
|
||||||
class GaradgetCover(CoverDevice):
|
class GaradgetCover(CoverEntity):
|
||||||
"""Representation of a Garadget cover."""
|
"""Representation of a Garadget cover."""
|
||||||
|
|
||||||
def __init__(self, hass, args):
|
def __init__(self, hass, args):
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
from pygogogate2 import Gogogate2API as pygogogate2
|
from pygogogate2 import Gogogate2API as pygogogate2
|
||||||
import voluptuous as vol
|
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 (
|
from homeassistant.const import (
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
CONF_NAME,
|
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."""
|
"""Representation of a Gogogate2 cover."""
|
||||||
|
|
||||||
def __init__(self, mygogogate2, device, name):
|
def __init__(self, mygogogate2, device, name):
|
||||||
|
@ -27,7 +27,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
SUPPORT_STOP_TILT,
|
SUPPORT_STOP_TILT,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ASSUMED_STATE,
|
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])])
|
async_add_entities([CoverGroup(config[CONF_NAME], config[CONF_ENTITIES])])
|
||||||
|
|
||||||
|
|
||||||
class CoverGroup(CoverDevice):
|
class CoverGroup(CoverEntity):
|
||||||
"""Representation of a CoverGroup."""
|
"""Representation of a CoverGroup."""
|
||||||
|
|
||||||
def __init__(self, name, entities):
|
def __init__(self, name, entities):
|
||||||
|
@ -13,7 +13,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING
|
from homeassistant.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING
|
||||||
from homeassistant.core import callback
|
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)
|
conn.add_listener(async_add_service)
|
||||||
|
|
||||||
|
|
||||||
class HomeKitGarageDoorCover(HomeKitEntity, CoverDevice):
|
class HomeKitGarageDoorCover(HomeKitEntity, CoverEntity):
|
||||||
"""Representation of a HomeKit Garage Door."""
|
"""Representation of a HomeKit Garage Door."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -128,7 +128,7 @@ class HomeKitGarageDoorCover(HomeKitEntity, CoverDevice):
|
|||||||
return attributes
|
return attributes
|
||||||
|
|
||||||
|
|
||||||
class HomeKitWindowCover(HomeKitEntity, CoverDevice):
|
class HomeKitWindowCover(HomeKitEntity, CoverEntity):
|
||||||
"""Representation of a HomeKit Window or Window Covering."""
|
"""Representation of a HomeKit Window or Window Covering."""
|
||||||
|
|
||||||
def get_characteristic_types(self):
|
def get_characteristic_types(self):
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .const import ATTR_DISCOVER_DEVICES
|
from .const import ATTR_DISCOVER_DEVICES
|
||||||
@ -26,7 +26,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class HMCover(HMDevice, CoverDevice):
|
class HMCover(HMDevice, CoverEntity):
|
||||||
"""Representation a HomeMatic Cover."""
|
"""Representation a HomeMatic Cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -13,7 +13,7 @@ from homematicip.base.enums import DoorCommand, DoorState
|
|||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
@ -51,7 +51,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class HomematicipCoverShutter(HomematicipGenericDevice, CoverDevice):
|
class HomematicipCoverShutter(HomematicipGenericDevice, CoverEntity):
|
||||||
"""Representation of a HomematicIP Cloud cover shutter device."""
|
"""Representation of a HomematicIP Cloud cover shutter device."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -88,7 +88,7 @@ class HomematicipCoverShutter(HomematicipGenericDevice, CoverDevice):
|
|||||||
await self._device.set_shutter_stop()
|
await self._device.set_shutter_stop()
|
||||||
|
|
||||||
|
|
||||||
class HomematicipCoverSlats(HomematicipCoverShutter, CoverDevice):
|
class HomematicipCoverSlats(HomematicipCoverShutter, CoverEntity):
|
||||||
"""Representation of a HomematicIP Cloud cover slats device."""
|
"""Representation of a HomematicIP Cloud cover slats device."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -118,7 +118,7 @@ class HomematicipCoverSlats(HomematicipCoverShutter, CoverDevice):
|
|||||||
await self._device.set_shutter_stop()
|
await self._device.set_shutter_stop()
|
||||||
|
|
||||||
|
|
||||||
class HomematicipGarageDoorModuleTormatic(HomematicipGenericDevice, CoverDevice):
|
class HomematicipGarageDoorModuleTormatic(HomematicipGenericDevice, CoverEntity):
|
||||||
"""Representation of a HomematicIP Garage Door Module for Tormatic."""
|
"""Representation of a HomematicIP Garage Door Module for Tormatic."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -150,7 +150,7 @@ class HomematicipGarageDoorModuleTormatic(HomematicipGenericDevice, CoverDevice)
|
|||||||
await self._device.send_door_command(DoorCommand.STOP)
|
await self._device.send_door_command(DoorCommand.STOP)
|
||||||
|
|
||||||
|
|
||||||
class HomematicipCoverShutterGroup(HomematicipCoverSlats, CoverDevice):
|
class HomematicipCoverShutterGroup(HomematicipCoverSlats, CoverEntity):
|
||||||
"""Representation of a HomematicIP Cloud cover shutter group."""
|
"""Representation of a HomematicIP Cloud cover shutter group."""
|
||||||
|
|
||||||
def __init__(self, hap: HomematicipHAP, device, post: str = "ShutterGroup") -> None:
|
def __init__(self, hap: HomematicipHAP, device, post: str = "ShutterGroup") -> None:
|
||||||
|
@ -7,7 +7,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .insteon_entity import InsteonEntity
|
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,
|
device.states[state_key].name,
|
||||||
)
|
)
|
||||||
|
|
||||||
new_entity = InsteonCoverDevice(device, state_key)
|
new_entity = InsteonCoverEntity(device, state_key)
|
||||||
|
|
||||||
async_add_entities([new_entity])
|
async_add_entities([new_entity])
|
||||||
|
|
||||||
|
|
||||||
class InsteonCoverDevice(InsteonEntity, CoverDevice):
|
class InsteonCoverEntity(InsteonEntity, CoverEntity):
|
||||||
"""A Class for an Insteon device."""
|
"""A Class for an Insteon device."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from homeassistant.components.cover import DOMAIN, CoverDevice
|
from homeassistant.components.cover import DOMAIN, CoverEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_CLOSED,
|
STATE_CLOSED,
|
||||||
STATE_CLOSING,
|
STATE_CLOSING,
|
||||||
@ -31,7 +31,7 @@ def setup_platform(
|
|||||||
"""Set up the ISY994 cover platform."""
|
"""Set up the ISY994 cover platform."""
|
||||||
devices = []
|
devices = []
|
||||||
for node in hass.data[ISY994_NODES][DOMAIN]:
|
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]:
|
for name, status, actions in hass.data[ISY994_PROGRAMS][DOMAIN]:
|
||||||
devices.append(ISYCoverProgram(name, status, actions))
|
devices.append(ISYCoverProgram(name, status, actions))
|
||||||
@ -39,7 +39,7 @@ def setup_platform(
|
|||||||
add_entities(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class ISYCoverDevice(ISYDevice, CoverDevice):
|
class ISYCoverEntity(ISYDevice, CoverEntity):
|
||||||
"""Representation of an ISY994 cover device."""
|
"""Representation of an ISY994 cover device."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -72,7 +72,7 @@ class ISYCoverDevice(ISYDevice, CoverDevice):
|
|||||||
_LOGGER.error("Unable to close the cover")
|
_LOGGER.error("Unable to close the cover")
|
||||||
|
|
||||||
|
|
||||||
class ISYCoverProgram(ISYCoverDevice):
|
class ISYCoverProgram(ISYCoverEntity):
|
||||||
"""Representation of an ISY994 cover program."""
|
"""Representation of an ISY994 cover program."""
|
||||||
|
|
||||||
def __init__(self, name: str, node: object, actions: object) -> None:
|
def __init__(self, name: str, node: object, actions: object) -> None:
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -94,7 +94,7 @@ def async_add_entities_config(hass, config, async_add_entities):
|
|||||||
async_add_entities([KNXCover(cover)])
|
async_add_entities([KNXCover(cover)])
|
||||||
|
|
||||||
|
|
||||||
class KNXCover(CoverDevice):
|
class KNXCover(CoverEntity):
|
||||||
"""Representation of a KNX cover."""
|
"""Representation of a KNX cover."""
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for LCN covers."""
|
"""Support for LCN covers."""
|
||||||
import pypck
|
import pypck
|
||||||
|
|
||||||
from homeassistant.components.cover import CoverDevice
|
from homeassistant.components.cover import CoverEntity
|
||||||
from homeassistant.const import CONF_ADDRESS
|
from homeassistant.const import CONF_ADDRESS
|
||||||
|
|
||||||
from . import LcnDevice
|
from . import LcnDevice
|
||||||
@ -32,7 +32,7 @@ async def async_setup_platform(
|
|||||||
async_add_entities(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class LcnOutputsCover(LcnDevice, CoverDevice):
|
class LcnOutputsCover(LcnDevice, CoverEntity):
|
||||||
"""Representation of a LCN cover connected to output ports."""
|
"""Representation of a LCN cover connected to output ports."""
|
||||||
|
|
||||||
def __init__(self, config, address_connection):
|
def __init__(self, config, address_connection):
|
||||||
@ -111,7 +111,7 @@ class LcnOutputsCover(LcnDevice, CoverDevice):
|
|||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
|
||||||
class LcnRelayCover(LcnDevice, CoverDevice):
|
class LcnRelayCover(LcnDevice, CoverEntity):
|
||||||
"""Representation of a LCN cover connected to relays."""
|
"""Representation of a LCN cover connected to relays."""
|
||||||
|
|
||||||
def __init__(self, config, address_connection):
|
def __init__(self, config, address_connection):
|
||||||
|
@ -6,7 +6,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
|
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
|
||||||
@ -25,7 +25,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class LutronCover(LutronDevice, CoverDevice):
|
class LutronCover(LutronDevice, CoverEntity):
|
||||||
"""Representation of a Lutron shade."""
|
"""Representation of a Lutron shade."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -7,7 +7,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import LUTRON_CASETA_SMARTBRIDGE, LutronCasetaDevice
|
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)
|
async_add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
class LutronCasetaCover(LutronCasetaDevice, CoverDevice):
|
class LutronCasetaCover(LutronCasetaDevice, CoverEntity):
|
||||||
"""Representation of a Lutron shade."""
|
"""Representation of a Lutron shade."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -16,7 +16,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
SUPPORT_STOP_TILT,
|
SUPPORT_STOP_TILT,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE,
|
CONF_DEVICE,
|
||||||
@ -205,7 +205,7 @@ class MqttCover(
|
|||||||
MqttAvailability,
|
MqttAvailability,
|
||||||
MqttDiscoveryUpdate,
|
MqttDiscoveryUpdate,
|
||||||
MqttEntityDeviceInfo,
|
MqttEntityDeviceInfo,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
):
|
):
|
||||||
"""Representation of a cover that can be controlled using MQTT."""
|
"""Representation of a cover that can be controlled using MQTT."""
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components.cover import (
|
|||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT
|
||||||
from homeassistant.const 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."""
|
"""Representation of a MyQ cover."""
|
||||||
|
|
||||||
def __init__(self, coordinator, device):
|
def __init__(self, coordinator, device):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Support for MySensors covers."""
|
"""Support for MySensors covers."""
|
||||||
from homeassistant.components import mysensors
|
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
|
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."""
|
"""Representation of the value of a MySensors Cover child node."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components.cover import (
|
|||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_COVERS,
|
CONF_COVERS,
|
||||||
@ -74,7 +74,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(covers, True)
|
add_entities(covers, True)
|
||||||
|
|
||||||
|
|
||||||
class OpenGarageCover(CoverDevice):
|
class OpenGarageCover(CoverEntity):
|
||||||
"""Representation of a OpenGarage cover."""
|
"""Representation of a OpenGarage cover."""
|
||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
|
@ -3,7 +3,7 @@ import logging
|
|||||||
|
|
||||||
import voluptuous as vol
|
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
|
from homeassistant.const import CONF_NAME, CONF_TYPE, STATE_OPEN
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
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))
|
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)."""
|
"""Rflink entity which can switch on/stop/off (eg: cover)."""
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import RFXtrx as rfxtrxmod
|
import RFXtrx as rfxtrxmod
|
||||||
import voluptuous as vol
|
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.const import CONF_NAME, STATE_OPEN
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
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)
|
RECEIVED_EVT_SUBSCRIBERS.append(cover_update)
|
||||||
|
|
||||||
|
|
||||||
class RfxtrxCover(RfxtrxDevice, CoverDevice, RestoreEntity):
|
class RfxtrxCover(RfxtrxDevice, CoverEntity, RestoreEntity):
|
||||||
"""Representation of a RFXtrx cover."""
|
"""Representation of a RFXtrx cover."""
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
|
@ -5,7 +5,7 @@ from time import sleep
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import rpi_gpio
|
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
|
from homeassistant.const import CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(covers)
|
add_entities(covers)
|
||||||
|
|
||||||
|
|
||||||
class RPiGPIOCover(CoverDevice):
|
class RPiGPIOCover(CoverEntity):
|
||||||
"""Representation of a Raspberry GPIO cover."""
|
"""Representation of a Raspberry GPIO cover."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -8,7 +8,7 @@ from scsgate.tasks import (
|
|||||||
)
|
)
|
||||||
import voluptuous as vol
|
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
|
from homeassistant.const import CONF_DEVICES, CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(covers)
|
add_entities(covers)
|
||||||
|
|
||||||
|
|
||||||
class SCSGateCover(CoverDevice):
|
class SCSGateCover(CoverEntity):
|
||||||
"""Representation of SCSGate cover."""
|
"""Representation of SCSGate cover."""
|
||||||
|
|
||||||
def __init__(self, scs_id, name, logger, scsgate):
|
def __init__(self, scs_id, name, logger, scsgate):
|
||||||
|
@ -8,7 +8,7 @@ from homeassistant.components.cover import (
|
|||||||
STATE_CLOSED,
|
STATE_CLOSED,
|
||||||
STATE_CLOSING,
|
STATE_CLOSING,
|
||||||
STATE_OPENING,
|
STATE_OPENING,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_ID
|
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)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class SlideCover(CoverDevice):
|
class SlideCover(CoverEntity):
|
||||||
"""Representation of a Slide cover."""
|
"""Representation of a Slide cover."""
|
||||||
|
|
||||||
def __init__(self, api, slide):
|
def __init__(self, api, slide):
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import DATA_HUB, DOMAIN
|
from . import DATA_HUB, DOMAIN
|
||||||
@ -37,7 +37,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(entities, True)
|
add_entities(entities, True)
|
||||||
|
|
||||||
|
|
||||||
class SmartHabCover(CoverDevice):
|
class SmartHabCover(CoverEntity):
|
||||||
"""Representation a cover."""
|
"""Representation a cover."""
|
||||||
|
|
||||||
def __init__(self, cover):
|
def __init__(self, cover):
|
||||||
|
@ -16,7 +16,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_BATTERY_LEVEL
|
from homeassistant.const import ATTR_BATTERY_LEVEL
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class SmartThingsCover(SmartThingsEntity, CoverDevice):
|
class SmartThingsCover(SmartThingsEntity, CoverEntity):
|
||||||
"""Define a SmartThings cover."""
|
"""Define a SmartThings cover."""
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import logging
|
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
|
from homeassistant.components.soma import API, DEVICES, DOMAIN, SomaEntity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_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."""
|
"""Representation of a Soma cover device."""
|
||||||
|
|
||||||
def close_cover(self, **kwargs):
|
def close_cover(self, **kwargs):
|
||||||
|
@ -5,7 +5,7 @@ from pymfy.api.devices.category import Category
|
|||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import API, CONF_OPTIMISTIC, DEVICES, DOMAIN, SomfyEntity
|
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)
|
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."""
|
"""Representation of a Somfy cover device."""
|
||||||
|
|
||||||
def __init__(self, device, api, optimistic):
|
def __init__(self, device, api, optimistic):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Cover Platform for the Somfy MyLink component."""
|
"""Cover Platform for the Somfy MyLink component."""
|
||||||
import logging
|
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 homeassistant.util import slugify
|
||||||
|
|
||||||
from . import CONF_DEFAULT_REVERSE, DATA_SOMFY_MYLINK
|
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)
|
async_add_entities(cover_list)
|
||||||
|
|
||||||
|
|
||||||
class SomfyShade(CoverDevice):
|
class SomfyShade(CoverEntity):
|
||||||
"""Object for controlling a Somfy cover."""
|
"""Object for controlling a Somfy cover."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -5,7 +5,7 @@ from pprint import pformat
|
|||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
DEVICE_CLASS_GARAGE,
|
DEVICE_CLASS_GARAGE,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.components.supla import SuplaChannel
|
from homeassistant.components.supla import SuplaChannel
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(entities)
|
add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class SuplaCover(SuplaChannel, CoverDevice):
|
class SuplaCover(SuplaChannel, CoverEntity):
|
||||||
"""Representation of a Supla Cover."""
|
"""Representation of a Supla Cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -67,7 +67,7 @@ class SuplaCover(SuplaChannel, CoverDevice):
|
|||||||
self.action("STOP")
|
self.action("STOP")
|
||||||
|
|
||||||
|
|
||||||
class SuplaGateDoor(SuplaChannel, CoverDevice):
|
class SuplaGateDoor(SuplaChannel, CoverEntity):
|
||||||
"""Representation of a Supla gate door."""
|
"""Representation of a Supla gate door."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components.cover import (
|
|||||||
DEVICE_CLASS_GARAGE,
|
DEVICE_CLASS_GARAGE,
|
||||||
DEVICE_CLASS_SHUTTER,
|
DEVICE_CLASS_SHUTTER,
|
||||||
DEVICE_CLASS_WINDOW,
|
DEVICE_CLASS_WINDOW,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class TahomaCover(TahomaDevice, CoverDevice):
|
class TahomaCover(TahomaDevice, CoverEntity):
|
||||||
"""Representation a Tahoma Cover."""
|
"""Representation a Tahoma Cover."""
|
||||||
|
|
||||||
def __init__(self, tahoma_device, controller):
|
def __init__(self, tahoma_device, controller):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components import cover, tellduslive
|
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 homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
from .entry import TelldusLiveEntity
|
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."""
|
"""Representation of a cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Support for Tellstick covers."""
|
"""Support for Tellstick covers."""
|
||||||
from homeassistant.components.cover import CoverDevice
|
from homeassistant.components.cover import CoverEntity
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
ATTR_DISCOVER_CONFIG,
|
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."""
|
"""Representation of a Tellstick cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -17,7 +17,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
SUPPORT_STOP_TILT,
|
SUPPORT_STOP_TILT,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
@ -161,7 +161,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
async_add_entities(covers)
|
async_add_entities(covers)
|
||||||
|
|
||||||
|
|
||||||
class CoverTemplate(CoverDevice):
|
class CoverTemplate(CoverEntity):
|
||||||
"""Representation of a Template cover."""
|
"""Representation of a Template cover."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Support for IKEA Tradfri covers."""
|
"""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 .base_class import TradfriBaseDevice
|
||||||
from .const import ATTR_MODEL, CONF_GATEWAY_ID, KEY_API, KEY_GATEWAY
|
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)
|
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."""
|
"""The platform class required by Home Assistant."""
|
||||||
|
|
||||||
def __init__(self, device, api, gateway_id):
|
def __init__(self, device, api, gateway_id):
|
||||||
|
@ -4,7 +4,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import DATA_TUYA, TuyaDevice
|
from . import DATA_TUYA, TuyaDevice
|
||||||
@ -27,7 +27,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class TuyaCover(TuyaDevice, CoverDevice):
|
class TuyaCover(TuyaDevice, CoverEntity):
|
||||||
"""Tuya cover devices."""
|
"""Tuya cover devices."""
|
||||||
|
|
||||||
def __init__(self, tuya):
|
def __init__(self, tuya):
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import VelbusEntity
|
from . import VelbusEntity
|
||||||
@ -29,7 +29,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class VelbusCover(VelbusEntity, CoverDevice):
|
class VelbusCover(VelbusEntity, CoverEntity):
|
||||||
"""Representation a Velbus cover."""
|
"""Representation a Velbus cover."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -8,7 +8,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
SUPPORT_SET_POSITION,
|
SUPPORT_SET_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
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)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class VeluxCover(CoverDevice):
|
class VeluxCover(CoverEntity):
|
||||||
"""Representation of a Velux cover."""
|
"""Representation of a Velux cover."""
|
||||||
|
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
|
@ -6,7 +6,7 @@ from homeassistant.components.cover import (
|
|||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
DOMAIN as PLATFORM_DOMAIN,
|
DOMAIN as PLATFORM_DOMAIN,
|
||||||
ENTITY_ID_FORMAT,
|
ENTITY_ID_FORMAT,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
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."""
|
"""Representation a Vera Cover."""
|
||||||
|
|
||||||
def __init__(self, vera_device, controller):
|
def __init__(self, vera_device, controller):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for Wink covers."""
|
"""Support for Wink covers."""
|
||||||
import pywink
|
import pywink
|
||||||
|
|
||||||
from homeassistant.components.cover import ATTR_POSITION, CoverDevice
|
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
|
||||||
|
|
||||||
from . import DOMAIN, WinkDevice
|
from . import DOMAIN, WinkDevice
|
||||||
|
|
||||||
@ -12,18 +12,18 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
for shade in pywink.get_shades():
|
for shade in pywink.get_shades():
|
||||||
_id = shade.object_id() + shade.name()
|
_id = shade.object_id() + shade.name()
|
||||||
if _id not in hass.data[DOMAIN]["unique_ids"]:
|
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():
|
for shade in pywink.get_shade_groups():
|
||||||
_id = shade.object_id() + shade.name()
|
_id = shade.object_id() + shade.name()
|
||||||
if _id not in hass.data[DOMAIN]["unique_ids"]:
|
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():
|
for door in pywink.get_garage_doors():
|
||||||
_id = door.object_id() + door.name()
|
_id = door.object_id() + door.name()
|
||||||
if _id not in hass.data[DOMAIN]["unique_ids"]:
|
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."""
|
"""Representation of a Wink cover device."""
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for Xiaomi curtain."""
|
"""Support for Xiaomi curtain."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.cover import ATTR_POSITION, CoverDevice
|
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
|
||||||
|
|
||||||
from . import PY_XIAOMI_GATEWAY, XiaomiDevice
|
from . import PY_XIAOMI_GATEWAY, XiaomiDevice
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
add_entities(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class XiaomiGenericCover(XiaomiDevice, CoverDevice):
|
class XiaomiGenericCover(XiaomiDevice, CoverEntity):
|
||||||
"""Representation of a XiaomiGenericCover."""
|
"""Representation of a XiaomiGenericCover."""
|
||||||
|
|
||||||
def __init__(self, device, name, data_key, xiaomi_hub):
|
def __init__(self, device, name, data_key, xiaomi_hub):
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
|
|
||||||
from zigpy.zcl.foundation import Status
|
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.const import STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
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)
|
@STRICT_MATCH(channel_names=CHANNEL_COVER)
|
||||||
class ZhaCover(ZhaEntity, CoverDevice):
|
class ZhaCover(ZhaEntity, CoverEntity):
|
||||||
"""Representation of a ZHA cover."""
|
"""Representation of a ZHA cover."""
|
||||||
|
|
||||||
def __init__(self, unique_id, zha_device, channels, **kwargs):
|
def __init__(self, unique_id, zha_device, channels, **kwargs):
|
||||||
|
@ -6,7 +6,7 @@ from homeassistant.components.cover import (
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
SUPPORT_OPEN,
|
SUPPORT_OPEN,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
@ -56,7 +56,7 @@ def get_device(hass, values, node_config, **kwargs):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class ZwaveRollershutter(ZWaveDeviceEntity, CoverDevice):
|
class ZwaveRollershutter(ZWaveDeviceEntity, CoverEntity):
|
||||||
"""Representation of an Z-Wave cover."""
|
"""Representation of an Z-Wave cover."""
|
||||||
|
|
||||||
def __init__(self, hass, values, invert_buttons, invert_percent):
|
def __init__(self, hass, values, invert_buttons, invert_percent):
|
||||||
@ -140,7 +140,7 @@ class ZwaveRollershutter(ZWaveDeviceEntity, CoverDevice):
|
|||||||
self._network.manager.releaseButton(self._open_id)
|
self._network.manager.releaseButton(self._open_id)
|
||||||
|
|
||||||
|
|
||||||
class ZwaveGarageDoorBase(ZWaveDeviceEntity, CoverDevice):
|
class ZwaveGarageDoorBase(ZWaveDeviceEntity, CoverEntity):
|
||||||
"""Base class for a Zwave garage door device."""
|
"""Base class for a Zwave garage door device."""
|
||||||
|
|
||||||
def __init__(self, values):
|
def __init__(self, values):
|
||||||
|
12
tests/components/cover/test_init.py
Normal file
12
tests/components/cover/test_init.py
Normal 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
|
@ -12,7 +12,7 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_SET_TILT_POSITION,
|
SUPPORT_SET_TILT_POSITION,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
SUPPORT_STOP_TILT,
|
SUPPORT_STOP_TILT,
|
||||||
CoverDevice,
|
CoverEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
from tests.common import MockEntity
|
from tests.common import MockEntity
|
||||||
@ -65,7 +65,7 @@ async def async_setup_platform(
|
|||||||
async_add_entities_callback(ENTITIES)
|
async_add_entities_callback(ENTITIES)
|
||||||
|
|
||||||
|
|
||||||
class MockCover(MockEntity, CoverDevice):
|
class MockCover(MockEntity, CoverEntity):
|
||||||
"""Mock Cover class."""
|
"""Mock Cover class."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user