View Source KNXex.ProjectParser (knxex v0.1.0)
KNX project file parser (ETS .knxproj).
Link to this section Summary
Functions
Parses a KNX project file (ETS .knxproj), extracting project information and returns a KNXex.EtsProject struct.
Parses a KNX project file (ETS .knxproj), extracting manufacturer information and returns a map.
Link to this section Functions
@spec parse(binary(), Keyword.t()) :: KNXex.EtsProject.t()
Parses a KNX project file (ETS .knxproj), extracting project information and returns a KNXex.EtsProject struct.
The following informations get extracted:
- Project Information (name, comment, project number, project start/end, etc.)
- Group Addresses with the DPT
- Topology (Area, Line, Device, Unassigned Devices)
- Device Additional Attributes (i.e. IP config, if enabled)
- Device Communication Objects (if enabled)
- Device Parameters (if enabled)
The following options are available:
only: [atom()]- Only the specified information groups will be parsed, the following groups are available:project_info,group_addresses,topology.exclude: [atom()]- The specified information groups will be excluded (seeonly),onlyandexcludeare mutually exclusive.include_dev_add_attributes: boolean()- Include additional attributes from the device (default:false).include_dev_com_objects: boolean()- Include communication objects from the device (default:false).include_dev_parameters: boolean()- Include parameters from the device (default:false).group_addresses_key: :id | :address- The key to use for the group addresses map (default::address).
This function will raise on errors.
@spec parse_manufacturers(binary(), Keyword.t()) :: %{ optional(manufacturer_id :: String.t()) => %{ hardware: %{ optional(id :: String.t()) => KNXex.EtsProject.Manufacturer.Hardware.t() }, application_programs: %{ optional(id :: String.t()) => KNXex.EtsProject.Manufacturer.ApplicationProgram.t() } } }
Parses a KNX project file (ETS .knxproj), extracting manufacturer information and returns a map.
The following informations get extracted:
- Application Programs (basic information and communication objects)
- Hardware & products (basic information)
- Hardware-to-Program mappings
The following options are available:
only: [String.t()]- Only the specified manufacturers will be parsed, the manufacturer ID, i.e.M-0001, is required.exclude: [String.t()]- The specified manufacturers will be excluded (seeonly),onlyandexcludeare mutually exclusive.parallel: boolean()- Whether to parse the manufacturers in parallel usingTask.async_stream/5(defaults tofalse).parallel_timeout: pos_integer()- The timeout for parallel parsing (defaults to60_000ms).
This function will raise on errors.
Example output:
%{
"M-00C9" => %{
application_programs: %{
"M-00C9_A-FF14-20-223D" => %KNXex.EtsProject.Manufacturer.ApplicationProgram{
app_number: "65300",
app_version: "32",
com_objects: %{
"O-12" => %KNXex.EtsProject.Topology.Device.ComObject{
communication_flag: true,
description: nil,
dpt: nil,
function_text: "Eingang",
id: "O-12",
links: nil,
number: 12,
object_size: 1,
priority: nil,
read_flag: false,
read_on_init_flag: false,
text: "Temp. Grenzwert 1: Schaltausgang Sperre",
transmit_flag: false,
update_flag: false,
write_flag: true
}
},
description: "KNX TH-UP",
dynamic_table_management: true,
hash: "Iss9qvKKsV5qnWizDXWVPQ==",
id: "M-00C9_A-FF14-20-223D",
linkable: false,
mask_version: "MV-0701",
name: "KNX App_20",
program_type: "ApplicationProgram"
}
},
hardware: %{
"M-00C9_H-70121-1" => %KNXex.EtsProject.Manufacturer.Hardware{
bus_current: 10,
hardware2programs: %{
"M-00C9_H-70121-1_HP-FF14-20-223D" => %KNXex.EtsProject.Manufacturer.Hardware.Hardware2Program{
application_program_refid: "M-00C9_A-FF14-20-223D",
hash: "SdI1o0jhKfnXwWt3Gf3qOvC/z4U=",
id: "M-00C9_H-70121-1_HP-FF14-20-223D",
medium_types: [:tp]
}
},
has_application_program: true,
has_individual_address: true,
id: "M-00C9_H-70121-1",
is_coupler: nil,
is_ip_enabled: nil,
is_power_supply: nil,
name: "KNX T-AP",
products: %{
"M-00C9_H-70121-1_P-70121" => %KNXex.EtsProject.Manufacturer.Hardware.Product{
hash: "H1+DOySrz+UUcxCBvF0s8MIyIak=",
id: "M-00C9_H-70121-1_P-70121",
is_rail_mounted: false,
order_number: "70121",
text: "KNX T-AP",
width: nil
}
},
serialnum: "70121",
version: "1"
}
}
}
}