Use a single WS command for group preview (#98903)
* Use a single WS command for group preview * Fix tests
This commit is contained in:
parent
31a8a62165
commit
d282ba6bac
8 changed files with 102 additions and 123 deletions
|
@ -1,6 +1,8 @@
|
|||
"""Platform allowing several binary sensor to be grouped into one binary sensor."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
|
@ -85,6 +87,20 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
@callback
|
||||
def async_create_preview_binary_sensor(
|
||||
name: str, validated_config: dict[str, Any]
|
||||
) -> BinarySensorGroup:
|
||||
"""Create a preview sensor."""
|
||||
return BinarySensorGroup(
|
||||
None,
|
||||
name,
|
||||
None,
|
||||
validated_config[CONF_ENTITIES],
|
||||
validated_config[CONF_ALL],
|
||||
)
|
||||
|
||||
|
||||
class BinarySensorGroup(GroupEntity, BinarySensorEntity):
|
||||
"""Representation of a BinarySensorGroup."""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue