mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Add alias to DOMAIN import in deconz (#125568)
This commit is contained in:
parent
c5453835c2
commit
e0a221ba1f
@ -10,7 +10,7 @@ from pydeconz.models.sensor.ancillary_control import (
|
||||
)
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN,
|
||||
DOMAIN as ALARM_CONTROl_PANEL_DOMAIN,
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
CodeFormat,
|
||||
@ -60,7 +60,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ alarm control panel devices."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[ALARM_CONTROl_PANEL_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_sensor(_: EventType, sensor_id: str) -> None:
|
||||
@ -79,7 +79,7 @@ class DeconzAlarmControlPanel(DeconzDevice[AncillaryControl], AlarmControlPanelE
|
||||
"""Representation of a deCONZ alarm control panel."""
|
||||
|
||||
_update_key = "panel"
|
||||
TYPE = DOMAIN
|
||||
TYPE = ALARM_CONTROl_PANEL_DOMAIN
|
||||
|
||||
_attr_code_format = CodeFormat.NUMBER
|
||||
_attr_supported_features = (
|
||||
|
@ -18,7 +18,7 @@ from pydeconz.models.sensor.vibration import Vibration
|
||||
from pydeconz.models.sensor.water import Water
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DOMAIN,
|
||||
DOMAIN as BINARY_SENSOR_DOMAIN,
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
BinarySensorEntityDescription,
|
||||
@ -165,7 +165,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ binary sensor."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[BINARY_SENSOR_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_sensor(_: EventType, sensor_id: str) -> None:
|
||||
@ -189,7 +189,7 @@ async def async_setup_entry(
|
||||
class DeconzBinarySensor(DeconzDevice[SensorResources], BinarySensorEntity):
|
||||
"""Representation of a deCONZ binary sensor."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = BINARY_SENSOR_DOMAIN
|
||||
entity_description: DeconzBinarySensorDescription
|
||||
|
||||
def __init__(
|
||||
|
@ -9,7 +9,7 @@ from pydeconz.models.scene import Scene as PydeconzScene
|
||||
from pydeconz.models.sensor.presence import Presence
|
||||
|
||||
from homeassistant.components.button import (
|
||||
DOMAIN,
|
||||
DOMAIN as BUTTON_DOMAIN,
|
||||
ButtonDeviceClass,
|
||||
ButtonEntity,
|
||||
ButtonEntityDescription,
|
||||
@ -51,7 +51,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ button entity."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[BUTTON_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_scene(_: EventType, scene_id: str) -> None:
|
||||
@ -83,7 +83,7 @@ async def async_setup_entry(
|
||||
class DeconzSceneButton(DeconzSceneMixin, ButtonEntity):
|
||||
"""Representation of a deCONZ button entity."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = BUTTON_DOMAIN
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -119,7 +119,7 @@ class DeconzPresenceResetButton(DeconzDevice[Presence], ButtonEntity):
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_device_class = ButtonDeviceClass.RESTART
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = BUTTON_DOMAIN
|
||||
|
||||
async def async_press(self) -> None:
|
||||
"""Store reset presence state."""
|
||||
|
@ -13,7 +13,7 @@ from pydeconz.models.sensor.thermostat import (
|
||||
)
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
DOMAIN,
|
||||
DOMAIN as CLIMATE_DOMAIN,
|
||||
FAN_AUTO,
|
||||
FAN_HIGH,
|
||||
FAN_LOW,
|
||||
@ -81,7 +81,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ climate devices."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[CLIMATE_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_climate(_: EventType, climate_id: str) -> None:
|
||||
@ -98,7 +98,7 @@ async def async_setup_entry(
|
||||
class DeconzThermostat(DeconzDevice[Thermostat], ClimateEntity):
|
||||
"""Representation of a deCONZ thermostat."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = CLIMATE_DOMAIN
|
||||
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
_enable_turn_on_off_backwards_compatibility = False
|
||||
|
@ -12,7 +12,7 @@ from pydeconz.models.light.cover import Cover
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
DOMAIN,
|
||||
DOMAIN as COVER_DOMAIN,
|
||||
CoverDeviceClass,
|
||||
CoverEntity,
|
||||
CoverEntityFeature,
|
||||
@ -38,7 +38,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up covers for deCONZ component."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[COVER_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_cover(_: EventType, cover_id: str) -> None:
|
||||
@ -54,7 +54,7 @@ async def async_setup_entry(
|
||||
class DeconzCover(DeconzDevice[Cover], CoverEntity):
|
||||
"""Representation of a deCONZ cover."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = COVER_DOMAIN
|
||||
|
||||
def __init__(self, cover_id: str, hub: DeconzHub) -> None:
|
||||
"""Set up cover device."""
|
||||
|
@ -7,7 +7,11 @@ from typing import Any
|
||||
from pydeconz.models.event import EventType
|
||||
from pydeconz.models.light.light import Light, LightFanSpeed
|
||||
|
||||
from homeassistant.components.fan import DOMAIN, FanEntity, FanEntityFeature
|
||||
from homeassistant.components.fan import (
|
||||
DOMAIN as FAN_DOMAIN,
|
||||
FanEntity,
|
||||
FanEntityFeature,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -34,7 +38,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up fans for deCONZ component."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[FAN_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_fan(_: EventType, fan_id: str) -> None:
|
||||
@ -53,7 +57,7 @@ async def async_setup_entry(
|
||||
class DeconzFan(DeconzDevice[Light], FanEntity):
|
||||
"""Representation of a deCONZ fan."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = FAN_DOMAIN
|
||||
_default_on_speed = LightFanSpeed.PERCENT_50
|
||||
|
||||
_attr_supported_features = (
|
||||
|
@ -18,7 +18,7 @@ from homeassistant.components.light import (
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_TRANSITION,
|
||||
ATTR_XY_COLOR,
|
||||
DOMAIN,
|
||||
DOMAIN as LIGHT_DOMAIN,
|
||||
EFFECT_COLORLOOP,
|
||||
FLASH_LONG,
|
||||
FLASH_SHORT,
|
||||
@ -125,7 +125,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ lights and groups from a config entry."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[LIGHT_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_light(_: EventType, light_id: str) -> None:
|
||||
@ -170,7 +170,7 @@ class DeconzBaseLight[_LightDeviceT: Group | Light](
|
||||
):
|
||||
"""Representation of a deCONZ light."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = LIGHT_DOMAIN
|
||||
_attr_color_mode = ColorMode.UNKNOWN
|
||||
|
||||
def __init__(self, device: _LightDeviceT, hub: DeconzHub) -> None:
|
||||
|
@ -8,7 +8,7 @@ from pydeconz.models.event import EventType
|
||||
from pydeconz.models.light.lock import Lock
|
||||
from pydeconz.models.sensor.door_lock import DoorLock
|
||||
|
||||
from homeassistant.components.lock import DOMAIN, LockEntity
|
||||
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN, LockEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -24,7 +24,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up locks for deCONZ component."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[LOCK_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_lock_from_light(_: EventType, lock_id: str) -> None:
|
||||
@ -53,7 +53,7 @@ async def async_setup_entry(
|
||||
class DeconzLock(DeconzDevice[DoorLock | Lock], LockEntity):
|
||||
"""Representation of a deCONZ lock."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = LOCK_DOMAIN
|
||||
|
||||
@property
|
||||
def is_locked(self) -> bool:
|
||||
|
@ -13,7 +13,7 @@ from pydeconz.models.sensor import SensorBase as PydeconzSensorBase
|
||||
from pydeconz.models.sensor.presence import Presence
|
||||
|
||||
from homeassistant.components.number import (
|
||||
DOMAIN,
|
||||
DOMAIN as NUMBER_DOMAIN,
|
||||
NumberEntity,
|
||||
NumberEntityDescription,
|
||||
)
|
||||
@ -74,7 +74,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ number entity."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[NUMBER_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_sensor(_: EventType, sensor_id: str) -> None:
|
||||
@ -99,7 +99,7 @@ async def async_setup_entry(
|
||||
class DeconzNumber(DeconzDevice[SensorResources], NumberEntity):
|
||||
"""Representation of a deCONZ number entity."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = NUMBER_DOMAIN
|
||||
entity_description: DeconzNumberDescription
|
||||
|
||||
def __init__(
|
||||
|
@ -6,7 +6,7 @@ from typing import Any
|
||||
|
||||
from pydeconz.models.event import EventType
|
||||
|
||||
from homeassistant.components.scene import DOMAIN, Scene
|
||||
from homeassistant.components.scene import DOMAIN as SCENE_DOMAIN, Scene
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -22,7 +22,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up scenes for deCONZ integration."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[SCENE_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_scene(_: EventType, scene_id: str) -> None:
|
||||
@ -39,7 +39,7 @@ async def async_setup_entry(
|
||||
class DeconzScene(DeconzSceneMixin, Scene):
|
||||
"""Representation of a deCONZ scene."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SCENE_DOMAIN
|
||||
|
||||
async def async_activate(self, **kwargs: Any) -> None:
|
||||
"""Activate the scene."""
|
||||
|
@ -11,7 +11,7 @@ from pydeconz.models.sensor.presence import (
|
||||
PresenceConfigTriggerDistance,
|
||||
)
|
||||
|
||||
from homeassistant.components.select import DOMAIN, SelectEntity
|
||||
from homeassistant.components.select import DOMAIN as SELECT_DOMAIN, SelectEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@ -35,7 +35,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ button entity."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[SELECT_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_air_purifier_sensor(_: EventType, sensor_id: str) -> None:
|
||||
@ -85,7 +85,7 @@ class DeconzAirPurifierFanMode(DeconzDevice[AirPurifier], SelectEntity):
|
||||
AirPurifierFanMode.SPEED_5.value,
|
||||
]
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SELECT_DOMAIN
|
||||
|
||||
@property
|
||||
def current_option(self) -> str:
|
||||
@ -113,7 +113,7 @@ class DeconzPresenceDeviceModeSelect(DeconzDevice[Presence], SelectEntity):
|
||||
PresenceConfigDeviceMode.UNDIRECTED.value,
|
||||
]
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SELECT_DOMAIN
|
||||
|
||||
@property
|
||||
def current_option(self) -> str | None:
|
||||
@ -140,7 +140,7 @@ class DeconzPresenceSensitivitySelect(DeconzDevice[Presence], SelectEntity):
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_options = list(SENSITIVITY_TO_DECONZ)
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SELECT_DOMAIN
|
||||
|
||||
@property
|
||||
def current_option(self) -> str | None:
|
||||
@ -171,7 +171,7 @@ class DeconzPresenceTriggerDistanceSelect(DeconzDevice[Presence], SelectEntity):
|
||||
PresenceConfigTriggerDistance.NEAR.value,
|
||||
]
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SELECT_DOMAIN
|
||||
|
||||
@property
|
||||
def current_option(self) -> str | None:
|
||||
|
@ -28,7 +28,7 @@ from pydeconz.models.sensor.temperature import Temperature
|
||||
from pydeconz.models.sensor.time import Time
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
DOMAIN,
|
||||
DOMAIN as SENSOR_DOMAIN,
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
@ -336,7 +336,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the deCONZ sensors."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[SENSOR_DOMAIN] = set()
|
||||
|
||||
known_device_entities: dict[str, set[str]] = {
|
||||
description.key: set()
|
||||
@ -393,7 +393,7 @@ async def async_setup_entry(
|
||||
class DeconzSensor(DeconzDevice[SensorResources], SensorEntity):
|
||||
"""Representation of a deCONZ sensor."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SENSOR_DOMAIN
|
||||
entity_description: DeconzSensorDescription
|
||||
|
||||
def __init__(
|
||||
|
@ -9,7 +9,7 @@ from pydeconz.models.light.siren import Siren
|
||||
|
||||
from homeassistant.components.siren import (
|
||||
ATTR_DURATION,
|
||||
DOMAIN,
|
||||
DOMAIN as SIREN_DOMAIN,
|
||||
SirenEntity,
|
||||
SirenEntityFeature,
|
||||
)
|
||||
@ -28,7 +28,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up sirens for deCONZ component."""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[SIREN_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_siren(_: EventType, siren_id: str) -> None:
|
||||
@ -45,7 +45,7 @@ async def async_setup_entry(
|
||||
class DeconzSiren(DeconzDevice[Siren], SirenEntity):
|
||||
"""Representation of a deCONZ siren."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SIREN_DOMAIN
|
||||
_attr_supported_features = (
|
||||
SirenEntityFeature.TURN_ON
|
||||
| SirenEntityFeature.TURN_OFF
|
||||
|
@ -7,7 +7,7 @@ from typing import Any
|
||||
from pydeconz.models.event import EventType
|
||||
from pydeconz.models.light.light import Light
|
||||
|
||||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN, SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
@ -27,7 +27,7 @@ async def async_setup_entry(
|
||||
Switches are based on the same device class as lights in deCONZ.
|
||||
"""
|
||||
hub = DeconzHub.get_hub(hass, config_entry)
|
||||
hub.entities[DOMAIN] = set()
|
||||
hub.entities[SWITCH_DOMAIN] = set()
|
||||
|
||||
@callback
|
||||
def async_add_switch(_: EventType, switch_id: str) -> None:
|
||||
@ -46,7 +46,7 @@ async def async_setup_entry(
|
||||
class DeconzPowerPlug(DeconzDevice[Light], SwitchEntity):
|
||||
"""Representation of a deCONZ power plug."""
|
||||
|
||||
TYPE = DOMAIN
|
||||
TYPE = SWITCH_DOMAIN
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
Loading…
x
Reference in New Issue
Block a user