conson-xp 1.7.0__py3-none-any.whl → 1.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {conson_xp-1.7.0.dist-info → conson_xp-1.9.0.dist-info}/METADATA +1 -1
- {conson_xp-1.7.0.dist-info → conson_xp-1.9.0.dist-info}/RECORD +13 -13
- xp/__init__.py +1 -1
- xp/cli/commands/conbus/conbus_actiontable_commands.py +11 -4
- xp/models/homekit/homekit_conson_config.py +18 -0
- xp/models/telegram/input_action_type.py +2 -2
- xp/models/telegram/system_function.py +49 -19
- xp/services/actiontable/actiontable_serializer.py +15 -6
- xp/services/conbus/actiontable/actiontable_service.py +16 -6
- xp/services/conbus/actiontable/msactiontable_service.py +3 -1
- {conson_xp-1.7.0.dist-info → conson_xp-1.9.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.7.0.dist-info → conson_xp-1.9.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.7.0.dist-info → conson_xp-1.9.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
conson_xp-1.
|
|
2
|
-
conson_xp-1.
|
|
3
|
-
conson_xp-1.
|
|
4
|
-
conson_xp-1.
|
|
5
|
-
xp/__init__.py,sha256=
|
|
1
|
+
conson_xp-1.9.0.dist-info/METADATA,sha256=usy0aEumo7eEblOFryKcZJMRf2sbegjsd6rBUdyuMfw,9274
|
|
2
|
+
conson_xp-1.9.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
conson_xp-1.9.0.dist-info/entry_points.txt,sha256=1OcdIcDM1hz3ljCXgybaPUh1IOFEwkaTgLIW9u9zGeg,50
|
|
4
|
+
conson_xp-1.9.0.dist-info/licenses/LICENSE,sha256=rxj6woMM-r3YCyGq_UHFtbh7kHTAJgrccH6O-33IDE4,1419
|
|
5
|
+
xp/__init__.py,sha256=L0H6Mwrze8ZJt6uirLh_Crx5go9rdWWiCFZ91ox0TII,180
|
|
6
6
|
xp/cli/__init__.py,sha256=QjnKB1KaI2aIyKlzrnvCwfbBuUj8HNgwNMvNJVQofbI,81
|
|
7
7
|
xp/cli/__main__.py,sha256=l2iKwMdat5rTGd3JWs-uGksnYYDDffp_Npz05QdKEeU,117
|
|
8
8
|
xp/cli/commands/__init__.py,sha256=02CbZoKmNX-fn5etX4Hdgg2lUt1MsLFPYx2VkXZyFJ8,4394
|
|
9
9
|
xp/cli/commands/conbus/__init__.py,sha256=gE3K5OEoXkkZX8UOc2v3nreQQzwkOQi7n0VZ-Z2juXA,495
|
|
10
10
|
xp/cli/commands/conbus/conbus.py,sha256=OTebWu-V-_1tOq2nWExPLtDuAeqy7fB7ltUqzHfgcY8,2705
|
|
11
|
-
xp/cli/commands/conbus/conbus_actiontable_commands.py,sha256=
|
|
11
|
+
xp/cli/commands/conbus/conbus_actiontable_commands.py,sha256=iyF3WVLKz4haA_79IP2Yp4y_WFB8aJ5DTH-pTbCfBTk,2252
|
|
12
12
|
xp/cli/commands/conbus/conbus_autoreport_commands.py,sha256=oZgyUUFNsb4yf2WO81l2w1PrasNwdC__QwxNkJ2jCaU,3794
|
|
13
13
|
xp/cli/commands/conbus/conbus_blink_commands.py,sha256=UK-Ey4K0FvaPQ96U0gyMid236RlBmUhPNRes9y0SlkM,4848
|
|
14
14
|
xp/cli/commands/conbus/conbus_config_commands.py,sha256=BugIbgNX6_s4MySGvI6tWZkwguciajHUX2Xz8XBux7k,716
|
|
@@ -74,7 +74,7 @@ xp/models/conbus/conbus_writeconfig.py,sha256=z8fdJeFLyGJW7UMHcHxGrHIMS6gG1D3aXe
|
|
|
74
74
|
xp/models/homekit/__init__.py,sha256=5HDSOClCu0ArK3IICn3_LDMMLBAzLjBxUUSF73bxSSk,34
|
|
75
75
|
xp/models/homekit/homekit_accessory.py,sha256=NsHFhskuxIdJpF9-MvXHtjkLYvNHmSGFOy0GmQv3PY4,1038
|
|
76
76
|
xp/models/homekit/homekit_config.py,sha256=Y1WwrbISRtJOkKVBnXQULb3vAOzcOdt95hBAI8cM_MU,2771
|
|
77
|
-
xp/models/homekit/homekit_conson_config.py,sha256=
|
|
77
|
+
xp/models/homekit/homekit_conson_config.py,sha256=NML644Ij7abstMbud-TUPcxraGY4vQwKrkJOwftv2pM,2603
|
|
78
78
|
xp/models/log_entry.py,sha256=kPcYuAirCXugfL3YkOK9cQVlkNWxG_8a4AVuhsykHL0,4355
|
|
79
79
|
xp/models/protocol/__init__.py,sha256=TJ_CJKchA-xgQiv5vCo_ndBBZjrcaTmjT74bR0T-5Cw,38
|
|
80
80
|
xp/models/protocol/conbus_protocol.py,sha256=tSnI5pxBTP_f1DUzEM3XbyjK7vsqwm0gpzHIH1gTg8E,8854
|
|
@@ -84,13 +84,13 @@ xp/models/telegram/action_type.py,sha256=vkw_chTgmsadksGXvZ9D_qYGpjOwCw-OgbEi8Bm
|
|
|
84
84
|
xp/models/telegram/datapoint_type.py,sha256=clmgqCsTNKuHmWN6ol2Hwj_71I10f36Oq-S5D5ZA9a8,2942
|
|
85
85
|
xp/models/telegram/event_telegram.py,sha256=FCCfyZXQEUPB6Uo1m7B9nvFCJ0Ipv2CApmImAZo_Xa4,4689
|
|
86
86
|
xp/models/telegram/event_type.py,sha256=VZhaDpey7KYWnmwN-gstj-r4Vd5hiGdzQuRazUdixB8,333
|
|
87
|
-
xp/models/telegram/input_action_type.py,sha256=
|
|
87
|
+
xp/models/telegram/input_action_type.py,sha256=_0D6U6WslUcA1imht7ZQ5t8EAvkqyk7c2IfmNqZAAR0,1868
|
|
88
88
|
xp/models/telegram/input_type.py,sha256=X3AcKKMNHswNZs5xgT_AnxeKQpSx_U7ctGnr6AYqNoU,491
|
|
89
89
|
xp/models/telegram/module_type.py,sha256=TdrcQC3UcdESzyUmS9PaVeJuF5VxH1WUtDWdf4QRA50,5223
|
|
90
90
|
xp/models/telegram/module_type_code.py,sha256=bg8Zi58yKs5DDnEF0bGnZ9vvpqzmIZzd1k9Wu4ufB-Y,8177
|
|
91
91
|
xp/models/telegram/output_telegram.py,sha256=vTSdeAGk7va89pZ8-oh0cna98N3T6if-6UcrstWsN6s,3473
|
|
92
92
|
xp/models/telegram/reply_telegram.py,sha256=oqNwDvaOhFTPuXL0fP9Ca3rbcKepDhRz9kIneKCk6n0,10376
|
|
93
|
-
xp/models/telegram/system_function.py,sha256=
|
|
93
|
+
xp/models/telegram/system_function.py,sha256=ZiY5preq_teO10R6489ZOaYjkJsYFpHZ5_tJpGM6E-Y,4794
|
|
94
94
|
xp/models/telegram/system_telegram.py,sha256=9FNQ4Mf47mRK7wGrTg2GzziVsrEWCE5ZkZp5kA7K3w0,3218
|
|
95
95
|
xp/models/telegram/telegram.py,sha256=IJUxHX6ftLcET9C1pjvLhUO5Db5JO6W7rUItzdEW30I,842
|
|
96
96
|
xp/models/telegram/telegram_type.py,sha256=GhqKP63oNMyh2tIvCPcsC5RFp4s4JjhmEqCLCC-8XMk,423
|
|
@@ -98,15 +98,15 @@ xp/models/telegram/timeparam_type.py,sha256=Ar8xvSfPmOAgR2g2Je0FgvP01SL7bPvZn5_H
|
|
|
98
98
|
xp/models/write_config_type.py,sha256=T2RaO52RpzoJ4782uMHE-fX7Ymx3CaIQAEwByydXq1M,881
|
|
99
99
|
xp/services/__init__.py,sha256=W9YZyrkh7vm--ZHhAXNQiOYQs5yhhmUHXP5I0Lf1XBg,782
|
|
100
100
|
xp/services/actiontable/__init__.py,sha256=z6js4EuJ6xKHaseTEhuEvKo1tr9K1XyQiruReJtBiPY,26
|
|
101
|
-
xp/services/actiontable/actiontable_serializer.py,sha256=
|
|
101
|
+
xp/services/actiontable/actiontable_serializer.py,sha256=ZDIbFG5BlLbSo5O0as119oiNx1IdPLSCNBdQdOlT4V4,5446
|
|
102
102
|
xp/services/actiontable/msactiontable_serializer.py,sha256=RRL6TZ1gpSQw81kAiw2BV3jTqm4fCJC0pWIcO26Cmos,174
|
|
103
103
|
xp/services/actiontable/msactiontable_xp20_serializer.py,sha256=3Lz6t3uRYhoeMRhjDAO1XuWPJzH-ML13t05UQLFUW-s,6057
|
|
104
104
|
xp/services/actiontable/msactiontable_xp24_serializer.py,sha256=zdKzcrKqD41POqj_1c4B4why_Jp9mNXncajsnXXBtPw,4215
|
|
105
105
|
xp/services/actiontable/msactiontable_xp33_serializer.py,sha256=xoZBA38pBSUPA9nn7HgaH1ZM5sR2heQbJ6JVlPVbzUY,8400
|
|
106
106
|
xp/services/conbus/__init__.py,sha256=Hi35sMKu9o6LpYoi2tQDaQoMb8M5sOt_-LUTxxaCU_0,28
|
|
107
107
|
xp/services/conbus/actiontable/__init__.py,sha256=oD6vRk_Ye-eZ9s_hldAgtRJFu4mfAnODqpkJUGHHszk,40
|
|
108
|
-
xp/services/conbus/actiontable/actiontable_service.py,sha256=
|
|
109
|
-
xp/services/conbus/actiontable/msactiontable_service.py,sha256=
|
|
108
|
+
xp/services/conbus/actiontable/actiontable_service.py,sha256=z8rfQehfPOJ_LfGL3rVMaZAJYkeDRYrh1pd2r1dFZwQ,5978
|
|
109
|
+
xp/services/conbus/actiontable/msactiontable_service.py,sha256=K0TiYL8g4ac8BS1tqS0UAIYJigOlNhxVLIb8ZFybnVE,8393
|
|
110
110
|
xp/services/conbus/conbus_blink_all_service.py,sha256=OaEg4b8AEiEruHSkZ5jDtaoI81vwwxLq4KWXO7zBdD0,6582
|
|
111
111
|
xp/services/conbus/conbus_blink_service.py,sha256=x9uM-sLnIEV8wSNsvJgo08E042g-Hh2ZF3rXkz-k_9s,5824
|
|
112
112
|
xp/services/conbus/conbus_custom_service.py,sha256=4aneYdPObiZOGxPFYg5Wr70cl_xFxlQIdJBPQSa0enI,5826
|
|
@@ -164,4 +164,4 @@ xp/utils/dependencies.py,sha256=1XDwIg3OsmLvOazMQ3qaktcsitYW8E400RxihNWgyt0,1889
|
|
|
164
164
|
xp/utils/event_helper.py,sha256=W-A_xmoXlpWZBbJH6qdaN50o3-XrwFsDgvAGMJDiAgo,1001
|
|
165
165
|
xp/utils/serialization.py,sha256=RWHHk86feaB4ZP7rjE4qOWK0900yg2joUBDkP76gfOY,4618
|
|
166
166
|
xp/utils/time_utils.py,sha256=dEyViDlAG9GWU-J3D_YVa-sGma6yiyyMTgN4h2x3PY4,3781
|
|
167
|
-
conson_xp-1.
|
|
167
|
+
conson_xp-1.9.0.dist-info/RECORD,,
|
xp/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""ActionTable CLI commands."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
-
from
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
import click
|
|
7
7
|
from click import Context
|
|
@@ -40,15 +40,22 @@ def conbus_download_actiontable(ctx: Context, serial_number: str) -> None:
|
|
|
40
40
|
"""
|
|
41
41
|
click.echo(progress)
|
|
42
42
|
|
|
43
|
-
def on_finish(
|
|
43
|
+
def on_finish(
|
|
44
|
+
_actiontable: ActionTable,
|
|
45
|
+
actiontable_dict: dict[str, Any],
|
|
46
|
+
actiontable_short: list[str],
|
|
47
|
+
) -> None:
|
|
44
48
|
"""Handle successful completion of action table download.
|
|
45
49
|
|
|
46
50
|
Args:
|
|
47
|
-
|
|
51
|
+
_actiontable: Downloaded action table object.
|
|
52
|
+
actiontable_dict: Dictionary representation of action table.
|
|
53
|
+
actiontable_short: List of textual format strings.
|
|
48
54
|
"""
|
|
49
55
|
output = {
|
|
50
56
|
"serial_number": serial_number,
|
|
51
|
-
"
|
|
57
|
+
"actiontable_short": actiontable_short,
|
|
58
|
+
"actiontable": actiontable_dict,
|
|
52
59
|
}
|
|
53
60
|
click.echo(json.dumps(output, indent=2, default=str))
|
|
54
61
|
|
|
@@ -22,6 +22,8 @@ class ConsonModuleConfig(BaseModel):
|
|
|
22
22
|
conbus_port: Optional Conbus port number.
|
|
23
23
|
sw_version: Optional software version.
|
|
24
24
|
hw_version: Optional hardware version.
|
|
25
|
+
action_table: Optional action table configuration.
|
|
26
|
+
auto_report_status: Optional auto report status.
|
|
25
27
|
"""
|
|
26
28
|
|
|
27
29
|
name: str
|
|
@@ -35,6 +37,8 @@ class ConsonModuleConfig(BaseModel):
|
|
|
35
37
|
conbus_port: Optional[int] = None
|
|
36
38
|
sw_version: Optional[str] = None
|
|
37
39
|
hw_version: Optional[str] = None
|
|
40
|
+
action_table: Optional[List[str]] = None
|
|
41
|
+
auto_report_status: Optional[str] = None
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
class ConsonModuleListConfig(BaseModel):
|
|
@@ -66,3 +70,17 @@ class ConsonModuleListConfig(BaseModel):
|
|
|
66
70
|
with Path(file_path).open("r") as file:
|
|
67
71
|
data = yaml.safe_load(file)
|
|
68
72
|
return cls(root=data)
|
|
73
|
+
|
|
74
|
+
def find_module(self, serial_number: str) -> Optional[ConsonModuleConfig]:
|
|
75
|
+
"""Find a module by serial number.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
serial_number: Module serial number to search for.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
ConsonModuleConfig if found, None otherwise.
|
|
82
|
+
"""
|
|
83
|
+
for module in self.root:
|
|
84
|
+
if module.serial_number == serial_number:
|
|
85
|
+
return module
|
|
86
|
+
return None
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""Input action types for XP24 module based on Feature-Action-Table.md."""
|
|
2
2
|
|
|
3
|
-
from enum import
|
|
3
|
+
from enum import Enum
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class InputActionType(
|
|
6
|
+
class InputActionType(Enum):
|
|
7
7
|
"""Input action types for XP24 module (based on Feature-Action-Table.md).
|
|
8
8
|
|
|
9
9
|
Attributes:
|
|
@@ -15,35 +15,65 @@ class SystemFunction(str, Enum):
|
|
|
15
15
|
WRITE_CONFIG: Write configuration.
|
|
16
16
|
BLINK: Blink LED function.
|
|
17
17
|
UNBLINK: Unblink LED function.
|
|
18
|
-
|
|
18
|
+
UPLOAD_FIRMWARE_START: Start upload firmware.
|
|
19
|
+
UPLOAD_FIRMWARE_STOP: Stop upload firmware.
|
|
20
|
+
UPLOAD_FIRMWARE: Upload firmware.
|
|
21
|
+
UPLOAD_ACTIONTABLE: Upload ActionTable to module.
|
|
19
22
|
DOWNLOAD_ACTIONTABLE: Download ActionTable.
|
|
23
|
+
UPLOAD_MSACTIONTABLE: Upload module specific action table to module.
|
|
24
|
+
DOWNLOAD_MSACTIONTABLE: Download module specific action table.
|
|
25
|
+
TELEGRAM_WRITE_START: Start writing telegram.
|
|
26
|
+
TELEGRAM_READ_START: Start reading telegram.
|
|
20
27
|
EOF: End of msactiontable response.
|
|
28
|
+
TELEGRAM: Module specific telegram response.
|
|
21
29
|
MSACTIONTABLE: Module specific action table response.
|
|
22
30
|
ACTIONTABLE: Module specific action table response.
|
|
23
31
|
ACK: Acknowledge response.
|
|
24
32
|
NAK: Not acknowledge response.
|
|
33
|
+
UPLOAD_TOP_FIRMWARE_START: Start upload firmware (TOP).
|
|
34
|
+
UPLOAD_TOP_FIRMWARE_STOP: Stop upload firmware (TOP).
|
|
35
|
+
UPLOAD_TOP_FIRMWARE: Upload firmware (TOP).
|
|
36
|
+
ROTATE_ENABLE: Enable rotate.
|
|
37
|
+
ROTATE_DISABLE: Disable rotate.
|
|
25
38
|
UNKNOWN_26: Used after discover, unknown purpose.
|
|
26
39
|
ACTION: Action function.
|
|
27
40
|
"""
|
|
28
41
|
|
|
29
|
-
NONE = "00" # Undefined
|
|
30
|
-
DISCOVERY = "01" # Discover function
|
|
31
|
-
READ_DATAPOINT = "02" # Read datapoint
|
|
32
|
-
READ_CONFIG = "03" # Read configuration
|
|
33
|
-
WRITE_CONFIG = "04" # Write configuration
|
|
34
|
-
BLINK = "05" # Blink LED function
|
|
35
|
-
UNBLINK = "06" # Unblink LED function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
NONE = "00" # F00D Undefined
|
|
43
|
+
DISCOVERY = "01" # F01D Discover function
|
|
44
|
+
READ_DATAPOINT = "02" # F02D Read datapoint
|
|
45
|
+
READ_CONFIG = "03" # F03D Read configuration
|
|
46
|
+
WRITE_CONFIG = "04" # F04D Write configuration
|
|
47
|
+
BLINK = "05" # F05D Blink LED function
|
|
48
|
+
UNBLINK = "06" # F06D Unblink LED function
|
|
49
|
+
|
|
50
|
+
UPLOAD_FIRMWARE_START = "07" # F07D Start Upload firmware
|
|
51
|
+
UPLOAD_FIRMWARE_STOP = "08" # F08D Stop Upload firmware
|
|
52
|
+
UPLOAD_FIRMWARE = "09" # F09D Upload firmware
|
|
53
|
+
|
|
54
|
+
UPLOAD_ACTIONTABLE = "10" # F10D Upload ActionTable
|
|
55
|
+
DOWNLOAD_ACTIONTABLE = "11" # F11D Download ActionTable
|
|
56
|
+
UPLOAD_MSACTIONTABLE = "12" # F12D Upload MsActionTable to module
|
|
57
|
+
DOWNLOAD_MSACTIONTABLE = "13" # F13D Download MsActionTable
|
|
58
|
+
|
|
59
|
+
TELEGRAM_WRITE_START = "14" # F14D Start writing telegram
|
|
60
|
+
TELEGRAM_READ_START = "15" # F15D Start reading telegram
|
|
61
|
+
EOF = "16" # F16D End of msactiontable response
|
|
62
|
+
TELEGRAM = "17" # F17D module specific Telegram response
|
|
63
|
+
MSACTIONTABLE = "17" # F17D module specific ms action table (Telegram) response
|
|
64
|
+
ACTIONTABLE = "17" # F17D module specific action table (Telegram) response
|
|
65
|
+
ACK = "18" # F18D Acknowledge / continue response
|
|
66
|
+
NAK = "19" # F19D Not acknowledge response
|
|
67
|
+
|
|
68
|
+
UPLOAD_TOP_FIRMWARE_START = "20" # F20D Start Upload firmware (TOP)
|
|
69
|
+
UPLOAD_TOP_FIRMWARE_STOP = "21" # F21D Stop Upload firmware (TOP)
|
|
70
|
+
UPLOAD_TOP_FIRMWARE = "22" # F22D Upload firmware (TOP)
|
|
71
|
+
|
|
72
|
+
ROTATE_ENABLE = "23" # F23D Enable rotate
|
|
73
|
+
ROTATE_DISABLE = "24" # F24D Disable rotate
|
|
74
|
+
|
|
75
|
+
UNKNOWN_26 = "26" # F26D Used after discover, but don't know what it is
|
|
76
|
+
ACTION = "27" # F27D Action function
|
|
47
77
|
|
|
48
78
|
def get_description(self) -> str:
|
|
49
79
|
"""Get the description of the SystemFunction.
|
|
@@ -141,29 +141,38 @@ class ActionTableSerializer:
|
|
|
141
141
|
return ActionTableSerializer.from_data(data)
|
|
142
142
|
|
|
143
143
|
@staticmethod
|
|
144
|
-
def format_decoded_output(action_table: ActionTable) -> str:
|
|
144
|
+
def format_decoded_output(action_table: ActionTable) -> list[str]:
|
|
145
145
|
"""Format ActionTable as human-readable decoded output.
|
|
146
146
|
|
|
147
147
|
Args:
|
|
148
148
|
action_table: ActionTable to format
|
|
149
149
|
|
|
150
150
|
Returns:
|
|
151
|
-
|
|
151
|
+
List of human-readable string representations
|
|
152
152
|
"""
|
|
153
153
|
lines = []
|
|
154
154
|
for entry in action_table.entries:
|
|
155
|
-
# Format: CP20 0 0 > 1 OFF;
|
|
155
|
+
# Format: CP20 0 0 > 1 OFF [param];
|
|
156
156
|
module_type = entry.module_type.name
|
|
157
157
|
link = entry.link_number
|
|
158
158
|
input_num = entry.module_input
|
|
159
159
|
output = entry.module_output
|
|
160
160
|
command = entry.command.name
|
|
161
161
|
|
|
162
|
-
# Add prefix for
|
|
162
|
+
# Add prefix for inverted commands
|
|
163
163
|
if entry.inverted:
|
|
164
164
|
command = f"~{command}"
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
# Build base line
|
|
167
|
+
line = f"{module_type} {link} {input_num} > {output} {command}"
|
|
168
|
+
|
|
169
|
+
# Add parameter if present and non-zero
|
|
170
|
+
if entry.parameter is not None and entry.parameter.value != 0:
|
|
171
|
+
line += f" {entry.parameter.value}"
|
|
172
|
+
|
|
173
|
+
# Add semicolon terminator
|
|
174
|
+
line += ";"
|
|
175
|
+
|
|
167
176
|
lines.append(line)
|
|
168
177
|
|
|
169
|
-
return
|
|
178
|
+
return lines
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"""Service for downloading ActionTable via Conbus protocol."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from
|
|
4
|
+
from dataclasses import asdict
|
|
5
|
+
from typing import Any, Callable, Dict, Optional
|
|
5
6
|
|
|
6
7
|
from twisted.internet.posixbase import PosixReactorBase
|
|
7
8
|
|
|
@@ -44,14 +45,19 @@ class ActionTableService(ConbusProtocol):
|
|
|
44
45
|
self.serial_number: str = ""
|
|
45
46
|
self.progress_callback: Optional[Callable[[str], None]] = None
|
|
46
47
|
self.error_callback: Optional[Callable[[str], None]] = None
|
|
47
|
-
self.finish_callback: Optional[
|
|
48
|
+
self.finish_callback: Optional[
|
|
49
|
+
Callable[[ActionTable, Dict[str, Any], list[str]], None]
|
|
50
|
+
] = None
|
|
51
|
+
|
|
48
52
|
self.actiontable_data: list[str] = []
|
|
49
53
|
# Set up logging
|
|
50
54
|
self.logger = logging.getLogger(__name__)
|
|
51
55
|
|
|
52
56
|
def connection_established(self) -> None:
|
|
53
57
|
"""Handle connection established event."""
|
|
54
|
-
self.logger.debug(
|
|
58
|
+
self.logger.debug(
|
|
59
|
+
"Connection established, sending download actiontable telegram"
|
|
60
|
+
)
|
|
55
61
|
self.send_telegram(
|
|
56
62
|
telegram_type=TelegramType.SYSTEM,
|
|
57
63
|
serial_number=self.serial_number,
|
|
@@ -82,7 +88,9 @@ class ActionTableService(ConbusProtocol):
|
|
|
82
88
|
self.logger.debug("Not a reply response")
|
|
83
89
|
return
|
|
84
90
|
|
|
85
|
-
reply_telegram = self.telegram_service.parse_reply_telegram(
|
|
91
|
+
reply_telegram = self.telegram_service.parse_reply_telegram(
|
|
92
|
+
telegram_received.frame
|
|
93
|
+
)
|
|
86
94
|
if reply_telegram.system_function not in (
|
|
87
95
|
SystemFunction.ACTIONTABLE,
|
|
88
96
|
SystemFunction.EOF,
|
|
@@ -109,8 +117,10 @@ class ActionTableService(ConbusProtocol):
|
|
|
109
117
|
all_data = "".join(self.actiontable_data)
|
|
110
118
|
# Deserialize from received data
|
|
111
119
|
actiontable = self.serializer.from_encoded_string(all_data)
|
|
120
|
+
actiontable_dict = asdict(actiontable)
|
|
121
|
+
actiontable_short = self.serializer.format_decoded_output(actiontable)
|
|
112
122
|
if self.finish_callback:
|
|
113
|
-
self.finish_callback(actiontable)
|
|
123
|
+
self.finish_callback(actiontable, actiontable_dict, actiontable_short)
|
|
114
124
|
|
|
115
125
|
def failed(self, message: str) -> None:
|
|
116
126
|
"""Handle failed connection event.
|
|
@@ -127,7 +137,7 @@ class ActionTableService(ConbusProtocol):
|
|
|
127
137
|
serial_number: str,
|
|
128
138
|
progress_callback: Callable[[str], None],
|
|
129
139
|
error_callback: Callable[[str], None],
|
|
130
|
-
finish_callback: Callable[[ActionTable], None],
|
|
140
|
+
finish_callback: Callable[[ActionTable, Dict[str, Any], list[str]], None],
|
|
131
141
|
timeout_seconds: Optional[float] = None,
|
|
132
142
|
) -> None:
|
|
133
143
|
"""Run reactor in dedicated thread with its own event loop.
|
|
@@ -84,7 +84,9 @@ class MsActionTableService(ConbusProtocol):
|
|
|
84
84
|
|
|
85
85
|
def connection_established(self) -> None:
|
|
86
86
|
"""Handle connection established event."""
|
|
87
|
-
self.logger.debug(
|
|
87
|
+
self.logger.debug(
|
|
88
|
+
"Connection established, sending download msactiontable telegram"
|
|
89
|
+
)
|
|
88
90
|
self.send_telegram(
|
|
89
91
|
telegram_type=TelegramType.SYSTEM,
|
|
90
92
|
serial_number=self.serial_number,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|