Rename services module in switchbot_cloud (#181152)

This commit is contained in:
epenet
2026-09-03 13:26:16 +02:00
committed by GitHub
parent 0c0e24dbbe
commit b3f43dea4a
2 changed files with 7 additions and 6 deletions
@@ -28,7 +28,7 @@ from homeassistant.helpers.typing import ConfigType
from .const import CONF_CLOUDHOOK_URL, DEVICE_SUPPORT_MAP, DOMAIN, ENTRY_TITLE
from .coordinator import SwitchBotCoordinator
from .service import async_register_services
from .services import async_setup_services
CONFIG_SCHEMA = cv.config_entry_only_config_schema("switchbot_cloud")
@@ -280,7 +280,7 @@ async def make_new_device_data(
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Switchbot Cloud."""
async_register_services(hass)
async_setup_services(hass)
return True
@@ -1,11 +1,11 @@
"""SwitchBot Cloud Custom Service."""
"""Support for SwitchBot Cloud services."""
from logging import getLogger
from switchbot_api import ArtFrameCommands
import voluptuous as vol
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.core import HomeAssistant, ServiceCall, callback
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import config_validation as cv, service
@@ -49,8 +49,9 @@ async def handle_upload_image(call: ServiceCall) -> None:
)
def async_register_services(hass: HomeAssistant) -> None:
"""Async register services."""
@callback
def async_setup_services(hass: HomeAssistant) -> None:
"""Register the SwitchBot Cloud services."""
hass.services.async_register(
DOMAIN,
AI_ART_FRAME_UPLOAD_IMAGE_SERVICE,