Skip to content

Commit

Permalink
Add order number to devices (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio authored Feb 7, 2024
1 parent 3206e6e commit f3dea8a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/resources/stubs/module-definition-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
"1.1.1": {
"name": "AKH-0800.03 Heizungsaktor 8-fach, 4TE, 24/230VAC",
"hardware_name": "Heizungsaktor 8-fach",
"order_number": "AKH-0800.03",
"description": "",
"manufacturer_name": "MDT technologies",
"individual_address": "1.1.1",
Expand Down Expand Up @@ -274,6 +275,7 @@
"1.1.2": {
"name": "AKH-0800.03 Heizungsaktor 8-fach, 4TE, 24/230VAC",
"hardware_name": "Heizungsaktor 8-fach",
"order_number": "AKH-0800.03",
"description": "",
"manufacturer_name": "MDT technologies",
"individual_address": "1.1.2",
Expand Down
2 changes: 2 additions & 0 deletions test/resources/stubs/test_project-ets4.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
"0.0.1": {
"name": "AKS-2016.02 Switch Actuator 20-fold, 12TE, 16A",
"hardware_name": "Schaltaktor 20-fach,12TE, 230VAC, 16A",
"order_number": "AKS-2016.02",
"description": "",
"manufacturer_name": "MDT technologies",
"individual_address": "0.0.1",
Expand All @@ -195,6 +196,7 @@
"0.0.2": {
"name": "JRA/S4.230.5.1 Jal./Rol.Akt.Fahrzt.man.4f,230V,REG",
"hardware_name": "JRA/S4.230.5.1 Jal./Rol.Akt.Fahrzt.man.4f,230V,REG",
"order_number": "2CDG 110 125 R0011",
"description": "",
"manufacturer_name": "ABB",
"individual_address": "0.0.2",
Expand Down
4 changes: 4 additions & 0 deletions test/resources/stubs/xknx_test_project.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@
"1.1.0": {
"name": "SCN-IP100.03 IP Router with Secure",
"hardware_name": "IP Router Secure",
"order_number": "SCN-IP100.03",
"description": "",
"manufacturer_name": "MDT technologies",
"individual_address": "1.1.0",
Expand All @@ -663,6 +664,7 @@
"1.1.5": {
"name": "JRA/S4.230.2.1 Blind/RollerShutterAct,M,4f,230V",
"hardware_name": "JRA/S4.230.2.1 Jal./Rol.Akt.man.4f,230V,REG",
"order_number": "2CDG 110 121 R0011",
"description": "",
"manufacturer_name": "ABB",
"individual_address": "1.1.5",
Expand All @@ -682,6 +684,7 @@
"1.1.6": {
"name": "AE/S4.2 Analogue Input,4-fold,MDRC",
"hardware_name": "AE/S4.2 Analogeingang,4fach,REG",
"order_number": "2CDG 110 030 R0011",
"description": "",
"manufacturer_name": "ABB",
"individual_address": "1.1.6",
Expand All @@ -698,6 +701,7 @@
"1.1.7": {
"name": "Heating actuator 6-gang with controller",
"hardware_name": "Heizungsaktor 6fach mit Regler Secure",
"order_number": "2139 00",
"description": "",
"manufacturer_name": "GIRA Giersiepen",
"individual_address": "1.1.7",
Expand Down
1 change: 1 addition & 0 deletions xknxproject/loader/hardware_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def parse_product_element(product_node: ElementTree.Element) -> Product:
return Product(
identifier=product_node.get("Id", ""),
text=product_node.get("Text", ""),
order_number=product_node.get("OrderNumber", ""),
)

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions xknxproject/models/knxproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Device(TypedDict):

name: str
hardware_name: str
order_number: str
description: str
manufacturer_name: str
individual_address: str
Expand Down
2 changes: 2 additions & 0 deletions xknxproject/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def __init__(
)
self.product_name: str = ""
self.hardware_name: str = ""
self.order_number: str = ""
self.manufacturer_name: str = ""

def add_additional_address(self, address: str) -> None:
Expand Down Expand Up @@ -488,6 +489,7 @@ class Product:

identifier: str
text: str
order_number: str
hardware_name: str = ""


Expand Down
2 changes: 2 additions & 0 deletions xknxproject/xml/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def _load(self, language: str | None) -> None:
continue
device.product_name = product.text
device.hardware_name = product.hardware_name
device.order_number = product.order_number

try:
application_program_ref = hardware_application_map[
Expand Down Expand Up @@ -308,6 +309,7 @@ def _transform(self) -> KNXProject:
devices_dict[device.individual_address] = Device(
name=device.product_name,
hardware_name=device.hardware_name,
order_number=device.order_number,
description=device.description,
manufacturer_name=device.manufacturer_name,
individual_address=device.individual_address,
Expand Down

0 comments on commit f3dea8a

Please sign in to comment.