From 298249854cfdb6ff84b2d2fbbe33ec049e62665e Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 3 Sep 2026 13:23:25 +0200 Subject: [PATCH] Align service registration method in services module (#181151) --- homeassistant/components/backup/services.py | 3 ++- homeassistant/components/evohome/__init__.py | 4 ++-- homeassistant/components/evohome/services.py | 4 ++-- homeassistant/components/geniushub/__init__.py | 4 ++-- homeassistant/components/geniushub/services.py | 4 ++-- homeassistant/components/green_planet_energy/services.py | 2 ++ 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/backup/services.py b/homeassistant/components/backup/services.py index 192a2f3c1714..25cf0b19859c 100644 --- a/homeassistant/components/backup/services.py +++ b/homeassistant/components/backup/services.py @@ -1,6 +1,6 @@ """The Backup integration.""" -from homeassistant.core import HomeAssistant, ServiceCall +from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers.hassio import is_hassio from homeassistant.helpers.service import async_register_admin_service @@ -28,6 +28,7 @@ async def _async_handle_create_automatic_service(call: ServiceCall) -> None: await call.hass.data[DATA_MANAGER].async_create_automatic_backup() +@callback def async_setup_services(hass: HomeAssistant) -> None: """Register services.""" if not is_hassio(hass): diff --git a/homeassistant/components/evohome/__init__.py b/homeassistant/components/evohome/__init__.py index 70933f3470ed..3ab854e9992b 100644 --- a/homeassistant/components/evohome/__init__.py +++ b/homeassistant/components/evohome/__init__.py @@ -34,7 +34,7 @@ from .const import ( SCAN_INTERVAL_MINIMUM, ) from .coordinator import EvoDataUpdateCoordinator -from .services import setup_service_functions +from .services import async_setup_services from .storage import TokenManager _LOGGER = logging.getLogger(__name__) @@ -110,6 +110,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: async_load_platform(hass, Platform.WATER_HEATER, DOMAIN, {}, config) ) - setup_service_functions(hass, coordinator) + async_setup_services(hass, coordinator) return True diff --git a/homeassistant/components/evohome/services.py b/homeassistant/components/evohome/services.py index 1c4e1344bd18..6286b7c51df5 100644 --- a/homeassistant/components/evohome/services.py +++ b/homeassistant/components/evohome/services.py @@ -204,10 +204,10 @@ def _validate_set_system_mode_params(tcs: ControlSystem, data: dict[str, Any]) - @callback -def setup_service_functions( +def async_setup_services( hass: HomeAssistant, coordinator: EvoDataUpdateCoordinator ) -> None: - """Set up the service handlers for Evohome systems.""" + """Register the Evohome services.""" @verify_domain_control(DOMAIN) async def force_refresh(call: ServiceCall) -> None: diff --git a/homeassistant/components/geniushub/__init__.py b/homeassistant/components/geniushub/__init__.py index e3ce4bd21438..bcff5a34f818 100644 --- a/homeassistant/components/geniushub/__init__.py +++ b/homeassistant/components/geniushub/__init__.py @@ -23,7 +23,7 @@ from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.typing import ConfigType from .const import DOMAIN -from .services import setup_service_functions +from .services import async_setup_services _LOGGER = logging.getLogger(__name__) @@ -48,7 +48,7 @@ CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up Genius Hub services.""" - setup_service_functions(hass) + async_setup_services(hass) return True diff --git a/homeassistant/components/geniushub/services.py b/homeassistant/components/geniushub/services.py index 545b925d85ac..f21b0bd2276f 100644 --- a/homeassistant/components/geniushub/services.py +++ b/homeassistant/components/geniushub/services.py @@ -41,8 +41,8 @@ SET_ZONE_OVERRIDE_SCHEMA = vol.Schema( @callback -def setup_service_functions(hass: HomeAssistant) -> None: - """Set up the service functions.""" +def async_setup_services(hass: HomeAssistant) -> None: + """Register the Genius Hub services.""" @verify_domain_control(DOMAIN) async def set_zone_mode(call: ServiceCall) -> None: diff --git a/homeassistant/components/green_planet_energy/services.py b/homeassistant/components/green_planet_energy/services.py index 25f43f1cbb73..0e8260fa99ee 100644 --- a/homeassistant/components/green_planet_energy/services.py +++ b/homeassistant/components/green_planet_energy/services.py @@ -11,6 +11,7 @@ from homeassistant.core import ( ServiceCall, ServiceResponse, SupportsResponse, + callback, ) from homeassistant.exceptions import ServiceValidationError from homeassistant.helpers.selector import ConfigEntrySelector @@ -177,6 +178,7 @@ async def get_prices(call: ServiceCall) -> ServiceResponse: } +@callback def async_setup_services(hass: HomeAssistant) -> None: """Set up services for Green Planet Energy."""