Home Assistant Unofficial Reference 2024.12.1
util.py
Go to the documentation of this file.
1 """Utilities for Flume."""
2 
3 from __future__ import annotations
4 
5 from typing import Any
6 
7 from pyflume import FlumeDeviceList
8 
9 from .const import KEY_DEVICE_LOCATION, KEY_DEVICE_LOCATION_NAME
10 
11 
12 def get_valid_flume_devices(flume_devices: FlumeDeviceList) -> list[dict[str, Any]]:
13  """Return a list of Flume devices that have a valid location."""
14  return [
15  device
16  for device in flume_devices.device_list
17  if KEY_DEVICE_LOCATION in device
18  and KEY_DEVICE_LOCATION_NAME in device[KEY_DEVICE_LOCATION]
19  ]
list[dict[str, Any]] get_valid_flume_devices(FlumeDeviceList flume_devices)
Definition: util.py:12