[core] Assert sub-device relations in integration test (#21326)

This commit is contained in:
Jesse Hills
2026-10-21 14:40:46 -10:00
committed by GitHub
parent 40a58e1d3c
commit bfcefbb896
+14 -5
View File
@@ -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", (