API Reference
Parser
iodd_parser.IODDParser
Parser for IO-Link Device Description (IODD) files.
This class parses IODD ZIP archives and resolves all references to
produce a unified iodd_parser.ParsedIODD result with resolved text strings,
datatypes, variables, errors, units, and process data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
standard_definitions_folder
|
str | Path | None
|
Optional path to a folder containing standard definitions and language files. When provided, all files are loaded from this folder and all language files matching the pattern |
None
|
standard_definitions_filename
|
str
|
Filename of the standard definitions XML. Defaults to IODD-StandardDefinitions1.1.xml. |
'IODD-StandardDefinitions1.1.xml'
|
standard_unit_filename
|
str
|
Filename of the standard unit definitions XML. Defaults to IODD-StandardUnitDefinitions1.1.xml. |
'IODD-StandardUnitDefinitions1.1.xml'
|
load_images
|
bool
|
Whether to extract and load images from the IODD archive. Defaults to False. Example usage:: parser = IODDParser() # Two-step: parse then resolve parsed = parser.parse("device.zip") print(f"Available languages: {parsed.available_languages}") result = parsed.resolve(lang="de") # Or one-step convenience method result = parser.parse_and_resolve("device.zip", lang="de") print(result.device_name) for var_id, var in result.variables.items(): print(f"{var_id}: {var.name}") # With a custom folder containing standard definitions: parser = IODDParser(standard_definitions_folder="/path/to/definitions") |
False
|
Source code in src/iodd_parser/parser.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
standard_definitions
property
Get the loaded standard definitions.
Returns:
| Type | Description |
|---|---|
IoddstandardDefinitions
|
The parsed standard definitions object. |
standard_definition_units
property
Get the loaded standard unit definitions.
Returns:
| Type | Description |
|---|---|
IoddstandardUnitDefinitions
|
The parsed standard unit definitions object. |
language_texts
property
Get the pre-loaded language-specific texts from standard definitions.
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, str]]
|
A dictionary mapping language codes to their text dictionaries. Each text dictionary maps text IDs to their localised string values. |
parse(zip_path)
Parse an IODD ZIP archive without resolving references.
This method parses the XML files and discovers all available language files,
returning a iodd_parser.ParsedIODD object. Call
ParsedIODD.resolve on the result to resolve all
references with an optional language.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zip_path
|
str | Path
|
Path to the IODD ZIP file. |
required |
Returns:
| Type | Description |
|---|---|
ParsedIODD
|
A |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the ZIP file or expected XML is not found. |
ValueError
|
If multiple matching XML files are found in the archive. |
Source code in src/iodd_parser/parser.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
parse_and_resolve(zip_path, lang=None)
Parse an IODD ZIP archive and resolve all references.
This is a convenience method that calls IODDParser.parse
followed by ParsedIODD.resolve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zip_path
|
str | Path
|
Path to the IODD ZIP file. |
required |
lang
|
str | None
|
Optional language code (e.g., "de", "fr") for localised texts. When specified, texts are resolved in the following priority order (later sources override earlier ones): 1. Primary language (English) from standard definitions 2. Primary language from device IODD 3. Primary language from standard unit definitions (English only) 4. Pre-loaded language-specific standard definitions file (if available) 5. Language sections within main standard definitions file 6. Language sections within main device IODD file 7. Device-specific language file (e.g., |
None
|
Returns:
| Type | Description |
|---|---|
ResolvedIODD
|
A |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the ZIP file or expected XML is not found. |
ValueError
|
If multiple matching XML files are found in the archive. |
Source code in src/iodd_parser/parser.py
Parsed Result
iodd_parser.ParsedIODD
dataclass
The result of parsing an IODD file before reference resolution.
This dataclass contains the raw parsed IODD XML objects and
language-specific texts. Use the iodd_parser.ParsedIODD.resolve method to produce
a fully resolved iodd_parser.ParsedIODD object.
Attributes:
| Name | Type | Description |
|---|---|---|
iodd_definitions |
IoddstandardDefinitions
|
The parsed standard definitions XML. |
iodd_units |
IoddstandardUnitDefinitions
|
The parsed standard unit definitions XML. |
iodd_device |
Iodevice
|
The parsed device IODD XML. |
standard_lang_texts |
dict[str, dict[str, str]]
|
Dict of language code to text dictionaries from standard definitions. |
device_lang_texts |
dict[str, dict[str, str]]
|
Dict of language code to text dictionaries from device-specific language files. |
images |
list[IoddImage]
|
List of images extracted from the IODD archive. |
Source code in src/iodd_parser/types.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | |
available_languages
property
Get the set of available language codes.
Returns:
| Type | Description |
|---|---|
set[str]
|
A set of language codes available in either standard or device texts. |
resolve(lang=None)
Resolve all references and produce a fully resolved ResolvedIODD object.
This method resolves all text references, datatypes, variables, errors, units, process data, and user interface elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lang
|
str | None
|
Optional language code (e.g., "de", "fr") for localised texts. When specified, texts are resolved in the following priority order (later sources override earlier ones): 1. Primary language (English) from standard definitions 2. Primary language from device IODD 3. Primary language from standard unit definitions (English only) 4. Pre-loaded language-specific standard definitions file (if available) 5. Language sections within main standard definitions file 6. Language sections within main device IODD file 7. Device-specific language file (e.g., |
None
|
Returns:
| Type | Description |
|---|---|
ResolvedIODD
|
A |
Source code in src/iodd_parser/types.py
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | |
Resolved Result
iodd_parser.ResolvedIODD
dataclass
The result of parsing an IODD file with all references resolved.
This dataclass contains both the raw parsed IODD objects and resolved/processed data for convenient access.
Attributes:
| Name | Type | Description |
|---|---|---|
iodd_definitions |
IoddstandardDefinitions
|
The parsed standard definitions XML. |
iodd_units |
IoddstandardUnitDefinitions
|
The parsed standard unit definitions XML. |
iodd_device |
Iodevice
|
The parsed device IODD XML. |
device_name |
str
|
The resolved device name. |
device_manufacturer |
str
|
The vendor/manufacturer name. |
variables |
dict[str, ResolvedVariable]
|
Dict of resolved variables, keyed by variable id. |
process_data |
dict[str, ResolvedProcessData]
|
Dict of resolved process data, keyed by id. |
texts |
dict[str, str]
|
Dict of all text strings, keyed by text id. |
datatypes |
dict[str, DatatypeT]
|
Dict of all data types, keyed by datatype id. |
errors |
dict[tuple[int, int], ResolvedError]
|
Dict of resolved errors, keyed by (code, additional_code). |
units |
dict[int, ResolvedUnit]
|
Dict of resolved units, keyed by unit code. |
user_interface |
ResolvedUserInterface
|
The resolved user interface with menus and role assignments. |
images |
list[IoddImage]
|
List of images extracted from the IODD archive. |
Source code in src/iodd_parser/types.py
get_text(ref)
Get the text string for a text reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
TextRefT
|
The text reference object containing the text_id. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The resolved text string, or None if not found. |
Source code in src/iodd_parser/types.py
Variables
iodd_parser.ResolvedVariable
dataclass
A resolved variable with all references resolved.
Variables can come from three sources:
- StdVariableRef: references to standard variables from the loaded Standard Definitions file.
- DirectParameterOverlay: device-specific data within DirectParameter page
- Variable: vendor-specific variables with a device-specific index
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier of the variable within the IODD. |
index |
int
|
Index for addressing the variable (ISDU index). |
datatype |
ResolvedDatatype
|
The resolved data type of the variable. |
name |
str
|
The resolved human-readable name. |
description |
None | str
|
The resolved description text, if available. |
access_rights |
AccessRightsT
|
Access rights (read-only, write-only, read-write). |
dynamic |
bool
|
Whether the variable is autonomously changed by the device. |
modifies_other_variables |
bool
|
Whether writing to this variable may change other variables. |
excluded_from_data_storage |
bool
|
Whether the variable is excluded from data storage mechanism. |
default_value |
None | object
|
The offline default value, if specified. |
fixed_length_restriction |
None | int
|
Length restriction for string/array types. |
record_item_info |
list[RecordItemInfoT]
|
Additional information for record items. |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedVariableRef
dataclass
A resolved variable reference in a menu.
Defines how a variable should be displayed in the user interface, with optional gradient/offset transformations and display formatting.
Attributes:
| Name | Type | Description |
|---|---|---|
variable_id |
str
|
The referenced variable id. |
gradient |
Decimal | None
|
Gradient for value transformation (displayed = value * gradient + offset). |
offset |
Decimal | None
|
Offset for value transformation. |
unit_code |
int | None
|
Unit code for the displayed value. |
display_format |
str | None
|
Display format (Bin, Hex, Dec, Dec.x). |
access_right_restriction |
AccessRightsT | None
|
Access rights restriction for certain user roles. |
button |
ResolvedButton | None
|
Button definition if this variable ref displays as a button. |
Source code in src/iodd_parser/types.py
Process Data
iodd_parser.ResolvedProcessData
dataclass
Resolved process data with optional condition for switching.
ProcessData elements can have a Condition element that allows switching between different process data configurations based on a variable value. Multiple ProcessData elements may exist when conditional switching is used.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Explicit id of the ProcessData. |
process_data_in |
None | ResolvedProcessDataItem
|
Description of input process data (device to master). |
process_data_out |
None | ResolvedProcessDataItem
|
Description of output process data (master to device). |
condition_variable_id |
None | str
|
Variable id for switching, if conditional. |
condition_subindex |
None | int
|
Subindex for record item addressing, if applicable. |
condition_value |
None | int
|
The value that selects this ProcessData configuration. |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedProcessDataInfo
dataclass
Display info for process data (non-record type).
Attributes:
| Name | Type | Description |
|---|---|---|
gradient |
Decimal | None
|
Gradient for value transformation. |
offset |
Decimal | None
|
Offset for value transformation. |
unit_code |
int | None
|
Unit code for the displayed value. |
display_format |
str | None
|
Display format (Bin, Hex, Dec, Dec.x). |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedProcessDataItem
dataclass
A resolved process data item (input or output).
ProcessDataIn/ProcessDataOut elements describe the structure of the cyclic process data exchanged between master and device.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Explicit id of the ProcessDataIn/ProcessDataOut description. |
bit_length |
int
|
Length of the process data in bits (1..256). |
name |
str
|
The resolved name of the process data. |
datatype |
ResolvedDatatype
|
The resolved data type. |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedProcessDataRecordItemInfo
dataclass
Display info for a record item within process data.
Attributes:
| Name | Type | Description |
|---|---|---|
subindex |
int
|
The subindex of the record item. |
gradient |
Decimal | None
|
Gradient for value transformation. |
offset |
Decimal | None
|
Offset for value transformation. |
unit_code |
int | None
|
Unit code for the displayed value. |
display_format |
str | None
|
Display format (Bin, Hex, Dec, Dec.x). |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedProcessDataRef
dataclass
A resolved reference to process data with display info.
Defines how process data should be displayed in the user interface.
Attributes:
| Name | Type | Description |
|---|---|---|
process_data_id |
str
|
Reference to ProcessDataIn or ProcessDataOut id. |
process_data_info |
ResolvedProcessDataInfo | None
|
Display info for non-record process data. |
record_item_infos |
list[ResolvedProcessDataRecordItemInfo]
|
Display info for record items (for record-type process data). |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedRecordItemRef
dataclass
A resolved record item reference in a menu.
Like VariableRef but addresses a specific record item via subindex. The referenced variable must be of type record.
Attributes:
| Name | Type | Description |
|---|---|---|
variable_id |
str
|
The referenced variable id (must be of type record). |
subindex |
int
|
The subindex addressing the record item within the record. |
gradient |
Decimal | None
|
Gradient for value transformation. |
offset |
Decimal | None
|
Offset for value transformation. |
unit_code |
int | None
|
Unit code for the displayed value. |
display_format |
str | None
|
Display format (Bin, Hex, Dec, Dec.x). |
access_right_restriction |
AccessRightsT | None
|
Access rights restriction for certain user roles. |
button |
ResolvedButton | None
|
Button definition if this record item ref displays as a button. |
Source code in src/iodd_parser/types.py
Errors
iodd_parser.ResolvedError
dataclass
A resolved error type with all references resolved.
Error types are identified by a combination of code and additional_code:
- code=128: Standard errors from the loaded Standard Definitions file.
- code=129: Vendor-specific errors defined in the device IODD
Attributes:
| Name | Type | Description |
|---|---|---|
code |
int
|
The error code (128 for standard, 129 for vendor-specific). |
additional_code |
int
|
The additional code identifying the specific error. |
name |
str
|
The resolved error message text. |
description |
None | str
|
The resolved description (cause and remedy), if available. |
Source code in src/iodd_parser/types.py
Units
iodd_parser.ResolvedUnit
dataclass
A resolved unit with its code, abbreviation, and name.
Units are defined in IODD-StandardUnitDefinitions1.1.xml.
Attributes:
| Name | Type | Description |
|---|---|---|
code |
int
|
The unit code (e.g., 1001 for degrees Celsius). |
abbreviation |
str
|
The short form (e.g., "°C"). |
name |
str
|
The full name (e.g., "degree Celsius"). |
Source code in src/iodd_parser/types.py
User Interface
iodd_parser.ResolvedUserInterface
dataclass
A resolved user interface with all menus and role assignments.
The user interface defines how the device is presented in IO-Link Tools, organized by user roles with hierarchical menus.
Attributes:
| Name | Type | Description |
|---|---|---|
menus |
dict[str, ResolvedMenu]
|
Dict of all menus, keyed by menu id. |
observer_role_menu_set |
ResolvedMenuSet
|
Menu set for the Observer (Operator) role. |
maintenance_role_menu_set |
ResolvedMenuSet
|
Menu set for the Maintenance role. |
specialist_role_menu_set |
ResolvedMenuSet
|
Menu set for the Specialist role. |
process_data_refs |
list[ResolvedProcessDataRef]
|
List of process data display references. |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedMenuSet
dataclass
A resolved role menu set with top-level menu references.
Each role has a set of fixed top-level menus. The menu names are hard-coded by tools and should not be taken from the IODD.
Attributes:
| Name | Type | Description |
|---|---|---|
identification_menu_id |
str
|
Menu id for device identification (mandatory). |
parameter_menu_id |
str | None
|
Menu id for device parameters (optional). |
observation_menu_id |
str | None
|
Menu id for observation/process data (optional). |
diagnosis_menu_id |
str | None
|
Menu id for diagnosis/events (optional). |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedMenu
dataclass
A resolved menu from the MenuCollection.
A menu contains references to variables, record items, and sub-menus. Items are displayed in the order they appear in the IODD.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Explicit id of the menu. |
name |
str | None
|
The resolved menu name (may be None for top-level menus). |
variable_refs |
list[ResolvedVariableRef]
|
List of variable references in this menu. |
record_item_refs |
list[ResolvedRecordItemRef]
|
List of record item references in this menu. |
menu_refs |
list[ResolvedMenuRef]
|
List of sub-menu references in this menu. |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedMenuRef
dataclass
A resolved reference to a sub-menu.
Attributes:
| Name | Type | Description |
|---|---|---|
menu_id |
str
|
The referenced menu id from the MenuCollection. |
condition |
ResolvedCondition | None
|
Optional condition for conditional display of this menu. |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedButton
dataclass
A resolved button for command interface.
Buttons are used to implement command interfaces to the device. When pressed, the button value is immediately sent to the device.
Attributes:
| Name | Type | Description |
|---|---|---|
button_value |
bool | int
|
The value sent to the device when the button is clicked. |
description |
str | None
|
A text explaining the action started by pressing the button. |
action_started_message |
str | None
|
A text shown after the value was successfully sent. |
Source code in src/iodd_parser/types.py
iodd_parser.ResolvedCondition
dataclass
A resolved condition for conditional menu display.
An IO-Link Tool shows the referenced menu only if the value of the referenced variable/record item equals the condition value.
Attributes:
| Name | Type | Description |
|---|---|---|
variable_id |
str
|
The referenced condition variable id. |
subindex |
int | None
|
Subindex for record item addressing (if variable is RecordT). |
value |
int
|
The value that must match for the condition to be true (0-255). |
Source code in src/iodd_parser/types.py
Enums
iodd_parser.UserRole
Bases: Enum
User roles for the device user interface.
Attributes:
| Name | Type | Description |
|---|---|---|
OBSERVER |
Operator role - read-only access, no modifications allowed. |
|
MAINTENANCE |
Maintenance role - uncritical editing allowed. |
|
SPECIALIST |
Specialist role - full access to the device. |
Source code in src/iodd_parser/types.py
iodd_parser.TopLevelMenuType
Bases: Enum
Types of top-level menus in a role menu set.
Attributes:
| Name | Type | Description |
|---|---|---|
IDENTIFICATION |
Menu for device identification variables. |
|
PARAMETER |
Menu for device parameterization variables. |
|
OBSERVATION |
Menu for observation (process data, dynamic variables). |
|
DIAGNOSIS |
Menu for diagnosis (events, etc.). |
Source code in src/iodd_parser/types.py
Images
iodd_parser.IoddImage
dataclass
An image extracted from an IODD zip archive.
Attributes:
| Name | Type | Description |
|---|---|---|
filename |
str
|
The filename of the image within the archive. |
data |
bytes
|
The raw binary data of the image. |