1 """Support for Flo Water Monitor binary sensors."""
3 from __future__
import annotations
6 BinarySensorDeviceClass,
13 from .const
import DOMAIN
as FLO_DOMAIN
14 from .coordinator
import FloDeviceDataUpdateCoordinator
15 from .entity
import FloEntity
20 config_entry: ConfigEntry,
21 async_add_entities: AddEntitiesCallback,
23 """Set up the Flo sensors from config entry."""
24 devices: list[FloDeviceDataUpdateCoordinator] = hass.data[FLO_DOMAIN][
27 entities: list[BinarySensorEntity] = []
28 for device
in devices:
29 if device.device_type ==
"puck_oem":
46 """Binary sensor that reports on if there are any pending system alerts."""
48 _attr_device_class = BinarySensorDeviceClass.PROBLEM
49 _attr_translation_key =
"pending_system_alerts"
52 """Initialize the pending alerts binary sensor."""
53 super().
__init__(
"pending_system_alerts", device)
57 """Return true if the Flo device has pending alerts."""
58 return self._device.has_alerts
62 """Return the state attributes."""
63 if not self._device.has_alerts:
66 "info": self._device.pending_info_alerts_count,
67 "warning": self._device.pending_warning_alerts_count,
68 "critical": self._device.pending_critical_alerts_count,
73 """Binary sensor that reports if water is detected (for leak detectors)."""
75 _attr_device_class = BinarySensorDeviceClass.PROBLEM
76 _attr_translation_key =
"water_detected"
79 """Initialize the pending alerts binary sensor."""
80 super().
__init__(
"water_detected", device)
84 """Return true if the Flo device is detecting water."""
85 return self._device.water_detected
def extra_state_attributes(self)
def __init__(self, device)
def __init__(self, device)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)