Do not select all entities when omitting entity ID in service call (#29178)
* Do not select all entities when omitting entity ID * Address comments Matthew * Require either area_id or entity_id * Fix tests * Fix test
This commit is contained in:
parent
9587afc5ce
commit
02d9ed5e36
47 changed files with 538 additions and 626 deletions
|
@ -715,12 +715,23 @@ PLATFORM_SCHEMA = vol.Schema(
|
|||
|
||||
PLATFORM_SCHEMA_BASE = PLATFORM_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
ENTITY_SERVICE_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Optional(ATTR_ENTITY_ID): comp_entity_ids,
|
||||
vol.Optional(ATTR_AREA_ID): vol.All(ensure_list, [str]),
|
||||
}
|
||||
)
|
||||
|
||||
def make_entity_service_schema(
|
||||
schema: dict, *, extra: int = vol.PREVENT_EXTRA
|
||||
) -> vol.All:
|
||||
"""Create an entity service schema."""
|
||||
return vol.All(
|
||||
vol.Schema(
|
||||
{
|
||||
**schema,
|
||||
vol.Optional(ATTR_ENTITY_ID): comp_entity_ids,
|
||||
vol.Optional(ATTR_AREA_ID): vol.All(ensure_list, [str]),
|
||||
},
|
||||
extra=extra,
|
||||
),
|
||||
has_at_least_one_key(ATTR_ENTITY_ID, ATTR_AREA_ID),
|
||||
)
|
||||
|
||||
|
||||
EVENT_SCHEMA = vol.Schema(
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue