mirror of
https://github.com/home-assistant/core.git
synced 2025-05-01 12:47:53 +00:00

* - Added lock platform - Added creation of IgloohomeLockEntity when bridge devices are included. * - Migrated retrieval of linked_bridge utility to utils module. - Added ability for lock to update it's own linked bridge automatically * - Added mock bridge device to test fixture * - Added snapshot test for lock module * - Added bridge with no linked devices - Added test for util.get_linked_bridge * - Added handling of errors from API call * - Bump igloohome-api to v0.1.0 * - Minor change * - Removed async update for locks. Focus on MVP * - Removed need for update on entity creation * - Updated snapshot test * - Updated snapshot * - Updated to use walrus during lock entity creation - Updated callback class for async_setup_entry based on lint suggestion * - Set _attr_name as None - Updated snapshot test * Update homeassistant/components/igloohome/lock.py * Update homeassistant/components/igloohome/lock.py --------- Co-authored-by: Josef Zweck <josef@zweck.dev>
17 lines
570 B
Python
17 lines
570 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 that is linked to the device. 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
|