Fix lock services not removing entity fields (#88805)

This commit is contained in:
J. Nick Koston 2023-02-26 17:59:28 -06:00 committed by GitHub
parent 0f01866508
commit bea81d3f63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View file

@ -513,6 +513,16 @@ async def async_get_all_descriptions(
return descriptions
@callback
def remove_entity_service_fields(call: ServiceCall) -> dict[Any, Any]:
"""Remove entity service fields."""
return {
key: val
for key, val in call.data.items()
if key not in cv.ENTITY_SERVICE_FIELDS
}
@callback
@bind_hass
def async_set_service_schema(
@ -567,11 +577,7 @@ async def entity_service_call( # noqa: C901
# If the service function is a string, we'll pass it the service call data
if isinstance(func, str):
data: dict | ServiceCall = {
key: val
for key, val in call.data.items()
if key not in cv.ENTITY_SERVICE_FIELDS
}
data: dict | ServiceCall = remove_entity_service_fields(call)
# If the service function is not a string, we pass the service call
else:
data = call