diff --git a/tests/integration/test_areas_and_devices.py b/tests/integration/test_areas_and_devices.py index 9d79f682c7b..135a112c366 100644 --- a/tests/integration/test_areas_and_devices.py +++ b/tests/integration/test_areas_and_devices.py @@ -4,7 +4,7 @@ from __future__ import annotations import asyncio -from aioesphomeapi import EntityState, SwitchInfo, SwitchState +from aioesphomeapi import DeviceRelation, EntityState, SwitchInfo, SwitchState import pytest from .types import APIClientConnectedFactory, RunCompiledFunction @@ -69,10 +69,19 @@ async def test_areas_and_devices( "Smart Switch should be in Kitchen" ) - # TODO: once aioesphomeapi with SubDeviceInfo.relation is pinned - # (esphome/aioesphomeapi#1955), assert the relations: Light Controller - # and Temperature Sensor VIA, Motion Detector and Smart Switch - # CHILD. The fixture mixes them so the per-device field path is built. + # The fixture mixes relations, so each device stores and sends its own + assert light_controller.relation == DeviceRelation.VIA, ( + "Light Controller should be a via device" + ) + assert temp_sensor.relation == DeviceRelation.VIA, ( + "Temperature Sensor should be a via device" + ) + assert motion_detector.relation == DeviceRelation.CHILD, ( + "Motion Detector should be a child device" + ) + assert smart_switch.relation == DeviceRelation.CHILD, ( + "Smart Switch should be a child device" + ) # Verify suggested_area is set to the top-level area name assert device_info.suggested_area == "Living Room", (