Skip to content

Commit

Permalink
Add alias to DOMAIN import in deconz (#125568)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Sep 9, 2024
1 parent c545383 commit e0a221b
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 46 deletions.
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)

from homeassistant.components.alarm_control_panel import (
DOMAIN,
DOMAIN as ALARM_CONTROl_PANEL_DOMAIN,
AlarmControlPanelEntity,
AlarmControlPanelEntityFeature,
CodeFormat,
Expand Down Expand Up @@ -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:
Expand All @@ -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 = (
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from pydeconz.models.sensor.water import Water

from homeassistant.components.binary_sensor import (
DOMAIN,
DOMAIN as BINARY_SENSOR_DOMAIN,
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
Expand Down Expand Up @@ -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:
Expand All @@ -189,7 +189,7 @@ def async_add_sensor(_: EventType, sensor_id: str) -> None:
class DeconzBinarySensor(DeconzDevice[SensorResources], BinarySensorEntity):
"""Representation of a deCONZ binary sensor."""

TYPE = DOMAIN
TYPE = BINARY_SENSOR_DOMAIN
entity_description: DeconzBinarySensorDescription

def __init__(
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/deconz/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pydeconz.models.sensor.presence import Presence

from homeassistant.components.button import (
DOMAIN,
DOMAIN as BUTTON_DOMAIN,
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -83,7 +83,7 @@ def async_add_presence_sensor(_: EventType, sensor_id: str) -> None:
class DeconzSceneButton(DeconzSceneMixin, ButtonEntity):
"""Representation of a deCONZ button entity."""

TYPE = DOMAIN
TYPE = BUTTON_DOMAIN

def __init__(
self,
Expand Down Expand Up @@ -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."""
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)

from homeassistant.components.climate import (
DOMAIN,
DOMAIN as CLIMATE_DOMAIN,
FAN_AUTO,
FAN_HIGH,
FAN_LOW,
Expand Down Expand Up @@ -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:
Expand All @@ -98,7 +98,7 @@ def async_add_climate(_: EventType, climate_id: str) -> None:
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
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
DOMAIN,
DOMAIN as COVER_DOMAIN,
CoverDeviceClass,
CoverEntity,
CoverEntityFeature,
Expand All @@ -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:
Expand All @@ -54,7 +54,7 @@ def async_add_cover(_: EventType, cover_id: str) -> None:
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."""
Expand Down
10 changes: 7 additions & 3 deletions homeassistant/components/deconz/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
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
Expand All @@ -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:
Expand All @@ -53,7 +57,7 @@ def async_add_fan(_: EventType, fan_id: str) -> None:
class DeconzFan(DeconzDevice[Light], FanEntity):
"""Representation of a deCONZ fan."""

TYPE = DOMAIN
TYPE = FAN_DOMAIN
_default_on_speed = LightFanSpeed.PERCENT_50

_attr_supported_features = (
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ATTR_HS_COLOR,
ATTR_TRANSITION,
ATTR_XY_COLOR,
DOMAIN,
DOMAIN as LIGHT_DOMAIN,
EFFECT_COLORLOOP,
FLASH_LONG,
FLASH_SHORT,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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
Expand All @@ -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:
Expand Down Expand Up @@ -53,7 +53,7 @@ def async_add_lock_from_sensor(_: EventType, lock_id: str) -> None:
class DeconzLock(DeconzDevice[DoorLock | Lock], LockEntity):
"""Representation of a deCONZ lock."""

TYPE = DOMAIN
TYPE = LOCK_DOMAIN

@property
def is_locked(self) -> bool:
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pydeconz.models.sensor.presence import Presence

from homeassistant.components.number import (
DOMAIN,
DOMAIN as NUMBER_DOMAIN,
NumberEntity,
NumberEntityDescription,
)
Expand Down Expand Up @@ -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:
Expand All @@ -99,7 +99,7 @@ def async_add_sensor(_: EventType, sensor_id: str) -> None:
class DeconzNumber(DeconzDevice[SensorResources], NumberEntity):
"""Representation of a deCONZ number entity."""

TYPE = DOMAIN
TYPE = NUMBER_DOMAIN
entity_description: DeconzNumberDescription

def __init__(
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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
Expand All @@ -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:
Expand All @@ -39,7 +39,7 @@ def async_add_scene(_: EventType, scene_id: str) -> None:
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."""
Expand Down
12 changes: 6 additions & 6 deletions homeassistant/components/deconz/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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
Expand All @@ -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:
Expand Down Expand Up @@ -85,7 +85,7 @@ class DeconzAirPurifierFanMode(DeconzDevice[AirPurifier], SelectEntity):
AirPurifierFanMode.SPEED_5.value,
]

TYPE = DOMAIN
TYPE = SELECT_DOMAIN

@property
def current_option(self) -> str:
Expand Down Expand Up @@ -113,7 +113,7 @@ class DeconzPresenceDeviceModeSelect(DeconzDevice[Presence], SelectEntity):
PresenceConfigDeviceMode.UNDIRECTED.value,
]

TYPE = DOMAIN
TYPE = SELECT_DOMAIN

@property
def current_option(self) -> str | None:
Expand All @@ -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:
Expand Down Expand Up @@ -171,7 +171,7 @@ class DeconzPresenceTriggerDistanceSelect(DeconzDevice[Presence], SelectEntity):
PresenceConfigTriggerDistance.NEAR.value,
]

TYPE = DOMAIN
TYPE = SELECT_DOMAIN

@property
def current_option(self) -> str | None:
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from pydeconz.models.sensor.time import Time

from homeassistant.components.sensor import (
DOMAIN,
DOMAIN as SENSOR_DOMAIN,
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -393,7 +393,7 @@ def async_add_sensor(_: EventType, sensor_id: str) -> None:
class DeconzSensor(DeconzDevice[SensorResources], SensorEntity):
"""Representation of a deCONZ sensor."""

TYPE = DOMAIN
TYPE = SENSOR_DOMAIN
entity_description: DeconzSensorDescription

def __init__(
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/deconz/siren.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from homeassistant.components.siren import (
ATTR_DURATION,
DOMAIN,
DOMAIN as SIREN_DOMAIN,
SirenEntity,
SirenEntityFeature,
)
Expand All @@ -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:
Expand All @@ -45,7 +45,7 @@ def async_add_siren(_: EventType, siren_id: str) -> None:
class DeconzSiren(DeconzDevice[Siren], SirenEntity):
"""Representation of a deCONZ siren."""

TYPE = DOMAIN
TYPE = SIREN_DOMAIN
_attr_supported_features = (
SirenEntityFeature.TURN_ON
| SirenEntityFeature.TURN_OFF
Expand Down
Loading

0 comments on commit e0a221b

Please sign in to comment.