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

@ -136,6 +136,23 @@ async def async_setup_entry(
)
@callback
def async_create_preview_sensor(
name: str, validated_config: dict[str, Any]
) -> SensorGroup:
"""Create a preview sensor."""
return SensorGroup(
None,
name,
validated_config[CONF_ENTITIES],
validated_config.get(CONF_IGNORE_NON_NUMERIC, False),
validated_config[CONF_TYPE],
None,
None,
None,
)
def calc_min(
sensor_values: list[tuple[str, float, State]]
) -> tuple[dict[str, str | None], float | None]: