mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Move and rename envisalink base entity to separate module (#126054)
This commit is contained in:
parent
5a769fb51b
commit
21b92455af
@ -17,7 +17,6 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.discovery import async_load_platform
|
from homeassistant.helpers.discovery import async_load_platform
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -244,20 +243,3 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class EnvisalinkDevice(Entity):
|
|
||||||
"""Representation of an Envisalink device."""
|
|
||||||
|
|
||||||
_attr_should_poll = False
|
|
||||||
|
|
||||||
def __init__(self, name, info, controller):
|
|
||||||
"""Initialize the device."""
|
|
||||||
self._controller = controller
|
|
||||||
self._info = info
|
|
||||||
self._name = name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the device."""
|
|
||||||
return self._name
|
|
||||||
|
@ -37,8 +37,8 @@ from . import (
|
|||||||
PARTITION_SCHEMA,
|
PARTITION_SCHEMA,
|
||||||
SIGNAL_KEYPAD_UPDATE,
|
SIGNAL_KEYPAD_UPDATE,
|
||||||
SIGNAL_PARTITION_UPDATE,
|
SIGNAL_PARTITION_UPDATE,
|
||||||
EnvisalinkDevice,
|
|
||||||
)
|
)
|
||||||
|
from .entity import EnvisalinkEntity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ async def async_setup_platform(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
|
class EnvisalinkAlarm(EnvisalinkEntity, AlarmControlPanelEntity):
|
||||||
"""Representation of an Envisalink-based alarm panel."""
|
"""Representation of an Envisalink-based alarm panel."""
|
||||||
|
|
||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
|
@ -13,14 +13,8 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from . import (
|
from . import CONF_ZONENAME, CONF_ZONETYPE, DATA_EVL, SIGNAL_ZONE_UPDATE, ZONE_SCHEMA
|
||||||
CONF_ZONENAME,
|
from .entity import EnvisalinkEntity
|
||||||
CONF_ZONETYPE,
|
|
||||||
DATA_EVL,
|
|
||||||
SIGNAL_ZONE_UPDATE,
|
|
||||||
ZONE_SCHEMA,
|
|
||||||
EnvisalinkDevice,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -52,7 +46,7 @@ async def async_setup_platform(
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorEntity):
|
class EnvisalinkBinarySensor(EnvisalinkEntity, BinarySensorEntity):
|
||||||
"""Representation of an Envisalink binary sensor."""
|
"""Representation of an Envisalink binary sensor."""
|
||||||
|
|
||||||
def __init__(self, hass, zone_number, zone_name, zone_type, info, controller):
|
def __init__(self, hass, zone_number, zone_name, zone_type, info, controller):
|
||||||
|
20
homeassistant/components/envisalink/entity.py
Normal file
20
homeassistant/components/envisalink/entity.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
"""Support for Envisalink devices."""
|
||||||
|
|
||||||
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
|
|
||||||
|
class EnvisalinkEntity(Entity):
|
||||||
|
"""Representation of an Envisalink device."""
|
||||||
|
|
||||||
|
_attr_should_poll = False
|
||||||
|
|
||||||
|
def __init__(self, name, info, controller):
|
||||||
|
"""Initialize the device."""
|
||||||
|
self._controller = controller
|
||||||
|
self._info = info
|
||||||
|
self._name = name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
"""Return the name of the device."""
|
||||||
|
return self._name
|
@ -16,8 +16,8 @@ from . import (
|
|||||||
PARTITION_SCHEMA,
|
PARTITION_SCHEMA,
|
||||||
SIGNAL_KEYPAD_UPDATE,
|
SIGNAL_KEYPAD_UPDATE,
|
||||||
SIGNAL_PARTITION_UPDATE,
|
SIGNAL_PARTITION_UPDATE,
|
||||||
EnvisalinkDevice,
|
|
||||||
)
|
)
|
||||||
|
from .entity import EnvisalinkEntity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ async def async_setup_platform(
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class EnvisalinkSensor(EnvisalinkDevice, SensorEntity):
|
class EnvisalinkSensor(EnvisalinkEntity, SensorEntity):
|
||||||
"""Representation of an Envisalink keypad."""
|
"""Representation of an Envisalink keypad."""
|
||||||
|
|
||||||
def __init__(self, hass, partition_name, partition_number, info, controller):
|
def __init__(self, hass, partition_name, partition_number, info, controller):
|
||||||
|
@ -11,13 +11,8 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
|||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import (
|
from . import CONF_ZONENAME, DATA_EVL, SIGNAL_ZONE_BYPASS_UPDATE, ZONE_SCHEMA
|
||||||
CONF_ZONENAME,
|
from .entity import EnvisalinkEntity
|
||||||
DATA_EVL,
|
|
||||||
SIGNAL_ZONE_BYPASS_UPDATE,
|
|
||||||
ZONE_SCHEMA,
|
|
||||||
EnvisalinkDevice,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -51,7 +46,7 @@ async def async_setup_platform(
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class EnvisalinkSwitch(EnvisalinkDevice, SwitchEntity):
|
class EnvisalinkSwitch(EnvisalinkEntity, SwitchEntity):
|
||||||
"""Representation of an Envisalink switch."""
|
"""Representation of an Envisalink switch."""
|
||||||
|
|
||||||
def __init__(self, hass, zone_number, zone_name, info, controller):
|
def __init__(self, hass, zone_number, zone_name, info, controller):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user