Add support for Flo "pucks" (#47074)
So far the Flo integration only supports shutoff valves. Add support for Flo leak detector pucks, which measure temperature and humidity in addition to providing leak alerts.
This commit is contained in:
parent
d37fb7d88d
commit
ad86eb4be3
14 changed files with 389 additions and 66 deletions
|
@ -58,7 +58,9 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
@property
|
||||
def device_name(self) -> str:
|
||||
"""Return device name."""
|
||||
return f"{self.manufacturer} {self.model}"
|
||||
return self._device_information.get(
|
||||
"nickname", f"{self.manufacturer} {self.model}"
|
||||
)
|
||||
|
||||
@property
|
||||
def manufacturer(self) -> str:
|
||||
|
@ -120,6 +122,11 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
"""Return the current temperature in degrees F."""
|
||||
return self._device_information["telemetry"]["current"]["tempF"]
|
||||
|
||||
@property
|
||||
def humidity(self) -> float:
|
||||
"""Return the current humidity in percent (0-100)."""
|
||||
return self._device_information["telemetry"]["current"]["humidity"]
|
||||
|
||||
@property
|
||||
def consumption_today(self) -> float:
|
||||
"""Return the current consumption for today in gallons."""
|
||||
|
@ -159,6 +166,11 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
or self.pending_warning_alerts_count
|
||||
)
|
||||
|
||||
@property
|
||||
def water_detected(self) -> bool:
|
||||
"""Return whether water is detected, for leak detectors."""
|
||||
return self._device_information["fwProperties"]["telemetry_water"]
|
||||
|
||||
@property
|
||||
def last_known_valve_state(self) -> str:
|
||||
"""Return the last known valve state for the device."""
|
||||
|
@ -169,6 +181,11 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
"""Return the target valve state for the device."""
|
||||
return self._device_information["valve"]["target"]
|
||||
|
||||
@property
|
||||
def battery_level(self) -> float:
|
||||
"""Return the battery level for battery-powered device, e.g. leak detectors."""
|
||||
return self._device_information["battery"]["level"]
|
||||
|
||||
async def async_set_mode_home(self):
|
||||
"""Set the Flo location to home mode."""
|
||||
await self.api_client.location.set_mode_home(self._flo_location_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue