5
5
import re
6
6
from xml .etree import ElementTree
7
7
8
+ from xknxproject .const import ETS_5_7_SCHEMA_VERSION
8
9
from xknxproject .exceptions import UnexpectedDataError
9
10
from xknxproject .models import (
10
11
ChannelNode ,
@@ -313,8 +314,8 @@ def _create_device(
313
314
)
314
315
315
316
@staticmethod
316
- def __get_links_from_ets4 (com_object : ElementTree .Element ) -> list [str ]:
317
- # Check if "Connectors" is available. This will always fail for ETS5/6
317
+ def __get_links_from_schema_1x (com_object : ElementTree .Element ) -> list [str ]:
318
+ # Check if "Connectors" is available. Schema version <= 14
318
319
if (connectors := com_object .find ("{*}Connectors" )) is None :
319
320
return []
320
321
@@ -327,8 +328,8 @@ def __get_links_from_ets4(com_object: ElementTree.Element) -> list[str]:
327
328
]
328
329
329
330
@staticmethod
330
- def __get_links_from_ets5 (com_object : ElementTree .Element ) -> list [str ]:
331
- # ETS5/ 6 uses a space-separated string of GA
331
+ def __get_links_from_schema_2x (com_object : ElementTree .Element ) -> list [str ]:
332
+ # ETS 5.7+ / 6 uses a space-separated string of GA
332
333
links = com_object .get ("Links" )
333
334
334
335
if links is None :
@@ -342,10 +343,10 @@ def _create_com_object_instance(
342
343
) -> ComObjectInstanceRef | None :
343
344
"""Create ComObjectInstanceRef."""
344
345
345
- if self .__knx_proj_contents .is_ets4_project () :
346
- links = self .__get_links_from_ets4 (com_object )
346
+ if self .__knx_proj_contents .schema_version < ETS_5_7_SCHEMA_VERSION :
347
+ links = self .__get_links_from_schema_1x (com_object )
347
348
else :
348
- links = self .__get_links_from_ets5 (com_object )
349
+ links = self .__get_links_from_schema_2x (com_object )
349
350
350
351
if not links :
351
352
return None
0 commit comments