diff --git a/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py b/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py
index 624bcb56b9dc01..608e526f619cc0 100644
--- a/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py
+++ b/scripts/py_matter_idl/matter_idl/data_model_xml/handlers/parsing.py
@@ -102,6 +102,13 @@ def NormalizeDataType(t: str) -> str:
}
+# Handle odd casing and naming
+_CASE_RENAMES_MAPPING = {
+ "power_mW": "power_mw",
+ "energy_mWh": "energy_mwh"
+}
+
+
def ParseType(t: str) -> ParsedType:
"""Parse a data type entry.
@@ -123,6 +130,9 @@ def ParseType(t: str) -> ParsedType:
if t in _REF_NAME_MAPPING:
t = _REF_NAME_MAPPING[t]
+ if t in _CASE_RENAMES_MAPPING:
+ t = _CASE_RENAMES_MAPPING[t]
+
return ParsedType(name=NormalizeDataType(t), is_list=is_list)
diff --git a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py
index 647a275ea8d547..6bdb530f7cc9fc 100755
--- a/scripts/py_matter_idl/matter_idl/test_data_model_xml.py
+++ b/scripts/py_matter_idl/matter_idl/test_data_model_xml.py
@@ -415,6 +415,19 @@ def testXmlNameWorkarounds(self):
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -443,11 +456,14 @@ def testXmlNameWorkarounds(self):
char_string id = 0;
int8u items[] = 1;
endpoint_no endpoints[] = 2;
+ optional power_mw nominalPower = 3;
+ optional energy_mwh maximumEnergy = 4;
}
readonly attribute OutputInfoStruct outputList[] = 0;
readonly attribute optional enum8 testConform = 1;
+
readonly attribute attrib_id attributeList[] = 65531;
readonly attribute event_id eventList[] = 65530;
readonly attribute command_id acceptedCommandList[] = 65529;