Move service registration to async_setup in icloud (#146095)

This commit is contained in:
epenet 2025-06-03 10:40:48 +02:00 committed by GitHub
parent 40e0c0f98d
commit 0bd287788c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,19 +6,32 @@ from typing import Any
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.storage import Store from homeassistant.helpers.storage import Store
from homeassistant.helpers.typing import ConfigType
from .account import IcloudAccount, IcloudConfigEntry from .account import IcloudAccount, IcloudConfigEntry
from .const import ( from .const import (
CONF_GPS_ACCURACY_THRESHOLD, CONF_GPS_ACCURACY_THRESHOLD,
CONF_MAX_INTERVAL, CONF_MAX_INTERVAL,
CONF_WITH_FAMILY, CONF_WITH_FAMILY,
DOMAIN,
PLATFORMS, PLATFORMS,
STORAGE_KEY, STORAGE_KEY,
STORAGE_VERSION, STORAGE_VERSION,
) )
from .services import register_services from .services import register_services
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up iCloud integration."""
register_services(hass)
return True
async def async_setup_entry(hass: HomeAssistant, entry: IcloudConfigEntry) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: IcloudConfigEntry) -> bool:
"""Set up an iCloud account from a config entry.""" """Set up an iCloud account from a config entry."""
@ -51,8 +64,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: IcloudConfigEntry) -> bo
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
register_services(hass)
return True return True