diff --git a/homeassistant/components/bosch_alarm/__init__.py b/homeassistant/components/bosch_alarm/__init__.py index 7f37476f1bb..c442c921a6b 100644 --- a/homeassistant/components/bosch_alarm/__init__.py +++ b/homeassistant/components/bosch_alarm/__init__.py @@ -14,7 +14,7 @@ from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.typing import ConfigType from .const import CONF_INSTALLER_CODE, CONF_USER_CODE, DOMAIN -from .services import setup_services +from .services import async_setup_services from .types import BoschAlarmConfigEntry CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) @@ -29,7 +29,7 @@ PLATFORMS: list[Platform] = [ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up bosch alarm services.""" - setup_services(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/bosch_alarm/services.py b/homeassistant/components/bosch_alarm/services.py index 5d9a5f5645f..acdecbda305 100644 --- a/homeassistant/components/bosch_alarm/services.py +++ b/homeassistant/components/bosch_alarm/services.py @@ -9,7 +9,7 @@ from typing import Any import voluptuous as vol from homeassistant.config_entries import ConfigEntryState -from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.helpers import config_validation as cv from homeassistant.util import dt as dt_util @@ -66,7 +66,8 @@ async def async_set_panel_date(call: ServiceCall) -> None: ) from err -def setup_services(hass: HomeAssistant) -> None: +@callback +def async_setup_services(hass: HomeAssistant) -> None: """Set up the services for the bosch alarm integration.""" hass.services.async_register( diff --git a/homeassistant/components/dynalite/__init__.py b/homeassistant/components/dynalite/__init__.py index 3411882b725..1eb6b4f2e44 100644 --- a/homeassistant/components/dynalite/__init__.py +++ b/homeassistant/components/dynalite/__init__.py @@ -12,7 +12,7 @@ from .bridge import DynaliteBridge from .const import DOMAIN, LOGGER, PLATFORMS from .convert_config import convert_config from .panel import async_register_dynalite_frontend -from .services import setup_services +from .services import async_setup_services CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) @@ -21,7 +21,7 @@ type DynaliteConfigEntry = ConfigEntry[DynaliteBridge] async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Dynalite platform.""" - setup_services(hass) + async_setup_services(hass) await async_register_dynalite_frontend(hass) diff --git a/homeassistant/components/dynalite/services.py b/homeassistant/components/dynalite/services.py index d0d57a582b4..2621df61853 100644 --- a/homeassistant/components/dynalite/services.py +++ b/homeassistant/components/dynalite/services.py @@ -50,7 +50,7 @@ async def _request_channel_level(service_call: ServiceCall) -> None: @callback -def setup_services(hass: HomeAssistant) -> None: +def async_setup_services(hass: HomeAssistant) -> None: """Set up the Dynalite platform.""" hass.services.async_register( DOMAIN, diff --git a/homeassistant/components/guardian/__init__.py b/homeassistant/components/guardian/__init__.py index 65f5525d587..192cb62f5df 100644 --- a/homeassistant/components/guardian/__init__.py +++ b/homeassistant/components/guardian/__init__.py @@ -27,7 +27,7 @@ from .const import ( SIGNAL_PAIRED_SENSOR_COORDINATOR_ADDED, ) from .coordinator import GuardianDataUpdateCoordinator -from .services import setup_services +from .services import async_setup_services CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) @@ -55,7 +55,7 @@ class GuardianData: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Elexa Guardian component.""" - setup_services(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/guardian/services.py b/homeassistant/components/guardian/services.py index 288c6becbee..927be7c54a5 100644 --- a/homeassistant/components/guardian/services.py +++ b/homeassistant/components/guardian/services.py @@ -122,8 +122,9 @@ async def async_upgrade_firmware(call: ServiceCall, data: GuardianData) -> None: ) -def setup_services(hass: HomeAssistant) -> None: - """Register the Renault services.""" +@callback +def async_setup_services(hass: HomeAssistant) -> None: + """Register the guardian services.""" for service_name, schema, method in ( ( SERVICE_NAME_PAIR_SENSOR, diff --git a/homeassistant/components/heos/__init__.py b/homeassistant/components/heos/__init__.py index 4df1a2fa0e1..54510540f2a 100644 --- a/homeassistant/components/heos/__init__.py +++ b/homeassistant/components/heos/__init__.py @@ -9,9 +9,9 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, device_registry as dr from homeassistant.helpers.typing import ConfigType -from . import services from .const import DOMAIN from .coordinator import HeosConfigEntry, HeosCoordinator +from .services import async_setup_services PLATFORMS = [Platform.MEDIA_PLAYER] @@ -22,7 +22,7 @@ CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN) async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the HEOS component.""" - services.register(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/heos/services.py b/homeassistant/components/heos/services.py index 86c6f6d0533..e42e2bf27a2 100644 --- a/homeassistant/components/heos/services.py +++ b/homeassistant/components/heos/services.py @@ -9,7 +9,7 @@ import voluptuous as vol from homeassistant.components.media_player import ATTR_MEDIA_VOLUME_LEVEL from homeassistant.config_entries import ConfigEntryState -from homeassistant.core import HomeAssistant, ServiceCall, SupportsResponse +from homeassistant.core import HomeAssistant, ServiceCall, SupportsResponse, callback from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.helpers import ( config_validation as cv, @@ -44,7 +44,8 @@ HEOS_SIGN_IN_SCHEMA = vol.Schema( HEOS_SIGN_OUT_SCHEMA = vol.Schema({}) -def register(hass: HomeAssistant) -> None: +@callback +def async_setup_services(hass: HomeAssistant) -> None: """Register HEOS services.""" hass.services.async_register( DOMAIN, diff --git a/homeassistant/components/home_connect/__init__.py b/homeassistant/components/home_connect/__init__.py index 01f2acd1851..4a48d1f1ad7 100644 --- a/homeassistant/components/home_connect/__init__.py +++ b/homeassistant/components/home_connect/__init__.py @@ -23,7 +23,7 @@ from homeassistant.helpers.typing import ConfigType from .api import AsyncConfigEntryAuth from .const import DOMAIN, OLD_NEW_UNIQUE_ID_SUFFIX_MAP from .coordinator import HomeConnectConfigEntry, HomeConnectCoordinator -from .services import register_actions +from .services import async_setup_services _LOGGER = logging.getLogger(__name__) @@ -43,7 +43,7 @@ PLATFORMS = [ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up Home Connect component.""" - register_actions(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/home_connect/services.py b/homeassistant/components/home_connect/services.py index fac1c5fe1a9..09c2f4a967d 100644 --- a/homeassistant/components/home_connect/services.py +++ b/homeassistant/components/home_connect/services.py @@ -18,7 +18,7 @@ from aiohomeconnect.model.error import HomeConnectError import voluptuous as vol from homeassistant.const import ATTR_DEVICE_ID -from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.helpers import config_validation as cv, device_registry as dr from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue @@ -522,7 +522,8 @@ async def async_service_start_program(call: ServiceCall) -> None: await _async_service_program(call, True) -def register_actions(hass: HomeAssistant) -> None: +@callback +def async_setup_services(hass: HomeAssistant) -> None: """Register custom actions.""" hass.services.async_register( diff --git a/homeassistant/components/knx/__init__.py b/homeassistant/components/knx/__init__.py index 8ad16642e45..470f7891292 100644 --- a/homeassistant/components/knx/__init__.py +++ b/homeassistant/components/knx/__init__.py @@ -91,7 +91,7 @@ from .schema import ( TimeSchema, WeatherSchema, ) -from .services import register_knx_services +from .services import async_setup_services from .storage.config_store import STORAGE_KEY as CONFIG_STORAGE_KEY, KNXConfigStore from .telegrams import STORAGE_KEY as TELEGRAMS_STORAGE_KEY, Telegrams from .websocket import register_panel @@ -138,7 +138,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: if (conf := config.get(DOMAIN)) is not None: hass.data[_KNX_YAML_CONFIG] = dict(conf) - register_knx_services(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/knx/services.py b/homeassistant/components/knx/services.py index 7b8c7ec2371..04803e140fd 100644 --- a/homeassistant/components/knx/services.py +++ b/homeassistant/components/knx/services.py @@ -41,7 +41,7 @@ _LOGGER = logging.getLogger(__name__) @callback -def register_knx_services(hass: HomeAssistant) -> None: +def async_setup_services(hass: HomeAssistant) -> None: """Register KNX integration services.""" hass.services.async_register( DOMAIN, diff --git a/homeassistant/components/matrix/__init__.py b/homeassistant/components/matrix/__init__.py index 85f08bb4d87..f523de71f6a 100644 --- a/homeassistant/components/matrix/__init__.py +++ b/homeassistant/components/matrix/__init__.py @@ -45,7 +45,7 @@ from homeassistant.helpers.typing import ConfigType from homeassistant.util.json import JsonObjectType, load_json_object from .const import ATTR_FORMAT, ATTR_IMAGES, CONF_ROOMS_REGEX, DOMAIN, FORMAT_HTML -from .services import register_services +from .services import async_setup_services _LOGGER = logging.getLogger(__name__) @@ -128,7 +128,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: config[CONF_COMMANDS], ) - register_services(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/matrix/services.py b/homeassistant/components/matrix/services.py index edd312348d6..f89a9e7b7fc 100644 --- a/homeassistant/components/matrix/services.py +++ b/homeassistant/components/matrix/services.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING import voluptuous as vol from homeassistant.components.notify import ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET -from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import config_validation as cv from .const import ( @@ -50,7 +50,8 @@ async def _handle_send_message(call: ServiceCall) -> None: await matrix_bot.handle_send_message(call) -def register_services(hass: HomeAssistant) -> None: +@callback +def async_setup_services(hass: HomeAssistant) -> None: """Set up the Matrix bot component.""" hass.services.async_register( diff --git a/homeassistant/components/renault/__init__.py b/homeassistant/components/renault/__init__.py index 48bab1f5c8b..da3769654c4 100644 --- a/homeassistant/components/renault/__init__.py +++ b/homeassistant/components/renault/__init__.py @@ -12,7 +12,7 @@ from homeassistant.helpers.typing import ConfigType from .const import CONF_LOCALE, DOMAIN, PLATFORMS from .renault_hub import RenaultHub -from .services import setup_services +from .services import async_setup_services CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) type RenaultConfigEntry = ConfigEntry[RenaultHub] @@ -20,7 +20,7 @@ type RenaultConfigEntry = ConfigEntry[RenaultHub] async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Renault component.""" - setup_services(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/renault/services.py b/homeassistant/components/renault/services.py index dfad97ae4ea..df85ad57f66 100644 --- a/homeassistant/components/renault/services.py +++ b/homeassistant/components/renault/services.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any import voluptuous as vol -from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.exceptions import ServiceValidationError from homeassistant.helpers import config_validation as cv, device_registry as dr @@ -191,7 +191,8 @@ def get_vehicle_proxy(service_call: ServiceCall) -> RenaultVehicleProxy: ) -def setup_services(hass: HomeAssistant) -> None: +@callback +def async_setup_services(hass: HomeAssistant) -> None: """Register the Renault services.""" hass.services.async_register( diff --git a/homeassistant/components/velbus/__init__.py b/homeassistant/components/velbus/__init__.py index 35c61892964..055fd5e2277 100644 --- a/homeassistant/components/velbus/__init__.py +++ b/homeassistant/components/velbus/__init__.py @@ -20,7 +20,7 @@ from homeassistant.helpers.storage import STORAGE_DIR from homeassistant.helpers.typing import ConfigType from .const import DOMAIN -from .services import setup_services +from .services import async_setup_services _LOGGER = logging.getLogger(__name__) @@ -91,7 +91,7 @@ def _migrate_device_identifiers(hass: HomeAssistant, entry_id: str) -> None: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the actions for the Velbus component.""" - setup_services(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/velbus/services.py b/homeassistant/components/velbus/services.py index 765c5a0f674..5fccbcaf82e 100644 --- a/homeassistant/components/velbus/services.py +++ b/homeassistant/components/velbus/services.py @@ -11,7 +11,7 @@ import voluptuous as vol from homeassistant.config_entries import ConfigEntryState from homeassistant.const import CONF_ADDRESS -from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.exceptions import ServiceValidationError from homeassistant.helpers import config_validation as cv, selector from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue @@ -32,7 +32,8 @@ from .const import ( ) -def setup_services(hass: HomeAssistant) -> None: +@callback +def async_setup_services(hass: HomeAssistant) -> None: """Register the velbus services.""" def check_entry_id(interface: str) -> str: diff --git a/homeassistant/components/zoneminder/__init__.py b/homeassistant/components/zoneminder/__init__.py index 241c2729653..27b69a8d62d 100644 --- a/homeassistant/components/zoneminder/__init__.py +++ b/homeassistant/components/zoneminder/__init__.py @@ -21,7 +21,7 @@ from homeassistant.helpers.discovery import async_load_platform from homeassistant.helpers.typing import ConfigType from .const import DOMAIN -from .services import register_services +from .services import async_setup_services _LOGGER = logging.getLogger(__name__) @@ -81,7 +81,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: ex, ) - register_services(hass) + async_setup_services(hass) hass.async_create_task( async_load_platform(hass, Platform.BINARY_SENSOR, DOMAIN, {}, config) diff --git a/homeassistant/components/zoneminder/services.py b/homeassistant/components/zoneminder/services.py index 14ce873ec14..53847213c85 100644 --- a/homeassistant/components/zoneminder/services.py +++ b/homeassistant/components/zoneminder/services.py @@ -5,7 +5,7 @@ import logging import voluptuous as vol from homeassistant.const import ATTR_ID, ATTR_NAME -from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import config_validation as cv from .const import DOMAIN @@ -32,7 +32,8 @@ def _set_active_state(call: ServiceCall) -> None: ) -def register_services(hass: HomeAssistant) -> None: +@callback +def async_setup_services(hass: HomeAssistant) -> None: """Register ZoneMinder services.""" hass.services.async_register(