mirror of
https://github.com/home-assistant/core.git
synced 2025-06-25 01:21:51 +02:00
Drop alias from local const DOMAIN import (#144312)
This commit is contained in:
@ -8,7 +8,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import AdvantageAirDataConfigEntry
|
||||
from .const import ADVANTAGE_AIR_STATE_ON, DOMAIN as ADVANTAGE_AIR_DOMAIN
|
||||
from .const import ADVANTAGE_AIR_STATE_ON, DOMAIN
|
||||
from .entity import AdvantageAirEntity, AdvantageAirThingEntity
|
||||
from .models import AdvantageAirData
|
||||
|
||||
@ -52,8 +52,8 @@ class AdvantageAirLight(AdvantageAirEntity, LightEntity):
|
||||
self._id: str = light["id"]
|
||||
self._attr_unique_id += f"-{self._id}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(ADVANTAGE_AIR_DOMAIN, self._attr_unique_id)},
|
||||
via_device=(ADVANTAGE_AIR_DOMAIN, self.coordinator.data["system"]["rid"]),
|
||||
identifiers={(DOMAIN, self._attr_unique_id)},
|
||||
via_device=(DOMAIN, self.coordinator.data["system"]["rid"]),
|
||||
manufacturer="Advantage Air",
|
||||
model=light.get("moduleType"),
|
||||
name=light["name"],
|
||||
|
@ -6,7 +6,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import AdvantageAirDataConfigEntry
|
||||
from .const import DOMAIN as ADVANTAGE_AIR_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import AdvantageAirEntity
|
||||
from .models import AdvantageAirData
|
||||
|
||||
@ -32,9 +32,7 @@ class AdvantageAirApp(AdvantageAirEntity, UpdateEntity):
|
||||
"""Initialize the Advantage Air App."""
|
||||
super().__init__(instance)
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={
|
||||
(ADVANTAGE_AIR_DOMAIN, self.coordinator.data["system"]["rid"])
|
||||
},
|
||||
identifiers={(DOMAIN, self.coordinator.data["system"]["rid"])},
|
||||
manufacturer="Advantage Air",
|
||||
model=self.coordinator.data["system"]["sysType"],
|
||||
name=self.coordinator.data["system"]["name"],
|
||||
|
@ -10,7 +10,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import DOMAIN as AGENT_DOMAIN, SERVER_URL
|
||||
from .const import DOMAIN, SERVER_URL
|
||||
|
||||
ATTRIBUTION = "ispyconnect.com"
|
||||
DEFAULT_BRAND = "Agent DVR by ispyconnect.com"
|
||||
@ -46,7 +46,7 @@ async def async_setup_entry(
|
||||
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=config_entry.entry_id,
|
||||
identifiers={(AGENT_DOMAIN, agent_client.unique)},
|
||||
identifiers={(DOMAIN, agent_client.unique)},
|
||||
manufacturer="iSpyConnect",
|
||||
name=f"Agent {agent_client.name}",
|
||||
model="Agent DVR",
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import AgentDVRConfigEntry
|
||||
from .const import DOMAIN as AGENT_DOMAIN
|
||||
from .const import DOMAIN
|
||||
|
||||
CONF_HOME_MODE_NAME = "home"
|
||||
CONF_AWAY_MODE_NAME = "away"
|
||||
@ -47,7 +47,7 @@ class AgentBaseStation(AlarmControlPanelEntity):
|
||||
self._client = client
|
||||
self._attr_unique_id = f"{client.unique}_CP"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(AGENT_DOMAIN, client.unique)},
|
||||
identifiers={(DOMAIN, client.unique)},
|
||||
name=f"{client.name} {CONST_ALARM_CONTROL_PANEL_NAME}",
|
||||
manufacturer="Agent",
|
||||
model=CONST_ALARM_CONTROL_PANEL_NAME,
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||
|
||||
from .const import DOMAIN as AXIS_DOMAIN
|
||||
from .const import DOMAIN
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .hub import AxisHub
|
||||
@ -61,7 +61,7 @@ class AxisEntity(Entity):
|
||||
self.hub = hub
|
||||
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(AXIS_DOMAIN, hub.unique_id)},
|
||||
identifiers={(DOMAIN, hub.unique_id)},
|
||||
serial_number=hub.unique_id,
|
||||
)
|
||||
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE, DeviceInfo
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN as DECONZ_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .hub import DeconzHub
|
||||
from .util import serial_from_unique_id
|
||||
|
||||
@ -59,12 +59,12 @@ class DeconzBase[_DeviceT: _DeviceType]:
|
||||
|
||||
return DeviceInfo(
|
||||
connections={(CONNECTION_ZIGBEE, self.serial)},
|
||||
identifiers={(DECONZ_DOMAIN, self.serial)},
|
||||
identifiers={(DOMAIN, self.serial)},
|
||||
manufacturer=self._device.manufacturer,
|
||||
model=self._device.model_id,
|
||||
name=self._device.name,
|
||||
sw_version=self._device.software_version,
|
||||
via_device=(DECONZ_DOMAIN, self.hub.api.config.bridge_id),
|
||||
via_device=(DOMAIN, self.hub.api.config.bridge_id),
|
||||
)
|
||||
|
||||
|
||||
@ -176,9 +176,9 @@ class DeconzSceneMixin(DeconzDevice[PydeconzScene]):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a device description for device registry."""
|
||||
return DeviceInfo(
|
||||
identifiers={(DECONZ_DOMAIN, self._group_identifier)},
|
||||
identifiers={(DOMAIN, self._group_identifier)},
|
||||
manufacturer="Dresden Elektronik",
|
||||
model="deCONZ group",
|
||||
name=self.group.name,
|
||||
via_device=(DECONZ_DOMAIN, self.hub.api.config.bridge_id),
|
||||
via_device=(DOMAIN, self.hub.api.config.bridge_id),
|
||||
)
|
||||
|
@ -38,7 +38,7 @@ from homeassistant.util.color import (
|
||||
)
|
||||
|
||||
from . import DeconzConfigEntry
|
||||
from .const import DOMAIN as DECONZ_DOMAIN, POWER_PLUGS
|
||||
from .const import DOMAIN, POWER_PLUGS
|
||||
from .entity import DeconzDevice
|
||||
from .hub import DeconzHub
|
||||
|
||||
@ -395,11 +395,11 @@ class DeconzGroup(DeconzBaseLight[Group]):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a device description for device registry."""
|
||||
return DeviceInfo(
|
||||
identifiers={(DECONZ_DOMAIN, self.unique_id)},
|
||||
identifiers={(DOMAIN, self.unique_id)},
|
||||
manufacturer="Dresden Elektronik",
|
||||
model="deCONZ group",
|
||||
name=self._device.name,
|
||||
via_device=(DECONZ_DOMAIN, self.hub.api.config.bridge_id),
|
||||
via_device=(DOMAIN, self.hub.api.config.bridge_id),
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -9,7 +9,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
||||
from .const import DOMAIN as FIRESERVICEROTA_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .coordinator import FireServiceConfigEntry, FireServiceRotaClient
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -106,7 +106,7 @@ class IncidentsSensor(RestoreEntity, SensorEntity):
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass,
|
||||
f"{FIRESERVICEROTA_DOMAIN}_{self._entry_id}_update",
|
||||
f"{DOMAIN}_{self._entry_id}_update",
|
||||
self.client_update,
|
||||
)
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .const import DOMAIN as FIRESERVICEROTA_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .coordinator import (
|
||||
FireServiceConfigEntry,
|
||||
FireServiceRotaClient,
|
||||
@ -122,7 +122,7 @@ class ResponseSwitch(SwitchEntity):
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass,
|
||||
f"{FIRESERVICEROTA_DOMAIN}_{self._entry_id}_update",
|
||||
f"{DOMAIN}_{self._entry_id}_update",
|
||||
self.client_update,
|
||||
)
|
||||
)
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from .const import DOMAIN as FLO_DOMAIN, LOGGER
|
||||
from .const import DOMAIN, LOGGER
|
||||
|
||||
type FloConfigEntry = ConfigEntry[FloRuntimeData]
|
||||
|
||||
@ -55,7 +55,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=f"{FLO_DOMAIN}-{device_id}",
|
||||
name=f"{DOMAIN}-{device_id}",
|
||||
update_interval=timedelta(seconds=60),
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN as FLO_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .coordinator import FloDeviceDataUpdateCoordinator
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class FloEntity(Entity):
|
||||
"""Return a device description for device registry."""
|
||||
return DeviceInfo(
|
||||
connections={(CONNECTION_NETWORK_MAC, self._device.mac_address)},
|
||||
identifiers={(FLO_DOMAIN, self._device.id)},
|
||||
identifiers={(DOMAIN, self._device.id)},
|
||||
serial_number=self._device.serial_number,
|
||||
manufacturer=self._device.manufacturer,
|
||||
model=self._device.model,
|
||||
|
@ -50,7 +50,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from . import services
|
||||
from .const import DOMAIN as HEOS_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .coordinator import HeosConfigEntry, HeosCoordinator
|
||||
|
||||
PARALLEL_UPDATES = 0
|
||||
@ -151,7 +151,7 @@ def catch_action_error[**_P, _R](
|
||||
return await func(*args, **kwargs)
|
||||
except (HeosError, ValueError) as ex:
|
||||
raise HomeAssistantError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="action_error",
|
||||
translation_placeholders={"action": action, "error": str(ex)},
|
||||
) from ex
|
||||
@ -179,7 +179,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
manufacturer = model_parts[0] if len(model_parts) == 2 else "HEOS"
|
||||
model = model_parts[1] if len(model_parts) == 2 else player.model
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(HEOS_DOMAIN, str(player.player_id))},
|
||||
identifiers={(DOMAIN, str(player.player_id))},
|
||||
manufacturer=manufacturer,
|
||||
model=model,
|
||||
name=player.name,
|
||||
@ -215,7 +215,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
for member_id in player_ids
|
||||
if (
|
||||
entity_id := entity_registry.async_get_entity_id(
|
||||
Platform.MEDIA_PLAYER, HEOS_DOMAIN, str(member_id)
|
||||
Platform.MEDIA_PLAYER, DOMAIN, str(member_id)
|
||||
)
|
||||
)
|
||||
]
|
||||
@ -379,7 +379,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
return
|
||||
|
||||
raise ServiceValidationError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="unknown_source",
|
||||
translation_placeholders={"source": source},
|
||||
)
|
||||
@ -406,7 +406,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
"""Set group volume level."""
|
||||
if self._player.group_id is None:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="entity_not_grouped",
|
||||
translation_placeholders={"entity_id": self.entity_id},
|
||||
)
|
||||
@ -419,7 +419,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
"""Turn group volume down for media player."""
|
||||
if self._player.group_id is None:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="entity_not_grouped",
|
||||
translation_placeholders={"entity_id": self.entity_id},
|
||||
)
|
||||
@ -430,7 +430,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
"""Turn group volume up for media player."""
|
||||
if self._player.group_id is None:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="entity_not_grouped",
|
||||
translation_placeholders={"entity_id": self.entity_id},
|
||||
)
|
||||
@ -446,13 +446,13 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
entity_entry = entity_registry.async_get(entity_id)
|
||||
if entity_entry is None:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="entity_not_found",
|
||||
translation_placeholders={"entity_id": entity_id},
|
||||
)
|
||||
if entity_entry.platform != HEOS_DOMAIN:
|
||||
if entity_entry.platform != DOMAIN:
|
||||
raise ServiceValidationError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="not_heos_media_player",
|
||||
translation_placeholders={"entity_id": entity_id},
|
||||
)
|
||||
@ -648,7 +648,7 @@ class HeosMediaPlayer(CoordinatorEntity[HeosCoordinator], MediaPlayerEntity):
|
||||
if media_source.is_media_source_id(media_content_id):
|
||||
return await self._async_browse_media_source(media_content_id)
|
||||
raise ServiceValidationError(
|
||||
translation_domain=HEOS_DOMAIN,
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="unsupported_media_content_id",
|
||||
translation_placeholders={"media_content_id": media_content_id},
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .const import DOMAIN as AQUALINK_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import AqualinkEntity
|
||||
|
||||
PARALLEL_UPDATES = 0
|
||||
@ -28,7 +28,7 @@ async def async_setup_entry(
|
||||
async_add_entities(
|
||||
(
|
||||
HassAqualinkBinarySensor(dev)
|
||||
for dev in hass.data[AQUALINK_DOMAIN][BINARY_SENSOR_DOMAIN]
|
||||
for dev in hass.data[DOMAIN][BINARY_SENSOR_DOMAIN]
|
||||
),
|
||||
True,
|
||||
)
|
||||
|
@ -21,7 +21,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import refresh_system
|
||||
from .const import DOMAIN as AQUALINK_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import AqualinkEntity
|
||||
from .utils import await_or_reraise
|
||||
|
||||
@ -37,10 +37,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up discovered switches."""
|
||||
async_add_entities(
|
||||
(
|
||||
HassAqualinkThermostat(dev)
|
||||
for dev in hass.data[AQUALINK_DOMAIN][CLIMATE_DOMAIN]
|
||||
),
|
||||
(HassAqualinkThermostat(dev) for dev in hass.data[DOMAIN][CLIMATE_DOMAIN]),
|
||||
True,
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import refresh_system
|
||||
from .const import DOMAIN as AQUALINK_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import AqualinkEntity
|
||||
from .utils import await_or_reraise
|
||||
|
||||
@ -33,7 +33,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up discovered lights."""
|
||||
async_add_entities(
|
||||
(HassAqualinkLight(dev) for dev in hass.data[AQUALINK_DOMAIN][LIGHT_DOMAIN]),
|
||||
(HassAqualinkLight(dev) for dev in hass.data[DOMAIN][LIGHT_DOMAIN]),
|
||||
True,
|
||||
)
|
||||
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.const import UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .const import DOMAIN as AQUALINK_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import AqualinkEntity
|
||||
|
||||
PARALLEL_UPDATES = 0
|
||||
@ -27,7 +27,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up discovered sensors."""
|
||||
async_add_entities(
|
||||
(HassAqualinkSensor(dev) for dev in hass.data[AQUALINK_DOMAIN][SENSOR_DOMAIN]),
|
||||
(HassAqualinkSensor(dev) for dev in hass.data[DOMAIN][SENSOR_DOMAIN]),
|
||||
True,
|
||||
)
|
||||
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import refresh_system
|
||||
from .const import DOMAIN as AQUALINK_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import AqualinkEntity
|
||||
from .utils import await_or_reraise
|
||||
|
||||
@ -26,7 +26,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up discovered switches."""
|
||||
async_add_entities(
|
||||
(HassAqualinkSwitch(dev) for dev in hass.data[AQUALINK_DOMAIN][SWITCH_DOMAIN]),
|
||||
(HassAqualinkSwitch(dev) for dev in hass.data[DOMAIN][SWITCH_DOMAIN]),
|
||||
True,
|
||||
)
|
||||
|
||||
|
@ -9,7 +9,7 @@ from homeassistant.core import callback
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN as KALEIDESCAPE_DOMAIN, NAME as KALEIDESCAPE_NAME
|
||||
from .const import DOMAIN, NAME as KALEIDESCAPE_NAME
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from kaleidescape import Device as KaleidescapeDevice
|
||||
@ -29,7 +29,7 @@ class KaleidescapeEntity(Entity):
|
||||
|
||||
self._attr_unique_id = device.serial_number
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(KALEIDESCAPE_DOMAIN, self._device.serial_number)},
|
||||
identifiers={(DOMAIN, self._device.serial_number)},
|
||||
# Instead of setting the device name to the entity name, kaleidescape
|
||||
# should be updated to set has_entity_name = True
|
||||
name=f"{KALEIDESCAPE_NAME} {device.system.friendly_name}",
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.components.media_player import (
|
||||
)
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
from .const import DOMAIN as KALEIDESCAPE_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import KaleidescapeEntity
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -43,7 +43,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the platform from a config entry."""
|
||||
entities = [KaleidescapeMediaPlayer(hass.data[KALEIDESCAPE_DOMAIN][entry.entry_id])]
|
||||
entities = [KaleidescapeMediaPlayer(hass.data[DOMAIN][entry.entry_id])]
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ from kaleidescape import const as kaleidescape_const
|
||||
from homeassistant.components.remote import RemoteEntity
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .const import DOMAIN as KALEIDESCAPE_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import KaleidescapeEntity
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -27,7 +27,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the platform from a config entry."""
|
||||
entities = [KaleidescapeRemote(hass.data[KALEIDESCAPE_DOMAIN][entry.entry_id])]
|
||||
entities = [KaleidescapeRemote(hass.data[DOMAIN][entry.entry_id])]
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
|
||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
||||
from homeassistant.const import PERCENTAGE, EntityCategory
|
||||
|
||||
from .const import DOMAIN as KALEIDESCAPE_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import KaleidescapeEntity
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -136,7 +136,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the platform from a config entry."""
|
||||
device: KaleidescapeDevice = hass.data[KALEIDESCAPE_DOMAIN][entry.entry_id]
|
||||
device: KaleidescapeDevice = hass.data[DOMAIN][entry.entry_id]
|
||||
async_add_entities(
|
||||
KaleidescapeSensor(device, description) for description in SENSOR_TYPES
|
||||
)
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .const import DOMAIN as KONNECTED_DOMAIN
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
@ -24,7 +24,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up binary sensors attached to a Konnected device from a config entry."""
|
||||
data = hass.data[KONNECTED_DOMAIN]
|
||||
data = hass.data[DOMAIN]
|
||||
device_id = config_entry.data["id"]
|
||||
sensors = [
|
||||
KonnectedBinarySensor(device_id, pin_num, pin_data)
|
||||
@ -48,7 +48,7 @@ class KonnectedBinarySensor(BinarySensorEntity):
|
||||
self._attr_unique_id = f"{device_id}-{zone_num}"
|
||||
self._attr_name = data.get(CONF_NAME)
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(KONNECTED_DOMAIN, device_id)},
|
||||
identifiers={(DOMAIN, device_id)},
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
|
@ -22,7 +22,7 @@ from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .const import DOMAIN as KONNECTED_DOMAIN, SIGNAL_DS18B20_NEW
|
||||
from .const import DOMAIN, SIGNAL_DS18B20_NEW
|
||||
|
||||
SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
||||
"temperature": SensorEntityDescription(
|
||||
@ -46,7 +46,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up sensors attached to a Konnected device from a config entry."""
|
||||
data = hass.data[KONNECTED_DOMAIN]
|
||||
data = hass.data[DOMAIN]
|
||||
device_id = config_entry.data["id"]
|
||||
|
||||
# Initialize all DHT sensors.
|
||||
@ -121,7 +121,7 @@ class KonnectedSensor(SensorEntity):
|
||||
name += f" {description.name}"
|
||||
self._attr_name = name
|
||||
|
||||
self._attr_device_info = DeviceInfo(identifiers={(KONNECTED_DOMAIN, device_id)})
|
||||
self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, device_id)})
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Store entity_id and register state change callback."""
|
||||
|
@ -10,7 +10,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from .const import DOMAIN as CASETA_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .util import serial_to_unique_id
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class LutronCasetaScene(Scene):
|
||||
self._bridge: Smartbridge = data.bridge
|
||||
bridge_unique_id = serial_to_unique_id(data.bridge_device["serial"])
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(CASETA_DOMAIN, data.bridge_device["serial"])},
|
||||
identifiers={(DOMAIN, data.bridge_device["serial"])},
|
||||
)
|
||||
self._attr_name = scene["name"]
|
||||
self._attr_unique_id = f"scene_{bridge_unique_id}_{self._scene_id}"
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import NukiEntryData
|
||||
from .const import DOMAIN as NUKI_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import NukiEntity
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the Nuki binary sensors."""
|
||||
entry_data: NukiEntryData = hass.data[NUKI_DOMAIN][entry.entry_id]
|
||||
entry_data: NukiEntryData = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
entities: list[NukiEntity] = []
|
||||
|
||||
|
@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import NukiEntryData
|
||||
from .const import DOMAIN as NUKI_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import NukiEntity
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ async def async_setup_entry(
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the Nuki lock sensor."""
|
||||
entry_data: NukiEntryData = hass.data[NUKI_DOMAIN][entry.entry_id]
|
||||
entry_data: NukiEntryData = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
async_add_entities(
|
||||
NukiBatterySensor(entry_data.coordinator, lock) for lock in entry_data.locks
|
||||
|
@ -17,7 +17,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import PointConfigEntry
|
||||
from .const import DOMAIN as POINT_DOMAIN, SIGNAL_WEBHOOK
|
||||
from .const import DOMAIN, SIGNAL_WEBHOOK
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -62,7 +62,7 @@ class MinutPointAlarmControl(AlarmControlPanelEntity):
|
||||
self._attr_name = self._home["name"]
|
||||
self._attr_unique_id = f"point.{home_id}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(POINT_DOMAIN, home_id)},
|
||||
identifiers={(DOMAIN, home_id)},
|
||||
manufacturer="Minut",
|
||||
name=self._attr_name,
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ from screenlogicpy.const.data import SHARED_VALUES
|
||||
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .const import DOMAIN as SL_DOMAIN, SL_UNIT_TO_HA_UNIT, ScreenLogicDataPath
|
||||
from .const import DOMAIN, SL_UNIT_TO_HA_UNIT, ScreenLogicDataPath
|
||||
from .coordinator import ScreenlogicDataUpdateCoordinator
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -41,7 +41,7 @@ def cleanup_excluded_entity(
|
||||
entity_registry = er.async_get(coordinator.hass)
|
||||
unique_id = f"{coordinator.config_entry.unique_id}_{generate_unique_id(*data_path)}"
|
||||
if entity_id := entity_registry.async_get_entity_id(
|
||||
platform_domain, SL_DOMAIN, unique_id
|
||||
platform_domain, DOMAIN, unique_id
|
||||
):
|
||||
_LOGGER.debug(
|
||||
"Removing existing entity '%s' per data inclusion rule", entity_id
|
||||
|
@ -25,7 +25,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from .const import DOMAIN as TIBBER_DOMAIN
|
||||
from .const import DOMAIN
|
||||
|
||||
FIVE_YEARS = 5 * 365 * 24
|
||||
|
||||
@ -80,7 +80,7 @@ class TibberDataCoordinator(DataUpdateCoordinator[None]):
|
||||
|
||||
for sensor_type, is_production, unit in sensors:
|
||||
statistic_id = (
|
||||
f"{TIBBER_DOMAIN}:energy_"
|
||||
f"{DOMAIN}:energy_"
|
||||
f"{sensor_type.lower()}_"
|
||||
f"{home.home_id.replace('-', '')}"
|
||||
)
|
||||
@ -166,7 +166,7 @@ class TibberDataCoordinator(DataUpdateCoordinator[None]):
|
||||
mean_type=StatisticMeanType.NONE,
|
||||
has_sum=True,
|
||||
name=f"{home.name} {sensor_type}",
|
||||
source=TIBBER_DOMAIN,
|
||||
source=DOMAIN,
|
||||
statistic_id=statistic_id,
|
||||
unit_of_measurement=unit,
|
||||
)
|
||||
|
@ -41,7 +41,7 @@ from homeassistant.helpers.update_coordinator import (
|
||||
)
|
||||
from homeassistant.util import Throttle, dt as dt_util
|
||||
|
||||
from .const import DOMAIN as TIBBER_DOMAIN, MANUFACTURER
|
||||
from .const import DOMAIN, MANUFACTURER
|
||||
from .coordinator import TibberDataCoordinator
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -267,7 +267,7 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up the Tibber sensor."""
|
||||
|
||||
tibber_connection = hass.data[TIBBER_DOMAIN]
|
||||
tibber_connection = hass.data[DOMAIN]
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
device_registry = dr.async_get(hass)
|
||||
@ -309,21 +309,17 @@ async def async_setup_entry(
|
||||
continue
|
||||
|
||||
# migrate to new device ids
|
||||
old_entity_id = entity_registry.async_get_entity_id(
|
||||
"sensor", TIBBER_DOMAIN, old_id
|
||||
)
|
||||
old_entity_id = entity_registry.async_get_entity_id("sensor", DOMAIN, old_id)
|
||||
if old_entity_id is not None:
|
||||
entity_registry.async_update_entity(
|
||||
old_entity_id, new_unique_id=home.home_id
|
||||
)
|
||||
|
||||
# migrate to new device ids
|
||||
device_entry = device_registry.async_get_device(
|
||||
identifiers={(TIBBER_DOMAIN, old_id)}
|
||||
)
|
||||
device_entry = device_registry.async_get_device(identifiers={(DOMAIN, old_id)})
|
||||
if device_entry and entry.entry_id in device_entry.config_entries:
|
||||
device_registry.async_update_device(
|
||||
device_entry.id, new_identifiers={(TIBBER_DOMAIN, home.home_id)}
|
||||
device_entry.id, new_identifiers={(DOMAIN, home.home_id)}
|
||||
)
|
||||
|
||||
async_add_entities(entities, True)
|
||||
@ -352,7 +348,7 @@ class TibberSensor(SensorEntity):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device_info of the device."""
|
||||
device_info = DeviceInfo(
|
||||
identifiers={(TIBBER_DOMAIN, self._tibber_home.home_id)},
|
||||
identifiers={(DOMAIN, self._tibber_home.home_id)},
|
||||
name=self._device_name,
|
||||
manufacturer=MANUFACTURER,
|
||||
)
|
||||
@ -553,19 +549,19 @@ class TibberRtEntityCreator:
|
||||
if translation_key in RT_SENSORS_UNIQUE_ID_MIGRATION_SIMPLE:
|
||||
entity_id = self._entity_registry.async_get_entity_id(
|
||||
"sensor",
|
||||
TIBBER_DOMAIN,
|
||||
DOMAIN,
|
||||
f"{home_id}_rt_{translation_key.replace('_', ' ')}",
|
||||
)
|
||||
elif translation_key in RT_SENSORS_UNIQUE_ID_MIGRATION:
|
||||
entity_id = self._entity_registry.async_get_entity_id(
|
||||
"sensor",
|
||||
TIBBER_DOMAIN,
|
||||
DOMAIN,
|
||||
f"{home_id}_rt_{RT_SENSORS_UNIQUE_ID_MIGRATION[translation_key]}",
|
||||
)
|
||||
elif translation_key != description_key:
|
||||
entity_id = self._entity_registry.async_get_entity_id(
|
||||
"sensor",
|
||||
TIBBER_DOMAIN,
|
||||
DOMAIN,
|
||||
f"{home_id}_rt_{translation_key}",
|
||||
)
|
||||
|
||||
|
@ -11,7 +11,7 @@ from homeassistant.helpers.device_registry import DeviceEntry
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import DOMAIN as UNIFI_DOMAIN, PLATFORMS, UNIFI_WIRELESS_CLIENTS
|
||||
from .const import DOMAIN, PLATFORMS, UNIFI_WIRELESS_CLIENTS
|
||||
from .errors import AuthenticationRequired, CannotConnect
|
||||
from .hub import UnifiHub, get_unifi_api
|
||||
from .services import async_setup_services
|
||||
@ -22,7 +22,7 @@ SAVE_DELAY = 10
|
||||
STORAGE_KEY = "unifi_data"
|
||||
STORAGE_VERSION = 1
|
||||
|
||||
CONFIG_SCHEMA = cv.config_entry_only_config_schema(UNIFI_DOMAIN)
|
||||
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
@ -30,7 +30,7 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import UnifiConfigEntry
|
||||
from .const import DOMAIN as UNIFI_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .entity import (
|
||||
HandlerT,
|
||||
UnifiEntity,
|
||||
@ -204,14 +204,12 @@ def async_update_unique_id(hass: HomeAssistant, config_entry: UnifiConfigEntry)
|
||||
def update_unique_id(obj_id: str) -> None:
|
||||
"""Rework unique ID."""
|
||||
new_unique_id = f"{hub.site}-{obj_id}"
|
||||
if ent_reg.async_get_entity_id(
|
||||
DEVICE_TRACKER_DOMAIN, UNIFI_DOMAIN, new_unique_id
|
||||
):
|
||||
if ent_reg.async_get_entity_id(DEVICE_TRACKER_DOMAIN, DOMAIN, new_unique_id):
|
||||
return
|
||||
|
||||
unique_id = f"{obj_id}-{hub.site}"
|
||||
if entity_id := ent_reg.async_get_entity_id(
|
||||
DEVICE_TRACKER_DOMAIN, UNIFI_DOMAIN, unique_id
|
||||
DEVICE_TRACKER_DOMAIN, DOMAIN, unique_id
|
||||
):
|
||||
ent_reg.async_update_entity(entity_id, new_unique_id=new_unique_id)
|
||||
|
||||
|
@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
|
||||
from .const import DOMAIN as UNIFI_DOMAIN
|
||||
from .const import DOMAIN
|
||||
|
||||
SERVICE_RECONNECT_CLIENT = "reconnect_client"
|
||||
SERVICE_REMOVE_CLIENTS = "remove_clients"
|
||||
@ -42,7 +42,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
|
||||
for service in SUPPORTED_SERVICES:
|
||||
hass.services.async_register(
|
||||
UNIFI_DOMAIN,
|
||||
DOMAIN,
|
||||
service,
|
||||
async_call_unifi_service,
|
||||
schema=SERVICE_TO_SCHEMA.get(service),
|
||||
@ -66,7 +66,7 @@ async def async_reconnect_client(hass: HomeAssistant, data: Mapping[str, Any]) -
|
||||
if mac == "":
|
||||
return
|
||||
|
||||
for config_entry in hass.config_entries.async_loaded_entries(UNIFI_DOMAIN):
|
||||
for config_entry in hass.config_entries.async_loaded_entries(DOMAIN):
|
||||
if (
|
||||
(not (hub := config_entry.runtime_data).available)
|
||||
or (client := hub.api.clients.get(mac)) is None
|
||||
@ -84,7 +84,7 @@ async def async_remove_clients(hass: HomeAssistant, data: Mapping[str, Any]) ->
|
||||
- Total time between first seen and last seen is less than 15 minutes.
|
||||
- Neither IP, hostname nor name is configured.
|
||||
"""
|
||||
for config_entry in hass.config_entries.async_loaded_entries(UNIFI_DOMAIN):
|
||||
for config_entry in hass.config_entries.async_loaded_entries(DOMAIN):
|
||||
if not (hub := config_entry.runtime_data).available:
|
||||
continue
|
||||
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.core import CALLBACK_TYPE, HomeAssistant
|
||||
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import DOMAIN as WEMO_DOMAIN, WEMO_SUBSCRIPTION_EVENT
|
||||
from .const import DOMAIN, WEMO_SUBSCRIPTION_EVENT
|
||||
from .coordinator import async_get_coordinator
|
||||
|
||||
TRIGGER_TYPES = {EVENT_TYPE_LONG_PRESS}
|
||||
@ -32,7 +32,7 @@ async def async_get_triggers(
|
||||
wemo_trigger = {
|
||||
# Required fields of TRIGGER_BASE_SCHEMA
|
||||
CONF_PLATFORM: "device",
|
||||
CONF_DOMAIN: WEMO_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_DEVICE_ID: device_id,
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
from homeassistant.util import color as color_util
|
||||
|
||||
from . import async_wemo_dispatcher_connect
|
||||
from .const import DOMAIN as WEMO_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .coordinator import DeviceCoordinator
|
||||
from .entity import WemoBinaryStateEntity, WemoEntity
|
||||
|
||||
@ -110,7 +110,7 @@ class WemoLight(WemoEntity, LightEntity):
|
||||
"""Return the device info."""
|
||||
return DeviceInfo(
|
||||
connections={(CONNECTION_ZIGBEE, self._unique_id)},
|
||||
identifiers={(WEMO_DOMAIN, self._unique_id)},
|
||||
identifiers={(DOMAIN, self._unique_id)},
|
||||
manufacturer="Belkin",
|
||||
model=self._model_name,
|
||||
name=self.name,
|
||||
|
@ -14,7 +14,7 @@ from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import DOMAIN as ZHA_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .helpers import async_get_zha_device_proxy, get_zha_data
|
||||
|
||||
CONF_SUBTYPE = "subtype"
|
||||
@ -104,7 +104,7 @@ async def async_get_triggers(
|
||||
return [
|
||||
{
|
||||
CONF_DEVICE_ID: device_id,
|
||||
CONF_DOMAIN: ZHA_DOMAIN,
|
||||
CONF_DOMAIN: DOMAIN,
|
||||
CONF_PLATFORM: DEVICE,
|
||||
CONF_TYPE: trigger,
|
||||
CONF_SUBTYPE: subtype,
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.const import ATTR_COMMAND, ATTR_DEVICE_ID
|
||||
from homeassistant.core import Event, HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .const import DOMAIN as ZHA_DOMAIN
|
||||
from .const import DOMAIN
|
||||
from .helpers import async_get_zha_device_proxy
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -84,4 +84,4 @@ def async_describe_events(
|
||||
LOGBOOK_ENTRY_MESSAGE: message,
|
||||
}
|
||||
|
||||
async_describe_event(ZHA_DOMAIN, ZHA_EVENT, async_describe_zha_event)
|
||||
async_describe_event(DOMAIN, ZHA_EVENT, async_describe_zha_event)
|
||||
|
Reference in New Issue
Block a user