1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Allow passing dictionaries to async_register_entity_service (#26370)

This commit is contained in:
Paulus Schoutsen
2019-09-03 00:50:24 -07:00
committed by Pascal Vizeli
parent df9703d814
commit 0cffd61481
3 changed files with 12 additions and 15 deletions

View File

@@ -15,6 +15,7 @@ from homeassistant.const import (
from homeassistant.core import callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_per_platform, discovery
from homeassistant.helpers.config_validation import ENTITY_SERVICE_SCHEMA
from homeassistant.helpers.service import async_extract_entity_ids
from homeassistant.loader import bind_hass, async_get_integration
from homeassistant.util import slugify
@@ -202,6 +203,8 @@ class EntityComponent:
@callback
def async_register_entity_service(self, name, schema, func, required_features=None):
"""Register an entity service."""
if isinstance(schema, dict):
schema = ENTITY_SERVICE_SCHEMA.extend(schema)
async def handle_service(call):
"""Handle the service."""