Update components

This commit is contained in:
epenet 2025-07-02 11:02:23 +00:00
parent 07b953d6d4
commit 0052a1a336
8 changed files with 11 additions and 23 deletions

View File

@ -162,12 +162,12 @@ def setup_service_functions(
It appears that all TCC-compatible systems support the same three zones modes. It appears that all TCC-compatible systems support the same three zones modes.
""" """
@verify_domain_control(hass, DOMAIN) @verify_domain_control(DOMAIN)
async def force_refresh(call: ServiceCall) -> None: async def force_refresh(call: ServiceCall) -> None:
"""Obtain the latest state data via the vendor's RESTful API.""" """Obtain the latest state data via the vendor's RESTful API."""
await coordinator.async_refresh() await coordinator.async_refresh()
@verify_domain_control(hass, DOMAIN) @verify_domain_control(DOMAIN)
async def set_system_mode(call: ServiceCall) -> None: async def set_system_mode(call: ServiceCall) -> None:
"""Set the system mode.""" """Set the system mode."""
assert coordinator.tcs is not None # mypy assert coordinator.tcs is not None # mypy
@ -179,7 +179,7 @@ def setup_service_functions(
} }
async_dispatcher_send(hass, DOMAIN, payload) async_dispatcher_send(hass, DOMAIN, payload)
@verify_domain_control(hass, DOMAIN) @verify_domain_control(DOMAIN)
async def set_zone_override(call: ServiceCall) -> None: async def set_zone_override(call: ServiceCall) -> None:
"""Set the zone override (setpoint).""" """Set the zone override (setpoint)."""
entity_id = call.data[ATTR_ENTITY_ID] entity_id = call.data[ATTR_ENTITY_ID]

View File

@ -124,7 +124,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: GeniusHubConfigEntry) ->
def setup_service_functions(hass: HomeAssistant, broker): def setup_service_functions(hass: HomeAssistant, broker):
"""Set up the service functions.""" """Set up the service functions."""
@verify_domain_control(hass, DOMAIN) @verify_domain_control(DOMAIN)
async def set_zone_mode(call: ServiceCall) -> None: async def set_zone_mode(call: ServiceCall) -> None:
"""Set the system mode.""" """Set the system mode."""
entity_id = call.data[ATTR_ENTITY_ID] entity_id = call.data[ATTR_ENTITY_ID]

View File

@ -124,7 +124,7 @@ SCHEMA_SET_HOME_COOLING_MODE = vol.Schema(
def async_setup_services(hass: HomeAssistant) -> None: def async_setup_services(hass: HomeAssistant) -> None:
"""Set up the HomematicIP Cloud services.""" """Set up the HomematicIP Cloud services."""
@verify_domain_control(hass, DOMAIN) @verify_domain_control(DOMAIN)
async def async_call_hmipc_service(service: ServiceCall) -> None: async def async_call_hmipc_service(service: ServiceCall) -> None:
"""Call correct HomematicIP Cloud service.""" """Call correct HomematicIP Cloud service."""
service_name = service.service service_name = service.service

View File

@ -64,7 +64,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
hass.services.async_register( hass.services.async_register(
DOMAIN, DOMAIN,
SERVICE_HUE_ACTIVATE_SCENE, SERVICE_HUE_ACTIVATE_SCENE,
verify_domain_control(hass, DOMAIN)(hue_activate_scene), verify_domain_control(DOMAIN)(hue_activate_scene),
schema=vol.Schema( schema=vol.Schema(
{ {
vol.Required(ATTR_GROUP_NAME): cv.string, vol.Required(ATTR_GROUP_NAME): cv.string,

View File

@ -89,7 +89,7 @@ async def async_setup_entry(
elif service_call.service == SERVICE_RESTORE: elif service_call.service == SERVICE_RESTORE:
entity.restore() entity.restore()
@service.verify_domain_control(hass, DOMAIN) @service.verify_domain_control(DOMAIN)
async def async_service_handle(service_call: core.ServiceCall) -> None: async def async_service_handle(service_call: core.ServiceCall) -> None:
"""Handle for services.""" """Handle for services."""
entities = await platform.async_extract_from_service(service_call) entities = await platform.async_extract_from_service(service_call)

View File

@ -290,7 +290,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up SimpliSafe as config entry.""" """Set up SimpliSafe as config entry."""
_async_standardize_config_entry(hass, entry) _async_standardize_config_entry(hass, entry)
_verify_domain_control = verify_domain_control(hass, DOMAIN) _verify_domain_control = verify_domain_control(DOMAIN)
websession = aiohttp_client.async_get_clientsession(hass) websession = aiohttp_client.async_get_clientsession(hass)
try: try:

View File

@ -126,7 +126,7 @@ async def async_setup_entry(
_LOGGER.debug("Creating media_player on %s", speaker.zone_name) _LOGGER.debug("Creating media_player on %s", speaker.zone_name)
async_add_entities([SonosMediaPlayerEntity(speaker, config_entry)]) async_add_entities([SonosMediaPlayerEntity(speaker, config_entry)])
@service.verify_domain_control(hass, DOMAIN) @service.verify_domain_control(DOMAIN)
async def async_service_handle(service_call: ServiceCall) -> None: async def async_service_handle(service_call: ServiceCall) -> None:
"""Handle dispatched services.""" """Handle dispatched services."""
assert platform is not None assert platform is not None

View File

@ -9,7 +9,7 @@ from enum import Enum
from functools import cache, partial from functools import cache, partial
import logging import logging
from types import ModuleType from types import ModuleType
from typing import TYPE_CHECKING, Any, TypedDict, cast, overload, override from typing import TYPE_CHECKING, Any, TypedDict, cast, override
import voluptuous as vol import voluptuous as vol
@ -986,19 +986,7 @@ def async_register_admin_service(
) )
# Overloads can be dropped when all core calls have been updated to drop hass argument @deprecate_hass_binding(breaks_in_ha_version="2026.2")
@overload
def verify_domain_control(
domain: str,
) -> Callable[[Callable[[ServiceCall], Any]], Callable[[ServiceCall], Any]]: ...
@overload
def verify_domain_control(
hass: HomeAssistant,
domain: str,
) -> Callable[[Callable[[ServiceCall], Any]], Callable[[ServiceCall], Any]]: ...
@deprecate_hass_binding(breaks_in_ha_version="2026.2") # type: ignore[misc]
@callback @callback
def verify_domain_control( def verify_domain_control(
domain: str, domain: str,