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
This commit is contained in:
Michiel De Wilde
2025-04-22 18:11:23 +02:00
committed by rospogrigio
parent 5f2c027c1e
commit e6bcaa1127

View File

@@ -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,