mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Drop alias from local DOMAIN import (#144867)
This commit is contained in:
parent
8ccedd4064
commit
161b62d8fa
@ -47,7 +47,7 @@ from .const import (
|
|||||||
CONF_VIDEO_SOURCE,
|
CONF_VIDEO_SOURCE,
|
||||||
DEFAULT_STREAM_PROFILE,
|
DEFAULT_STREAM_PROFILE,
|
||||||
DEFAULT_VIDEO_SOURCE,
|
DEFAULT_VIDEO_SOURCE,
|
||||||
DOMAIN as AXIS_DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
from .errors import AuthenticationRequired, CannotConnect
|
from .errors import AuthenticationRequired, CannotConnect
|
||||||
from .hub import AxisHub, get_axis_api
|
from .hub import AxisHub, get_axis_api
|
||||||
@ -58,7 +58,7 @@ DEFAULT_PROTOCOL = "https"
|
|||||||
PROTOCOL_CHOICES = ["https", "http"]
|
PROTOCOL_CHOICES = ["https", "http"]
|
||||||
|
|
||||||
|
|
||||||
class AxisFlowHandler(ConfigFlow, domain=AXIS_DOMAIN):
|
class AxisFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a Axis config flow."""
|
"""Handle a Axis config flow."""
|
||||||
|
|
||||||
VERSION = 3
|
VERSION = 3
|
||||||
@ -146,7 +146,7 @@ class AxisFlowHandler(ConfigFlow, domain=AXIS_DOMAIN):
|
|||||||
model = self.config[CONF_MODEL]
|
model = self.config[CONF_MODEL]
|
||||||
same_model = [
|
same_model = [
|
||||||
entry.data[CONF_NAME]
|
entry.data[CONF_NAME]
|
||||||
for entry in self.hass.config_entries.async_entries(AXIS_DOMAIN)
|
for entry in self.hass.config_entries.async_entries(DOMAIN)
|
||||||
if entry.source != SOURCE_IGNORE and entry.data[CONF_MODEL] == model
|
if entry.source != SOURCE_IGNORE and entry.data[CONF_MODEL] == model
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -22,13 +22,7 @@ from homeassistant.exceptions import ConfigEntryAuthFailed
|
|||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
from homeassistant.util.ssl import get_default_context
|
from homeassistant.util.ssl import get_default_context
|
||||||
|
|
||||||
from .const import (
|
from .const import CONF_GCID, CONF_READ_ONLY, CONF_REFRESH_TOKEN, DOMAIN, SCAN_INTERVALS
|
||||||
CONF_GCID,
|
|
||||||
CONF_READ_ONLY,
|
|
||||||
CONF_REFRESH_TOKEN,
|
|
||||||
DOMAIN as BMW_DOMAIN,
|
|
||||||
SCAN_INTERVALS,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -63,7 +57,7 @@ class BMWDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
|||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
config_entry=config_entry,
|
config_entry=config_entry,
|
||||||
name=f"{BMW_DOMAIN}-{config_entry.data[CONF_USERNAME]}",
|
name=f"{DOMAIN}-{config_entry.data[CONF_USERNAME]}",
|
||||||
update_interval=timedelta(
|
update_interval=timedelta(
|
||||||
seconds=SCAN_INTERVALS[config_entry.data[CONF_REGION]]
|
seconds=SCAN_INTERVALS[config_entry.data[CONF_REGION]]
|
||||||
),
|
),
|
||||||
@ -81,26 +75,26 @@ class BMWDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
|||||||
except MyBMWCaptchaMissingError as err:
|
except MyBMWCaptchaMissingError as err:
|
||||||
# If a captcha is required (user/password login flow), always trigger the reauth flow
|
# If a captcha is required (user/password login flow), always trigger the reauth flow
|
||||||
raise ConfigEntryAuthFailed(
|
raise ConfigEntryAuthFailed(
|
||||||
translation_domain=BMW_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="missing_captcha",
|
translation_key="missing_captcha",
|
||||||
) from err
|
) from err
|
||||||
except MyBMWAuthError as err:
|
except MyBMWAuthError as err:
|
||||||
# Allow one retry interval before raising AuthFailed to avoid flaky API issues
|
# Allow one retry interval before raising AuthFailed to avoid flaky API issues
|
||||||
if self.last_update_success:
|
if self.last_update_success:
|
||||||
raise UpdateFailed(
|
raise UpdateFailed(
|
||||||
translation_domain=BMW_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="update_failed",
|
translation_key="update_failed",
|
||||||
translation_placeholders={"exception": str(err)},
|
translation_placeholders={"exception": str(err)},
|
||||||
) from err
|
) from err
|
||||||
# Clear refresh token and trigger reauth if previous update failed as well
|
# Clear refresh token and trigger reauth if previous update failed as well
|
||||||
self._update_config_entry_refresh_token(None)
|
self._update_config_entry_refresh_token(None)
|
||||||
raise ConfigEntryAuthFailed(
|
raise ConfigEntryAuthFailed(
|
||||||
translation_domain=BMW_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="invalid_auth",
|
translation_key="invalid_auth",
|
||||||
) from err
|
) from err
|
||||||
except (MyBMWAPIError, RequestError) as err:
|
except (MyBMWAPIError, RequestError) as err:
|
||||||
raise UpdateFailed(
|
raise UpdateFailed(
|
||||||
translation_domain=BMW_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="update_failed",
|
translation_key="update_failed",
|
||||||
translation_placeholders={"exception": str(err)},
|
translation_placeholders={"exception": str(err)},
|
||||||
) from err
|
) from err
|
||||||
|
@ -60,7 +60,7 @@ from .const import (
|
|||||||
ADDED_CAST_DEVICES_KEY,
|
ADDED_CAST_DEVICES_KEY,
|
||||||
CAST_MULTIZONE_MANAGER_KEY,
|
CAST_MULTIZONE_MANAGER_KEY,
|
||||||
CONF_IGNORE_CEC,
|
CONF_IGNORE_CEC,
|
||||||
DOMAIN as CAST_DOMAIN,
|
DOMAIN,
|
||||||
SIGNAL_CAST_DISCOVERED,
|
SIGNAL_CAST_DISCOVERED,
|
||||||
SIGNAL_CAST_REMOVED,
|
SIGNAL_CAST_REMOVED,
|
||||||
SIGNAL_HASS_CAST_SHOW_VIEW,
|
SIGNAL_HASS_CAST_SHOW_VIEW,
|
||||||
@ -315,7 +315,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
|||||||
self._cast_view_remove_handler: CALLBACK_TYPE | None = None
|
self._cast_view_remove_handler: CALLBACK_TYPE | None = None
|
||||||
self._attr_unique_id = str(cast_info.uuid)
|
self._attr_unique_id = str(cast_info.uuid)
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(CAST_DOMAIN, str(cast_info.uuid).replace("-", ""))},
|
identifiers={(DOMAIN, str(cast_info.uuid).replace("-", ""))},
|
||||||
manufacturer=str(cast_info.cast_info.manufacturer),
|
manufacturer=str(cast_info.cast_info.manufacturer),
|
||||||
model=cast_info.cast_info.model_name,
|
model=cast_info.cast_info.model_name,
|
||||||
name=str(cast_info.friendly_name),
|
name=str(cast_info.friendly_name),
|
||||||
@ -591,7 +591,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
|||||||
"""Generate root node."""
|
"""Generate root node."""
|
||||||
children = []
|
children = []
|
||||||
# Add media browsers
|
# Add media browsers
|
||||||
for platform in self.hass.data[CAST_DOMAIN]["cast_platform"].values():
|
for platform in self.hass.data[DOMAIN]["cast_platform"].values():
|
||||||
children.extend(
|
children.extend(
|
||||||
await platform.async_get_media_browser_root_object(
|
await platform.async_get_media_browser_root_object(
|
||||||
self.hass, self._chromecast.cast_type
|
self.hass, self._chromecast.cast_type
|
||||||
@ -650,7 +650,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
|||||||
|
|
||||||
platform: CastProtocol
|
platform: CastProtocol
|
||||||
assert media_content_type is not None
|
assert media_content_type is not None
|
||||||
for platform in self.hass.data[CAST_DOMAIN]["cast_platform"].values():
|
for platform in self.hass.data[DOMAIN]["cast_platform"].values():
|
||||||
browse_media = await platform.async_browse_media(
|
browse_media = await platform.async_browse_media(
|
||||||
self.hass,
|
self.hass,
|
||||||
media_content_type,
|
media_content_type,
|
||||||
@ -680,7 +680,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
|||||||
extra = kwargs.get(ATTR_MEDIA_EXTRA, {})
|
extra = kwargs.get(ATTR_MEDIA_EXTRA, {})
|
||||||
|
|
||||||
# Handle media supported by a known cast app
|
# Handle media supported by a known cast app
|
||||||
if media_type == CAST_DOMAIN:
|
if media_type == DOMAIN:
|
||||||
try:
|
try:
|
||||||
app_data = json.loads(media_id)
|
app_data = json.loads(media_id)
|
||||||
if metadata := extra.get("metadata"):
|
if metadata := extra.get("metadata"):
|
||||||
@ -712,7 +712,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Try the cast platforms
|
# Try the cast platforms
|
||||||
for platform in self.hass.data[CAST_DOMAIN]["cast_platform"].values():
|
for platform in self.hass.data[DOMAIN]["cast_platform"].values():
|
||||||
result = await platform.async_play_media(
|
result = await platform.async_play_media(
|
||||||
self.hass, self.entity_id, chromecast, media_type, media_id
|
self.hass, self.entity_id, chromecast, media_type, media_id
|
||||||
)
|
)
|
||||||
|
@ -43,7 +43,7 @@ from homeassistant.util.dt import utcnow
|
|||||||
from .const import (
|
from .const import (
|
||||||
CONF_ENTITY_CONFIG,
|
CONF_ENTITY_CONFIG,
|
||||||
CONF_FILTER,
|
CONF_FILTER,
|
||||||
DOMAIN as CLOUD_DOMAIN,
|
DOMAIN,
|
||||||
PREF_ALEXA_REPORT_STATE,
|
PREF_ALEXA_REPORT_STATE,
|
||||||
PREF_ENABLE_ALEXA,
|
PREF_ENABLE_ALEXA,
|
||||||
PREF_SHOULD_EXPOSE,
|
PREF_SHOULD_EXPOSE,
|
||||||
@ -55,7 +55,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CLOUD_ALEXA = f"{CLOUD_DOMAIN}.{ALEXA_DOMAIN}"
|
CLOUD_ALEXA = f"{DOMAIN}.{ALEXA_DOMAIN}"
|
||||||
|
|
||||||
# Time to wait when entity preferences have changed before syncing it to
|
# Time to wait when entity preferences have changed before syncing it to
|
||||||
# the cloud.
|
# the cloud.
|
||||||
|
@ -41,7 +41,7 @@ from .const import (
|
|||||||
CONF_ENTITY_CONFIG,
|
CONF_ENTITY_CONFIG,
|
||||||
CONF_FILTER,
|
CONF_FILTER,
|
||||||
DEFAULT_DISABLE_2FA,
|
DEFAULT_DISABLE_2FA,
|
||||||
DOMAIN as CLOUD_DOMAIN,
|
DOMAIN,
|
||||||
PREF_DISABLE_2FA,
|
PREF_DISABLE_2FA,
|
||||||
PREF_SHOULD_EXPOSE,
|
PREF_SHOULD_EXPOSE,
|
||||||
)
|
)
|
||||||
@ -52,7 +52,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CLOUD_GOOGLE = f"{CLOUD_DOMAIN}.{GOOGLE_DOMAIN}"
|
CLOUD_GOOGLE = f"{DOMAIN}.{GOOGLE_DOMAIN}"
|
||||||
|
|
||||||
|
|
||||||
SUPPORTED_DOMAINS = {
|
SUPPORTED_DOMAINS = {
|
||||||
|
@ -17,12 +17,7 @@ from homeassistant.helpers import device_registry as dr, entity_registry as er
|
|||||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
|
|
||||||
from ..const import (
|
from ..const import CONF_MASTER_GATEWAY, DOMAIN, HASSIO_CONFIGURATION_URL, PLATFORMS
|
||||||
CONF_MASTER_GATEWAY,
|
|
||||||
DOMAIN as DECONZ_DOMAIN,
|
|
||||||
HASSIO_CONFIGURATION_URL,
|
|
||||||
PLATFORMS,
|
|
||||||
)
|
|
||||||
from .config import DeconzConfig
|
from .config import DeconzConfig
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -193,7 +188,7 @@ class DeconzHub:
|
|||||||
config_entry_id=self.config_entry.entry_id,
|
config_entry_id=self.config_entry.entry_id,
|
||||||
configuration_url=configuration_url,
|
configuration_url=configuration_url,
|
||||||
entry_type=dr.DeviceEntryType.SERVICE,
|
entry_type=dr.DeviceEntryType.SERVICE,
|
||||||
identifiers={(DECONZ_DOMAIN, self.api.config.bridge_id)},
|
identifiers={(DOMAIN, self.api.config.bridge_id)},
|
||||||
manufacturer="Dresden Elektronik",
|
manufacturer="Dresden Elektronik",
|
||||||
model=self.api.config.model_id,
|
model=self.api.config.model_id,
|
||||||
name=self.api.config.name,
|
name=self.api.config.name,
|
||||||
|
@ -45,7 +45,7 @@ from ..const import (
|
|||||||
CONF_ALLOW_UNREACHABLE,
|
CONF_ALLOW_UNREACHABLE,
|
||||||
DEFAULT_ALLOW_HUE_GROUPS,
|
DEFAULT_ALLOW_HUE_GROUPS,
|
||||||
DEFAULT_ALLOW_UNREACHABLE,
|
DEFAULT_ALLOW_UNREACHABLE,
|
||||||
DOMAIN as HUE_DOMAIN,
|
DOMAIN,
|
||||||
GROUP_TYPE_ENTERTAINMENT,
|
GROUP_TYPE_ENTERTAINMENT,
|
||||||
GROUP_TYPE_LIGHT_GROUP,
|
GROUP_TYPE_LIGHT_GROUP,
|
||||||
GROUP_TYPE_LIGHT_SOURCE,
|
GROUP_TYPE_LIGHT_SOURCE,
|
||||||
@ -141,7 +141,7 @@ def create_light(item_class, coordinator, bridge, is_group, rooms, api, item_id)
|
|||||||
|
|
||||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
"""Set up the Hue lights from a config entry."""
|
"""Set up the Hue lights from a config entry."""
|
||||||
bridge: HueBridge = hass.data[HUE_DOMAIN][config_entry.entry_id]
|
bridge: HueBridge = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
api_version = tuple(int(v) for v in bridge.api.config.apiversion.split("."))
|
api_version = tuple(int(v) for v in bridge.api.config.apiversion.split("."))
|
||||||
rooms = {}
|
rooms = {}
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ class HueLight(CoordinatorEntity, LightEntity):
|
|||||||
suggested_area = self._rooms[self.light.id]
|
suggested_area = self._rooms[self.light.id]
|
||||||
|
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
identifiers={(HUE_DOMAIN, self.device_id)},
|
identifiers={(DOMAIN, self.device_id)},
|
||||||
manufacturer=self.light.manufacturername,
|
manufacturer=self.light.manufacturername,
|
||||||
# productname added in Hue Bridge API 1.24
|
# productname added in Hue Bridge API 1.24
|
||||||
# (published 03/05/2018)
|
# (published 03/05/2018)
|
||||||
@ -526,7 +526,7 @@ class HueLight(CoordinatorEntity, LightEntity):
|
|||||||
name=self.name,
|
name=self.name,
|
||||||
sw_version=self.light.swversion,
|
sw_version=self.light.swversion,
|
||||||
suggested_area=suggested_area,
|
suggested_area=suggested_area,
|
||||||
via_device=(HUE_DOMAIN, self.bridge.api.config.bridgeid),
|
via_device=(DOMAIN, self.bridge.api.config.bridgeid),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs):
|
async def async_turn_on(self, **kwargs):
|
||||||
|
@ -3,11 +3,7 @@
|
|||||||
from homeassistant.helpers import entity
|
from homeassistant.helpers import entity
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
from homeassistant.helpers.device_registry import DeviceInfo
|
||||||
|
|
||||||
from ..const import (
|
from ..const import CONF_ALLOW_UNREACHABLE, DEFAULT_ALLOW_UNREACHABLE, DOMAIN
|
||||||
CONF_ALLOW_UNREACHABLE,
|
|
||||||
DEFAULT_ALLOW_UNREACHABLE,
|
|
||||||
DOMAIN as HUE_DOMAIN,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class GenericHueDevice(entity.Entity): # pylint: disable=hass-enforce-class-module
|
class GenericHueDevice(entity.Entity): # pylint: disable=hass-enforce-class-module
|
||||||
@ -55,10 +51,10 @@ class GenericHueDevice(entity.Entity): # pylint: disable=hass-enforce-class-mod
|
|||||||
Links individual entities together in the hass device registry.
|
Links individual entities together in the hass device registry.
|
||||||
"""
|
"""
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
identifiers={(HUE_DOMAIN, self.device_id)},
|
identifiers={(DOMAIN, self.device_id)},
|
||||||
manufacturer=self.primary_sensor.manufacturername,
|
manufacturer=self.primary_sensor.manufacturername,
|
||||||
model=(self.primary_sensor.productname or self.primary_sensor.modelid),
|
model=(self.primary_sensor.productname or self.primary_sensor.modelid),
|
||||||
name=self.primary_sensor.name,
|
name=self.primary_sensor.name,
|
||||||
sw_version=self.primary_sensor.swversion,
|
sw_version=self.primary_sensor.swversion,
|
||||||
via_device=(HUE_DOMAIN, self.bridge.api.config.bridgeid),
|
via_device=(DOMAIN, self.bridge.api.config.bridgeid),
|
||||||
)
|
)
|
||||||
|
@ -22,7 +22,7 @@ from .const import (
|
|||||||
CONF_ACTIVATION,
|
CONF_ACTIVATION,
|
||||||
CONF_MOMENTARY,
|
CONF_MOMENTARY,
|
||||||
CONF_PAUSE,
|
CONF_PAUSE,
|
||||||
DOMAIN as KONNECTED_DOMAIN,
|
DOMAIN,
|
||||||
STATE_HIGH,
|
STATE_HIGH,
|
||||||
STATE_LOW,
|
STATE_LOW,
|
||||||
)
|
)
|
||||||
@ -36,7 +36,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up switches attached to a Konnected device from a config entry."""
|
"""Set up switches attached to a Konnected device from a config entry."""
|
||||||
data = hass.data[KONNECTED_DOMAIN]
|
data = hass.data[DOMAIN]
|
||||||
device_id = config_entry.data["id"]
|
device_id = config_entry.data["id"]
|
||||||
switches = [
|
switches = [
|
||||||
KonnectedSwitch(device_id, zone_data.get(CONF_ZONE), zone_data)
|
KonnectedSwitch(device_id, zone_data.get(CONF_ZONE), zone_data)
|
||||||
@ -63,12 +63,12 @@ class KonnectedSwitch(SwitchEntity):
|
|||||||
f"{device_id}-{self._zone_num}-{self._momentary}-"
|
f"{device_id}-{self._zone_num}-{self._momentary}-"
|
||||||
f"{self._pause}-{self._repeat}"
|
f"{self._pause}-{self._repeat}"
|
||||||
)
|
)
|
||||||
self._attr_device_info = DeviceInfo(identifiers={(KONNECTED_DOMAIN, device_id)})
|
self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, device_id)})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def panel(self):
|
def panel(self):
|
||||||
"""Return the Konnected HTTP client."""
|
"""Return the Konnected HTTP client."""
|
||||||
device_data = self.hass.data[KONNECTED_DOMAIN][CONF_DEVICES][self._device_id]
|
device_data = self.hass.data[DOMAIN][CONF_DEVICES][self._device_id]
|
||||||
return device_data.get("panel")
|
return device_data.get("panel")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -34,7 +34,7 @@ from . import format_unique_id, load_games, save_games
|
|||||||
from .const import (
|
from .const import (
|
||||||
ATTR_MEDIA_IMAGE_URL,
|
ATTR_MEDIA_IMAGE_URL,
|
||||||
DEFAULT_ALIAS,
|
DEFAULT_ALIAS,
|
||||||
DOMAIN as PS4_DOMAIN,
|
DOMAIN,
|
||||||
PS4_DATA,
|
PS4_DATA,
|
||||||
REGIONS as deprecated_regions,
|
REGIONS as deprecated_regions,
|
||||||
)
|
)
|
||||||
@ -366,7 +366,7 @@ class PS4Device(MediaPlayerEntity):
|
|||||||
_sw_version = _sw_version[1:4]
|
_sw_version = _sw_version[1:4]
|
||||||
sw_version = f"{_sw_version[0]}.{_sw_version[1:]}"
|
sw_version = f"{_sw_version[0]}.{_sw_version[1:]}"
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(PS4_DOMAIN, status["host-id"])},
|
identifiers={(DOMAIN, status["host-id"])},
|
||||||
manufacturer="Sony Interactive Entertainment Inc.",
|
manufacturer="Sony Interactive Entertainment Inc.",
|
||||||
model="PlayStation 4",
|
model="PlayStation 4",
|
||||||
name=status["host-name"],
|
name=status["host-name"],
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.helpers.entity import Entity
|
|||||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
DOMAIN as DOMAIN_RACHIO,
|
DOMAIN,
|
||||||
KEY_BATTERY_STATUS,
|
KEY_BATTERY_STATUS,
|
||||||
KEY_DEVICE_ID,
|
KEY_DEVICE_ID,
|
||||||
KEY_LOW,
|
KEY_LOW,
|
||||||
@ -55,7 +55,7 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
def _create_entities(hass: HomeAssistant, config_entry: ConfigEntry) -> list[Entity]:
|
def _create_entities(hass: HomeAssistant, config_entry: ConfigEntry) -> list[Entity]:
|
||||||
entities: list[Entity] = []
|
entities: list[Entity] = []
|
||||||
person: RachioPerson = hass.data[DOMAIN_RACHIO][config_entry.entry_id]
|
person: RachioPerson = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
for controller in person.controllers:
|
for controller in person.controllers:
|
||||||
entities.append(RachioControllerOnlineBinarySensor(controller))
|
entities.append(RachioControllerOnlineBinarySensor(controller))
|
||||||
entities.append(RachioRainSensor(controller))
|
entities.append(RachioRainSensor(controller))
|
||||||
|
@ -17,7 +17,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
DOMAIN as DOMAIN_RACHIO,
|
DOMAIN,
|
||||||
KEY_ADDRESS,
|
KEY_ADDRESS,
|
||||||
KEY_DURATION_SECONDS,
|
KEY_DURATION_SECONDS,
|
||||||
KEY_ID,
|
KEY_ID,
|
||||||
@ -44,7 +44,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up entry for Rachio smart hose timer calendar."""
|
"""Set up entry for Rachio smart hose timer calendar."""
|
||||||
person: RachioPerson = hass.data[DOMAIN_RACHIO][config_entry.entry_id]
|
person: RachioPerson = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
RachioCalendarEntity(base_station.schedule_coordinator, base_station)
|
RachioCalendarEntity(base_station.schedule_coordinator, base_station)
|
||||||
for base_station in person.base_stations
|
for base_station in person.base_stations
|
||||||
|
@ -23,7 +23,7 @@ from homeassistant.util.dt import as_timestamp, now, parse_datetime, utc_from_ti
|
|||||||
from .const import (
|
from .const import (
|
||||||
CONF_MANUAL_RUN_MINS,
|
CONF_MANUAL_RUN_MINS,
|
||||||
DEFAULT_MANUAL_RUN_MINS,
|
DEFAULT_MANUAL_RUN_MINS,
|
||||||
DOMAIN as DOMAIN_RACHIO,
|
DOMAIN,
|
||||||
KEY_CURRENT_STATUS,
|
KEY_CURRENT_STATUS,
|
||||||
KEY_CUSTOM_CROP,
|
KEY_CUSTOM_CROP,
|
||||||
KEY_CUSTOM_SHADE,
|
KEY_CUSTOM_SHADE,
|
||||||
@ -119,7 +119,7 @@ async def async_setup_entry(
|
|||||||
def start_multiple(service: ServiceCall) -> None:
|
def start_multiple(service: ServiceCall) -> None:
|
||||||
"""Service to start multiple zones in sequence."""
|
"""Service to start multiple zones in sequence."""
|
||||||
zones_list = []
|
zones_list = []
|
||||||
person = hass.data[DOMAIN_RACHIO][config_entry.entry_id]
|
person = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
entity_id = service.data[ATTR_ENTITY_ID]
|
entity_id = service.data[ATTR_ENTITY_ID]
|
||||||
duration = iter(service.data[ATTR_DURATION])
|
duration = iter(service.data[ATTR_DURATION])
|
||||||
default_time = service.data[ATTR_DURATION][0]
|
default_time = service.data[ATTR_DURATION][0]
|
||||||
@ -160,7 +160,7 @@ async def async_setup_entry(
|
|||||||
return
|
return
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.async_register(
|
||||||
DOMAIN_RACHIO,
|
DOMAIN,
|
||||||
SERVICE_START_MULTIPLE_ZONES,
|
SERVICE_START_MULTIPLE_ZONES,
|
||||||
start_multiple,
|
start_multiple,
|
||||||
schema=START_MULTIPLE_ZONES_SCHEMA,
|
schema=START_MULTIPLE_ZONES_SCHEMA,
|
||||||
@ -177,7 +177,7 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
def _create_entities(hass: HomeAssistant, config_entry: ConfigEntry) -> list[Entity]:
|
def _create_entities(hass: HomeAssistant, config_entry: ConfigEntry) -> list[Entity]:
|
||||||
entities: list[Entity] = []
|
entities: list[Entity] = []
|
||||||
person: RachioPerson = hass.data[DOMAIN_RACHIO][config_entry.entry_id]
|
person: RachioPerson = hass.data[DOMAIN][config_entry.entry_id]
|
||||||
# Fetch the schedule once at startup
|
# Fetch the schedule once at startup
|
||||||
# in order to avoid every zone doing it
|
# in order to avoid every zone doing it
|
||||||
for controller in person.controllers:
|
for controller in person.controllers:
|
||||||
|
@ -52,7 +52,7 @@ from homeassistant.helpers.event import async_call_later
|
|||||||
from . import UnjoinData, media_browser
|
from . import UnjoinData, media_browser
|
||||||
from .const import (
|
from .const import (
|
||||||
DATA_SONOS,
|
DATA_SONOS,
|
||||||
DOMAIN as SONOS_DOMAIN,
|
DOMAIN,
|
||||||
MEDIA_TYPES_TO_SONOS,
|
MEDIA_TYPES_TO_SONOS,
|
||||||
MODELS_LINEIN_AND_TV,
|
MODELS_LINEIN_AND_TV,
|
||||||
MODELS_LINEIN_ONLY,
|
MODELS_LINEIN_ONLY,
|
||||||
@ -119,7 +119,7 @@ async def async_setup_entry(
|
|||||||
_LOGGER.debug("Creating media_player on %s", speaker.zone_name)
|
_LOGGER.debug("Creating media_player on %s", speaker.zone_name)
|
||||||
async_add_entities([SonosMediaPlayerEntity(speaker)])
|
async_add_entities([SonosMediaPlayerEntity(speaker)])
|
||||||
|
|
||||||
@service.verify_domain_control(hass, SONOS_DOMAIN)
|
@service.verify_domain_control(hass, DOMAIN)
|
||||||
async def async_service_handle(service_call: ServiceCall) -> None:
|
async def async_service_handle(service_call: ServiceCall) -> None:
|
||||||
"""Handle dispatched services."""
|
"""Handle dispatched services."""
|
||||||
assert platform is not None
|
assert platform is not None
|
||||||
@ -151,11 +151,11 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.async_register(
|
||||||
SONOS_DOMAIN, SERVICE_SNAPSHOT, async_service_handle, join_unjoin_schema
|
DOMAIN, SERVICE_SNAPSHOT, async_service_handle, join_unjoin_schema
|
||||||
)
|
)
|
||||||
|
|
||||||
hass.services.async_register(
|
hass.services.async_register(
|
||||||
SONOS_DOMAIN, SERVICE_RESTORE, async_service_handle, join_unjoin_schema
|
DOMAIN, SERVICE_RESTORE, async_service_handle, join_unjoin_schema
|
||||||
)
|
)
|
||||||
|
|
||||||
platform.async_register_entity_service(
|
platform.async_register_entity_service(
|
||||||
@ -448,7 +448,7 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
|||||||
|
|
||||||
if len(fav) != 1:
|
if len(fav) != 1:
|
||||||
raise ServiceValidationError(
|
raise ServiceValidationError(
|
||||||
translation_domain=SONOS_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="invalid_favorite",
|
translation_key="invalid_favorite",
|
||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"name": name,
|
"name": name,
|
||||||
@ -577,7 +577,7 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise HomeAssistantError(
|
raise HomeAssistantError(
|
||||||
translation_domain=SONOS_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="announce_media_error",
|
translation_key="announce_media_error",
|
||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"media_id": media_id,
|
"media_id": media_id,
|
||||||
@ -684,7 +684,7 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
|||||||
playlist = next((p for p in playlists if p.title == media_id), None)
|
playlist = next((p for p in playlists if p.title == media_id), None)
|
||||||
if not playlist:
|
if not playlist:
|
||||||
raise ServiceValidationError(
|
raise ServiceValidationError(
|
||||||
translation_domain=SONOS_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="invalid_sonos_playlist",
|
translation_key="invalid_sonos_playlist",
|
||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"name": media_id,
|
"name": media_id,
|
||||||
@ -697,7 +697,7 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
|||||||
item = media_browser.get_media(self.media.library, media_id, media_type)
|
item = media_browser.get_media(self.media.library, media_id, media_type)
|
||||||
if not item:
|
if not item:
|
||||||
raise ServiceValidationError(
|
raise ServiceValidationError(
|
||||||
translation_domain=SONOS_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="invalid_media",
|
translation_key="invalid_media",
|
||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"media_id": media_id,
|
"media_id": media_id,
|
||||||
@ -706,7 +706,7 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
|
|||||||
self._play_media_queue(soco, item, enqueue)
|
self._play_media_queue(soco, item, enqueue)
|
||||||
else:
|
else:
|
||||||
raise ServiceValidationError(
|
raise ServiceValidationError(
|
||||||
translation_domain=SONOS_DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
translation_key="invalid_content_type",
|
translation_key="invalid_content_type",
|
||||||
translation_placeholders={
|
translation_placeholders={
|
||||||
"media_type": media_type,
|
"media_type": media_type,
|
||||||
|
@ -20,7 +20,7 @@ from homeassistant.helpers.event import async_track_time_change
|
|||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
DATA_SONOS,
|
DATA_SONOS,
|
||||||
DOMAIN as SONOS_DOMAIN,
|
DOMAIN,
|
||||||
SONOS_ALARMS_UPDATED,
|
SONOS_ALARMS_UPDATED,
|
||||||
SONOS_CREATE_ALARM,
|
SONOS_CREATE_ALARM,
|
||||||
SONOS_CREATE_SWITCHES,
|
SONOS_CREATE_SWITCHES,
|
||||||
@ -276,7 +276,7 @@ class SonosAlarmEntity(SonosEntity, SwitchEntity):
|
|||||||
|
|
||||||
new_device = device_registry.async_get_or_create(
|
new_device = device_registry.async_get_or_create(
|
||||||
config_entry_id=cast(str, entity.config_entry_id),
|
config_entry_id=cast(str, entity.config_entry_id),
|
||||||
identifiers={(SONOS_DOMAIN, self.soco.uid)},
|
identifiers={(DOMAIN, self.soco.uid)},
|
||||||
connections={(dr.CONNECTION_NETWORK_MAC, self.speaker.mac_address)},
|
connections={(dr.CONNECTION_NETWORK_MAC, self.speaker.mac_address)},
|
||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
|
@ -56,7 +56,7 @@ from .const import (
|
|||||||
CONF_TRACK_DEVICES,
|
CONF_TRACK_DEVICES,
|
||||||
CONF_TRACK_WIRED_CLIENTS,
|
CONF_TRACK_WIRED_CLIENTS,
|
||||||
DEFAULT_DPI_RESTRICTIONS,
|
DEFAULT_DPI_RESTRICTIONS,
|
||||||
DOMAIN as UNIFI_DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
from .errors import AuthenticationRequired, CannotConnect
|
from .errors import AuthenticationRequired, CannotConnect
|
||||||
from .hub import UnifiHub, get_unifi_api
|
from .hub import UnifiHub, get_unifi_api
|
||||||
@ -72,7 +72,7 @@ MODEL_PORTS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class UnifiFlowHandler(ConfigFlow, domain=UNIFI_DOMAIN):
|
class UnifiFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a UniFi Network config flow."""
|
"""Handle a UniFi Network config flow."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user