diff --git a/homeassistant/components/zwave_js/lock.py b/homeassistant/components/zwave_js/lock.py index 437ebf509a5..37923c49832 100644 --- a/homeassistant/components/zwave_js/lock.py +++ b/homeassistant/components/zwave_js/lock.py @@ -71,7 +71,7 @@ async def async_setup_entry( platform = entity_platform.current_platform.get() assert platform - platform.async_register_entity_service( # type: ignore + platform.async_register_entity_service( SERVICE_SET_LOCK_USERCODE, { vol.Required(ATTR_CODE_SLOT): vol.Coerce(int), @@ -80,7 +80,7 @@ async def async_setup_entry( "async_set_lock_usercode", ) - platform.async_register_entity_service( # type: ignore + platform.async_register_entity_service( SERVICE_CLEAR_LOCK_USERCODE, { vol.Required(ATTR_CODE_SLOT): vol.Coerce(int), diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index 8ad8d4a45a2..ed619cc9678 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -862,17 +862,19 @@ ENTITY_SERVICE_FIELDS = { def make_entity_service_schema( schema: dict, *, extra: int = vol.PREVENT_EXTRA -) -> vol.All: +) -> vol.Schema: """Create an entity service schema.""" - return vol.All( - vol.Schema( - { - **schema, - **ENTITY_SERVICE_FIELDS, - }, - extra=extra, - ), - has_at_least_one_key(*ENTITY_SERVICE_FIELDS), + return vol.Schema( + vol.All( + vol.Schema( + { + **schema, + **ENTITY_SERVICE_FIELDS, + }, + extra=extra, + ), + has_at_least_one_key(*ENTITY_SERVICE_FIELDS), + ) ) diff --git a/homeassistant/helpers/entity_platform.py b/homeassistant/helpers/entity_platform.py index 6d7581f6f2b..83e72c7491d 100644 --- a/homeassistant/helpers/entity_platform.py +++ b/homeassistant/helpers/entity_platform.py @@ -8,9 +8,10 @@ from datetime import datetime, timedelta import logging from logging import Logger from types import ModuleType -from typing import TYPE_CHECKING, Callable +from typing import TYPE_CHECKING, Any, Callable from typing_extensions import Protocol +import voluptuous as vol from homeassistant import config_entries from homeassistant.const import ( @@ -625,7 +626,13 @@ class EntityPlatform: ) @callback - def async_register_entity_service(self, name, schema, func, required_features=None): # type: ignore[no-untyped-def] + def async_register_entity_service( + self, + name: str, + schema: dict | vol.Schema, + func: str | Callable[..., Any], + required_features: Iterable[int] | None = None, + ) -> None: """Register an entity service. Services will automatically be shared by all platforms of the same domain.