1 """Support for Aseko Pool Live binary sensors."""
3 from __future__
import annotations
5 from collections.abc
import Callable
6 from dataclasses
import dataclass
8 from aioaseko
import Unit
12 BinarySensorEntityDescription,
17 from .coordinator
import AsekoConfigEntry
18 from .entity
import AsekoEntity
21 @dataclass(frozen=True, kw_only=True)
23 """Describes an Aseko binary sensor entity."""
25 value_fn: Callable[[Unit], bool |
None]
28 BINARY_SENSORS: tuple[AsekoBinarySensorEntityDescription, ...] = (
31 translation_key=
"water_flow_to_probes",
32 value_fn=
lambda unit: unit.water_flow_to_probes,
39 config_entry: AsekoConfigEntry,
40 async_add_entities: AddEntitiesCallback,
42 """Set up the Aseko Pool Live binary sensors."""
43 coordinator = config_entry.runtime_data
44 units = coordinator.data.values()
47 for description
in BINARY_SENSORS
49 if description.value_fn(unit)
is not None
54 """Representation of an Aseko binary sensor entity."""
56 entity_description: AsekoBinarySensorEntityDescription
60 """Return the state of the sensor."""
None async_setup_entry(HomeAssistant hass, AsekoConfigEntry config_entry, AddEntitiesCallback async_add_entities)