From 7643f52d73dad01c6477511405188935d13fa372 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 8 Oct 2026 14:34:09 +0200 Subject: [PATCH] Move intent_script service registration to services module (#184882) Co-authored-by: Claude Opus 5.5 --- .../components/intent_script/__init__.py | 19 +++++---------- .../components/intent_script/services.py | 23 +++++++++++++++++++ 2 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 homeassistant/components/intent_script/services.py diff --git a/homeassistant/components/intent_script/__init__.py b/homeassistant/components/intent_script/__init__.py index fab0427d2acb..2c55b41f09d8 100644 --- a/homeassistant/components/intent_script/__init__.py +++ b/homeassistant/components/intent_script/__init__.py @@ -3,9 +3,9 @@ import probatio from homeassistant.components.script import CONF_MODE -from homeassistant.const import CONF_ACTION, CONF_DESCRIPTION, CONF_TYPE, SERVICE_RELOAD -from homeassistant.core import HomeAssistant, ServiceCall -from homeassistant.helpers import config_validation as cv, script, service +from homeassistant.const import CONF_ACTION, CONF_DESCRIPTION, CONF_TYPE +from homeassistant.core import HomeAssistant +from homeassistant.helpers import config_validation as cv, script from homeassistant.helpers.typing import ConfigType from .const import ( @@ -20,7 +20,8 @@ from .const import ( DEFAULT_CONF_ASYNC_ACTION, DOMAIN, ) -from .helpers import async_load_intents, async_reload +from .helpers import async_load_intents +from .services import async_setup_services CONFIG_SCHEMA = probatio.Schema( { @@ -63,14 +64,6 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: await async_load_intents(hass, intents) - async def _handle_reload(service_call: ServiceCall) -> None: - return await async_reload(hass, service_call) - - service.async_register_admin_service( - hass, - DOMAIN, - SERVICE_RELOAD, - _handle_reload, - ) + async_setup_services(hass) return True diff --git a/homeassistant/components/intent_script/services.py b/homeassistant/components/intent_script/services.py new file mode 100644 index 000000000000..754a9a974cef --- /dev/null +++ b/homeassistant/components/intent_script/services.py @@ -0,0 +1,23 @@ +"""Services for the intent_script integration.""" + +from homeassistant.const import SERVICE_RELOAD +from homeassistant.core import HomeAssistant, ServiceCall, callback +from homeassistant.helpers.service import async_register_admin_service + +from .const import DOMAIN +from .helpers import async_reload + + +async def _handle_reload(service_call: ServiceCall) -> None: + return await async_reload(service_call.hass, service_call) + + +@callback +def async_setup_services(hass: HomeAssistant) -> None: + """Set up the services for the intent_script integration.""" + async_register_admin_service( + hass, + DOMAIN, + SERVICE_RELOAD, + _handle_reload, + )