mirror of
https://github.com/home-assistant/core.git
synced 2026-09-13 04:01:03 +01:00
Align service registration method in services module (#181151)
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user