1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-09 07:45:11 +01:00
Files
core/homeassistant/components/igloohome/utils.py
T
Franck Nijhof b9575ee881 Fix line length violations in components i-l (#170704)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: balloob <1444314+balloob@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2026-05-14 23:24:13 +02:00

20 lines
580 B
Python

"""House utility functions."""
from igloohome_api import DEVICE_TYPE_BRIDGE, GetDeviceInfoResponse
def get_linked_bridge(
device_id: str, devices: list[GetDeviceInfoResponse]
) -> str | None:
"""Return the ID of the bridge linked to the device.
Returns None if no bridge is linked.
"""
bridges = (bridge for bridge in devices if bridge.type == DEVICE_TYPE_BRIDGE)
for bridge in bridges:
if device_id in (
linked_device.deviceId for linked_device in bridge.linkedDevices
):
return bridge.deviceId
return None