Use a single WS command for group preview (#98903)

* Use a single WS command for group preview

* Fix tests
This commit is contained in:
Erik Montnemery 2023-08-24 11:59:24 +02:00 committed by GitHub
parent 31a8a62165
commit d282ba6bac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 102 additions and 123 deletions

View file

@ -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."""