From e6bcaa112748d72283a0fe8c8f0dacb803ae5003 Mon Sep 17 00:00:00 2001 From: Michiel De Wilde Date: Tue, 22 Apr 2025 18:11:23 +0200 Subject: [PATCH] Deprecation fix: use async_register_admin_service This fixes the following reported issue: Detected that custom integration 'localtuya' accesses hass.helpers.service, which should be updated to import functions used from service directly at custom_components/localtuya/__init__.py, line 165: hass.helpers.service.async_register_admin_service(. This will stop working in Home Assistant 2025.5, please create a bug report at https://github.com/rospogrigio/localtuya/issues --- custom_components/localtuya/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/localtuya/__init__.py b/custom_components/localtuya/__init__.py index 35a2adb..2f0e0fc 100644 --- a/custom_components/localtuya/__init__.py +++ b/custom_components/localtuya/__init__.py @@ -26,6 +26,7 @@ from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.device_registry import DeviceEntry from homeassistant.helpers.event import async_track_time_interval +from homeassistant.helpers.service import async_register_admin_service from .cloud_api import TuyaCloudApi from .common import TuyaDevice, async_config_entry_by_device_id @@ -162,7 +163,8 @@ async def async_setup(hass: HomeAssistant, config: dict): async_track_time_interval(hass, _async_reconnect, RECONNECT_INTERVAL) - hass.helpers.service.async_register_admin_service( + async_register_admin_service( + hass, DOMAIN, SERVICE_RELOAD, _handle_reload,