@@ -66,3 +66,49 @@ async def test_device_diagnostics(
6666 )
6767 == snapshot
6868 )
69+
70+
71+ async def test_device_diagnostics_execution_history_subsystem (
72+ hass : HomeAssistant ,
73+ hass_client : ClientSessionGenerator ,
74+ init_integration : MockConfigEntry ,
75+ device_registry : dr .DeviceRegistry ,
76+ ) -> None :
77+ """Test execution history matching ignores subsystem suffix."""
78+
79+ diagnostic_data = await async_load_json_object_fixture (
80+ hass , "setup_tahoma_switch.json" , DOMAIN
81+ )
82+
83+ device = device_registry .async_get_device (
84+ identifiers = {(DOMAIN , "rts://****-****-6867/16756006" )}
85+ )
86+ assert device is not None
87+
88+ class _FakeCommand :
89+ def __init__ (self , device_url : str ) -> None :
90+ self .device_url = device_url
91+
92+ class _FakeExecution :
93+ def __init__ (self , name : str , device_urls : list [str ]) -> None :
94+ self .name = name
95+ self .commands = [_FakeCommand (device_url ) for device_url in device_urls ]
96+
97+ def __repr__ (self ) -> str :
98+ return f"Execution({ self .name } )"
99+
100+ execution_history = [
101+ _FakeExecution ("matching" , ["rts://****-****-6867/16756006#2" ]),
102+ _FakeExecution ("other" , ["rts://****-****-6867/other_device" ]),
103+ ]
104+
105+ with patch .multiple (
106+ "pyoverkiz.client.OverkizClient" ,
107+ get_diagnostic_data = AsyncMock (return_value = diagnostic_data ),
108+ get_execution_history = AsyncMock (return_value = execution_history ),
109+ ):
110+ diagnostics = await get_diagnostics_for_device (
111+ hass , hass_client , init_integration , device
112+ )
113+
114+ assert diagnostics ["execution_history" ] == ["Execution(matching)" ]
0 commit comments