conson-xp 1.45.0__py3-none-any.whl → 1.47.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.45.0.dist-info → conson_xp-1.47.0.dist-info}/METADATA +1 -1
- conson_xp-1.47.0.dist-info/RECORD +210 -0
- xp/__init__.py +3 -2
- xp/cli/commands/conbus/conbus.py +1 -1
- xp/cli/commands/conbus/conbus_actiontable_commands.py +33 -15
- xp/cli/commands/conbus/conbus_autoreport_commands.py +8 -4
- xp/cli/commands/conbus/conbus_blink_commands.py +20 -10
- xp/cli/commands/conbus/conbus_config_commands.py +2 -1
- xp/cli/commands/conbus/conbus_custom_commands.py +4 -2
- xp/cli/commands/conbus/conbus_datapoint_commands.py +10 -5
- xp/cli/commands/conbus/conbus_discover_commands.py +8 -4
- xp/cli/commands/conbus/conbus_event_commands.py +8 -4
- xp/cli/commands/conbus/conbus_export_commands.py +8 -4
- xp/cli/commands/conbus/conbus_lightlevel_commands.py +16 -8
- xp/cli/commands/conbus/conbus_linknumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_modulenumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_msactiontable_commands.py +78 -40
- xp/cli/commands/conbus/conbus_output_commands.py +16 -8
- xp/cli/commands/conbus/conbus_raw_commands.py +6 -3
- xp/cli/commands/conbus/conbus_receive_commands.py +6 -3
- xp/cli/commands/conbus/conbus_scan_commands.py +6 -3
- xp/cli/commands/file_commands.py +6 -3
- xp/cli/commands/homekit/homekit.py +4 -2
- xp/cli/commands/homekit/homekit_start_commands.py +2 -1
- xp/cli/commands/module_commands.py +8 -4
- xp/cli/commands/reverse_proxy_commands.py +8 -4
- xp/cli/commands/server/server_commands.py +6 -3
- xp/cli/commands/telegram/telegram_blink_commands.py +4 -2
- xp/cli/commands/telegram/telegram_checksum_commands.py +4 -2
- xp/cli/commands/telegram/telegram_discover_commands.py +2 -1
- xp/cli/commands/telegram/telegram_linknumber_commands.py +4 -2
- xp/cli/commands/telegram/telegram_parse_commands.py +4 -2
- xp/cli/commands/telegram/telegram_version_commands.py +2 -1
- xp/cli/commands/term/term_commands.py +4 -2
- xp/cli/main.py +2 -1
- xp/cli/utils/click_tree.py +6 -3
- xp/cli/utils/datapoint_type_choice.py +4 -2
- xp/cli/utils/decorators.py +42 -21
- xp/cli/utils/error_handlers.py +16 -8
- xp/cli/utils/formatters.py +22 -11
- xp/cli/utils/module_type_choice.py +4 -2
- xp/cli/utils/serial_number_type.py +4 -2
- xp/cli/utils/system_function_choice.py +4 -2
- xp/cli/utils/xp_module_type.py +4 -2
- xp/models/actiontable/actiontable.py +8 -8
- xp/models/actiontable/actiontable_type.py +20 -0
- xp/models/actiontable/msactiontable_xp20.py +8 -4
- xp/models/actiontable/msactiontable_xp24.py +12 -6
- xp/models/actiontable/msactiontable_xp33.py +20 -10
- xp/models/conbus/conbus.py +8 -4
- xp/models/conbus/conbus_autoreport.py +4 -2
- xp/models/conbus/conbus_blink.py +4 -2
- xp/models/conbus/conbus_client_config.py +6 -3
- xp/models/conbus/conbus_connection_status.py +4 -2
- xp/models/conbus/conbus_custom.py +4 -2
- xp/models/conbus/conbus_datapoint.py +4 -2
- xp/models/conbus/conbus_discover.py +6 -3
- xp/models/conbus/conbus_event_list.py +4 -2
- xp/models/conbus/conbus_event_raw.py +4 -2
- xp/models/conbus/conbus_export.py +2 -1
- xp/models/conbus/conbus_lightlevel.py +4 -2
- xp/models/conbus/conbus_linknumber.py +4 -2
- xp/models/conbus/conbus_logger_config.py +8 -4
- xp/models/conbus/conbus_output.py +4 -2
- xp/models/conbus/conbus_raw.py +4 -2
- xp/models/conbus/conbus_receive.py +4 -2
- xp/models/conbus/conbus_writeconfig.py +4 -2
- xp/models/config/conson_module_config.py +8 -4
- xp/models/homekit/homekit_accessory.py +4 -2
- xp/models/homekit/homekit_config.py +12 -6
- xp/models/log_entry.py +16 -8
- xp/models/protocol/conbus_protocol.py +36 -18
- xp/models/response.py +12 -8
- xp/models/telegram/action_type.py +4 -2
- xp/models/telegram/datapoint_type.py +4 -2
- xp/models/telegram/event_telegram.py +14 -7
- xp/models/telegram/event_type.py +2 -1
- xp/models/telegram/input_action_type.py +2 -1
- xp/models/telegram/input_type.py +2 -1
- xp/models/telegram/module_type.py +24 -12
- xp/models/telegram/module_type_code.py +2 -1
- xp/models/telegram/output_telegram.py +16 -10
- xp/models/telegram/reply_telegram.py +24 -13
- xp/models/telegram/system_function.py +6 -3
- xp/models/telegram/system_telegram.py +10 -6
- xp/models/telegram/telegram.py +2 -1
- xp/models/telegram/telegram_type.py +2 -1
- xp/models/telegram/timeparam_type.py +2 -1
- xp/models/term/connection_state.py +4 -2
- xp/models/term/module_state.py +2 -1
- xp/models/term/protocol_keys_config.py +6 -3
- xp/models/term/status_message.py +2 -1
- xp/models/term/telegram_display.py +2 -1
- xp/models/write_config_type.py +4 -2
- xp/services/actiontable/actiontable_serializer.py +34 -41
- xp/services/actiontable/download_state_machine.py +281 -0
- xp/services/actiontable/msactiontable_xp20_serializer.py +77 -49
- xp/services/actiontable/msactiontable_xp24_serializer.py +78 -53
- xp/services/actiontable/msactiontable_xp33_serializer.py +39 -9
- xp/services/actiontable/serializer_protocol.py +76 -0
- xp/services/conbus/actiontable/actiontable_download_service.py +134 -280
- xp/services/conbus/actiontable/actiontable_list_service.py +17 -4
- xp/services/conbus/actiontable/actiontable_show_service.py +10 -6
- xp/services/conbus/actiontable/actiontable_upload_service.py +17 -9
- xp/services/conbus/conbus_blink_all_service.py +16 -8
- xp/services/conbus/conbus_blink_service.py +14 -7
- xp/services/conbus/conbus_custom_service.py +16 -8
- xp/services/conbus/conbus_datapoint_queryall_service.py +18 -9
- xp/services/conbus/conbus_datapoint_service.py +18 -9
- xp/services/conbus/conbus_discover_service.py +24 -13
- xp/services/conbus/conbus_event_list_service.py +11 -7
- xp/services/conbus/conbus_event_raw_service.py +18 -10
- xp/services/conbus/conbus_export_service.py +28 -14
- xp/services/conbus/conbus_output_service.py +18 -10
- xp/services/conbus/conbus_raw_service.py +16 -8
- xp/services/conbus/conbus_receive_service.py +18 -10
- xp/services/conbus/conbus_scan_service.py +18 -10
- xp/services/conbus/msactiontable/msactiontable_upload_service.py +17 -9
- xp/services/conbus/write_config_service.py +18 -9
- xp/services/homekit/homekit_cache_service.py +12 -6
- xp/services/homekit/homekit_conbus_service.py +12 -6
- xp/services/homekit/homekit_config_validator.py +34 -17
- xp/services/homekit/homekit_conson_validator.py +18 -9
- xp/services/homekit/homekit_dimminglight.py +14 -7
- xp/services/homekit/homekit_dimminglight_service.py +14 -7
- xp/services/homekit/homekit_hap_service.py +18 -9
- xp/services/homekit/homekit_lightbulb.py +10 -5
- xp/services/homekit/homekit_lightbulb_service.py +10 -5
- xp/services/homekit/homekit_module_service.py +8 -4
- xp/services/homekit/homekit_outlet.py +14 -7
- xp/services/homekit/homekit_outlet_service.py +12 -6
- xp/services/homekit/homekit_service.py +24 -12
- xp/services/log_file_service.py +16 -8
- xp/services/module_type_service.py +10 -5
- xp/services/protocol/conbus_event_protocol.py +140 -21
- xp/services/protocol/conbus_protocol.py +36 -19
- xp/services/protocol/protocol_factory.py +12 -6
- xp/services/protocol/telegram_protocol.py +12 -6
- xp/services/reverse_proxy_service.py +26 -14
- xp/services/server/base_server_service.py +42 -23
- xp/services/server/client_buffer_manager.py +12 -7
- xp/services/server/cp20_server_service.py +10 -7
- xp/services/server/device_service_factory.py +12 -8
- xp/services/server/server_service.py +18 -11
- xp/services/server/xp130_server_service.py +11 -8
- xp/services/server/xp20_server_service.py +16 -10
- xp/services/server/xp230_server_service.py +10 -7
- xp/services/server/xp24_server_service.py +22 -13
- xp/services/server/xp33_server_service.py +44 -25
- xp/services/telegram/telegram_blink_service.py +14 -8
- xp/services/telegram/telegram_checksum_service.py +12 -7
- xp/services/telegram/telegram_datapoint_service.py +14 -9
- xp/services/telegram/telegram_discover_service.py +28 -15
- xp/services/telegram/telegram_link_number_service.py +18 -10
- xp/services/telegram/telegram_output_service.py +24 -12
- xp/services/telegram/telegram_service.py +22 -11
- xp/services/telegram/telegram_version_service.py +14 -8
- xp/services/term/protocol_monitor_service.py +30 -16
- xp/services/term/state_monitor_service.py +39 -21
- xp/term/protocol.py +12 -6
- xp/term/state.py +12 -7
- xp/term/widgets/help_menu.py +6 -3
- xp/term/widgets/modules_list.py +20 -10
- xp/term/widgets/protocol_log.py +12 -6
- xp/term/widgets/status_footer.py +10 -5
- xp/utils/checksum.py +6 -3
- xp/utils/dependencies.py +26 -31
- xp/utils/event_helper.py +6 -4
- xp/utils/logging.py +6 -3
- xp/utils/serialization.py +30 -16
- xp/utils/state_machine.py +16 -9
- xp/utils/time_utils.py +6 -3
- conson_xp-1.45.0.dist-info/RECORD +0 -210
- xp/services/conbus/msactiontable/msactiontable_download_service.py +0 -275
- xp/services/conbus/msactiontable/msactiontable_list_service.py +0 -100
- xp/services/conbus/msactiontable/msactiontable_show_service.py +0 -89
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -18,7 +18,8 @@ from xp.services.conbus.conbus_scan_service import ConbusScanService
|
|
|
18
18
|
@click.pass_context
|
|
19
19
|
@connection_command()
|
|
20
20
|
def scan_module(ctx: Context, serial_number: str, function_code: str) -> None:
|
|
21
|
-
r"""
|
|
21
|
+
r"""
|
|
22
|
+
Scan all datapoints of a function_code for a module.
|
|
22
23
|
|
|
23
24
|
Args:
|
|
24
25
|
ctx: Click context object.
|
|
@@ -34,7 +35,8 @@ def scan_module(ctx: Context, serial_number: str, function_code: str) -> None:
|
|
|
34
35
|
)
|
|
35
36
|
|
|
36
37
|
def on_progress(progress: str) -> None:
|
|
37
|
-
"""
|
|
38
|
+
"""
|
|
39
|
+
Handle progress updates during module scan.
|
|
38
40
|
|
|
39
41
|
Args:
|
|
40
42
|
progress: Progress message string.
|
|
@@ -42,7 +44,8 @@ def scan_module(ctx: Context, serial_number: str, function_code: str) -> None:
|
|
|
42
44
|
click.echo(progress)
|
|
43
45
|
|
|
44
46
|
def on_finish(service_response: ConbusResponse) -> None:
|
|
45
|
-
"""
|
|
47
|
+
"""
|
|
48
|
+
Handle successful completion of module scan.
|
|
46
49
|
|
|
47
50
|
Args:
|
|
48
51
|
service_response: Scan response object.
|
xp/cli/commands/file_commands.py
CHANGED
|
@@ -36,7 +36,8 @@ def decode_log_file(
|
|
|
36
36
|
time_range: str,
|
|
37
37
|
summary: bool,
|
|
38
38
|
) -> None:
|
|
39
|
-
r"""
|
|
39
|
+
r"""
|
|
40
|
+
Decode and parse console bus log file.
|
|
40
41
|
|
|
41
42
|
Args:
|
|
42
43
|
ctx: Click context object.
|
|
@@ -114,7 +115,8 @@ def decode_log_file(
|
|
|
114
115
|
@click.pass_context
|
|
115
116
|
@handle_service_errors(Exception)
|
|
116
117
|
def analyze_log_file(ctx: Context, log_file_path: str) -> None:
|
|
117
|
-
r"""
|
|
118
|
+
r"""
|
|
119
|
+
Analyze console bus log file for patterns and statistics.
|
|
118
120
|
|
|
119
121
|
Args:
|
|
120
122
|
ctx: Click context object.
|
|
@@ -148,7 +150,8 @@ def analyze_log_file(ctx: Context, log_file_path: str) -> None:
|
|
|
148
150
|
@click.pass_context
|
|
149
151
|
@handle_service_errors(Exception)
|
|
150
152
|
def validate_log_file(ctx: Context, log_file_path: str) -> None:
|
|
151
|
-
r"""
|
|
153
|
+
r"""
|
|
154
|
+
Validate console bus log file format and telegram checksums.
|
|
152
155
|
|
|
153
156
|
Args:
|
|
154
157
|
ctx: Click context object.
|
|
@@ -35,7 +35,8 @@ def config() -> None:
|
|
|
35
35
|
)
|
|
36
36
|
@service_command()
|
|
37
37
|
def validate(conson_config: str, homekit_config: str) -> None:
|
|
38
|
-
"""
|
|
38
|
+
"""
|
|
39
|
+
Validate homekit.yml and conson.yml coherence.
|
|
39
40
|
|
|
40
41
|
Args:
|
|
41
42
|
conson_config: Path to conson.yml configuration file.
|
|
@@ -98,7 +99,8 @@ def validate(conson_config: str, homekit_config: str) -> None:
|
|
|
98
99
|
)
|
|
99
100
|
@service_command()
|
|
100
101
|
def show_config(conson_config: str, homekit_config: str) -> None:
|
|
101
|
-
"""
|
|
102
|
+
"""
|
|
103
|
+
Display parsed configuration summary.
|
|
102
104
|
|
|
103
105
|
Args:
|
|
104
106
|
conson_config: Path to conson.yml configuration file.
|
|
@@ -12,7 +12,8 @@ from xp.services.homekit.homekit_service import HomeKitService
|
|
|
12
12
|
@homekit.command("start")
|
|
13
13
|
@click.pass_context
|
|
14
14
|
def homekit_start(ctx: Context) -> None:
|
|
15
|
-
r"""
|
|
15
|
+
r"""
|
|
16
|
+
Start the HomeKit server.
|
|
16
17
|
|
|
17
18
|
This command starts the XP Protocol HomeKit server using HAP-python.
|
|
18
19
|
The server provides HomeKit endpoints for Conbus operations.
|
|
@@ -26,7 +26,8 @@ def module() -> None:
|
|
|
26
26
|
@click.pass_context
|
|
27
27
|
@list_command(ModuleTypeNotFoundError)
|
|
28
28
|
def module_info(ctx: Context, identifier: str) -> None:
|
|
29
|
-
r"""
|
|
29
|
+
r"""
|
|
30
|
+
Get information about a module type by code or name.
|
|
30
31
|
|
|
31
32
|
Args:
|
|
32
33
|
ctx: Click context object.
|
|
@@ -65,7 +66,8 @@ def module_info(ctx: Context, identifier: str) -> None:
|
|
|
65
66
|
@click.pass_context
|
|
66
67
|
@list_command(Exception)
|
|
67
68
|
def module_list(ctx: Context, category: str, group_by_category: bool) -> None:
|
|
68
|
-
r"""
|
|
69
|
+
r"""
|
|
70
|
+
List module types, optionally filtered by category.
|
|
69
71
|
|
|
70
72
|
Args:
|
|
71
73
|
ctx: Click context object.
|
|
@@ -122,7 +124,8 @@ def module_list(ctx: Context, category: str, group_by_category: bool) -> None:
|
|
|
122
124
|
@click.pass_context
|
|
123
125
|
@list_command(Exception)
|
|
124
126
|
def module_search(ctx: Context, query: str, field: tuple) -> None:
|
|
125
|
-
r"""
|
|
127
|
+
r"""
|
|
128
|
+
Search for module types by name or description.
|
|
126
129
|
|
|
127
130
|
Args:
|
|
128
131
|
ctx: Click context object.
|
|
@@ -159,7 +162,8 @@ def module_search(ctx: Context, query: str, field: tuple) -> None:
|
|
|
159
162
|
@click.pass_context
|
|
160
163
|
@list_command(Exception)
|
|
161
164
|
def module_categories(ctx: Context) -> None:
|
|
162
|
-
r"""
|
|
165
|
+
r"""
|
|
166
|
+
List all available module categories.
|
|
163
167
|
|
|
164
168
|
Args:
|
|
165
169
|
ctx: Click context object.
|
|
@@ -41,7 +41,8 @@ def reverse_proxy() -> None:
|
|
|
41
41
|
@handle_service_errors(ReverseProxyError)
|
|
42
42
|
@click.pass_context
|
|
43
43
|
def start_proxy(ctx: Context, port: int, config: str) -> None:
|
|
44
|
-
r"""
|
|
44
|
+
r"""
|
|
45
|
+
Start the Conbus reverse proxy server.
|
|
45
46
|
|
|
46
47
|
The proxy listens on the specified port and forwards all telegrams
|
|
47
48
|
to the target server configured in cli.yml. All traffic is monitored
|
|
@@ -80,7 +81,8 @@ def start_proxy(ctx: Context, port: int, config: str) -> None:
|
|
|
80
81
|
|
|
81
82
|
# Handle graceful shutdown on SIGINT
|
|
82
83
|
def signal_handler(signum: int, frame: Optional[FrameType]) -> None:
|
|
83
|
-
"""
|
|
84
|
+
"""
|
|
85
|
+
Handle shutdown signals for graceful proxy termination.
|
|
84
86
|
|
|
85
87
|
Args:
|
|
86
88
|
signum: Signal number received.
|
|
@@ -116,7 +118,8 @@ def start_proxy(ctx: Context, port: int, config: str) -> None:
|
|
|
116
118
|
@reverse_proxy.command("stop")
|
|
117
119
|
@handle_service_errors(ReverseProxyError)
|
|
118
120
|
def stop_proxy() -> None:
|
|
119
|
-
r"""
|
|
121
|
+
r"""
|
|
122
|
+
Stop the running Conbus reverse proxy server.
|
|
120
123
|
|
|
121
124
|
Examples:
|
|
122
125
|
\b
|
|
@@ -146,7 +149,8 @@ def stop_proxy() -> None:
|
|
|
146
149
|
@reverse_proxy.command("status")
|
|
147
150
|
@handle_service_errors(Exception)
|
|
148
151
|
def proxy_status() -> None:
|
|
149
|
-
r"""
|
|
152
|
+
r"""
|
|
153
|
+
Get status of the Conbus reverse proxy server.
|
|
150
154
|
|
|
151
155
|
Shows current running state, listen port, target server,
|
|
152
156
|
and active connection details.
|
|
@@ -32,7 +32,8 @@ def server() -> None:
|
|
|
32
32
|
@click.pass_context
|
|
33
33
|
@handle_service_errors(ServerError)
|
|
34
34
|
def start_server(ctx: Context, port: int, config: str) -> None:
|
|
35
|
-
r"""
|
|
35
|
+
r"""
|
|
36
|
+
Start the Conbus emulator server.
|
|
36
37
|
|
|
37
38
|
Args:
|
|
38
39
|
ctx: Click context object.
|
|
@@ -80,7 +81,8 @@ def start_server(ctx: Context, port: int, config: str) -> None:
|
|
|
80
81
|
@server.command("stop")
|
|
81
82
|
@handle_service_errors(ServerError)
|
|
82
83
|
def stop_server() -> None:
|
|
83
|
-
r"""
|
|
84
|
+
r"""
|
|
85
|
+
Stop the running Conbus emulator server.
|
|
84
86
|
|
|
85
87
|
Examples:
|
|
86
88
|
\b
|
|
@@ -104,7 +106,8 @@ def stop_server() -> None:
|
|
|
104
106
|
@server.command("status")
|
|
105
107
|
@handle_service_errors(Exception)
|
|
106
108
|
def server_status() -> None:
|
|
107
|
-
r"""
|
|
109
|
+
r"""
|
|
110
|
+
Get status of the Conbus emulator server.
|
|
108
111
|
|
|
109
112
|
Examples:
|
|
110
113
|
\b
|
|
@@ -16,7 +16,8 @@ from xp.services.telegram.telegram_blink_service import BlinkError, TelegramBlin
|
|
|
16
16
|
@click.argument("serial_number", type=SERIAL)
|
|
17
17
|
@handle_service_errors(BlinkError)
|
|
18
18
|
def blink_on(serial_number: str) -> None:
|
|
19
|
-
r"""
|
|
19
|
+
r"""
|
|
20
|
+
Generate a telegram to start blinking module LED.
|
|
20
21
|
|
|
21
22
|
Args:
|
|
22
23
|
serial_number: 10-digit module serial number.
|
|
@@ -50,7 +51,8 @@ def blink_on(serial_number: str) -> None:
|
|
|
50
51
|
@click.argument("serial_number", type=SERIAL)
|
|
51
52
|
@handle_service_errors(BlinkError)
|
|
52
53
|
def blink_off(serial_number: str) -> None:
|
|
53
|
-
r"""
|
|
54
|
+
r"""
|
|
55
|
+
Generate a telegram to stop blinking module LED.
|
|
54
56
|
|
|
55
57
|
Args:
|
|
56
58
|
serial_number: 10-digit module serial number.
|
|
@@ -22,7 +22,8 @@ from xp.services.telegram.telegram_checksum_service import TelegramChecksumServi
|
|
|
22
22
|
)
|
|
23
23
|
@handle_service_errors(Exception)
|
|
24
24
|
def calculate_checksum(data: str, algorithm: str) -> None:
|
|
25
|
-
r"""
|
|
25
|
+
r"""
|
|
26
|
+
Calculate checksum for given data string.
|
|
26
27
|
|
|
27
28
|
Args:
|
|
28
29
|
data: Data string to calculate checksum for.
|
|
@@ -70,7 +71,8 @@ def calculate_checksum(data: str, algorithm: str) -> None:
|
|
|
70
71
|
)
|
|
71
72
|
@handle_service_errors(Exception)
|
|
72
73
|
def validate_checksum(data: str, expected_checksum: str, algorithm: str) -> None:
|
|
73
|
-
r"""
|
|
74
|
+
r"""
|
|
75
|
+
Validate data against expected checksum.
|
|
74
76
|
|
|
75
77
|
Args:
|
|
76
78
|
data: Data string to validate.
|
|
@@ -17,7 +17,8 @@ from xp.services.telegram.telegram_discover_service import (
|
|
|
17
17
|
@telegram.command("discover")
|
|
18
18
|
@handle_service_errors(DiscoverError)
|
|
19
19
|
def generate_discover() -> None:
|
|
20
|
-
r"""
|
|
20
|
+
r"""
|
|
21
|
+
Generate a discover telegram for device enumeration.
|
|
21
22
|
|
|
22
23
|
Examples:
|
|
23
24
|
\b
|
|
@@ -20,7 +20,8 @@ from xp.services.telegram.telegram_link_number_service import (
|
|
|
20
20
|
@click.argument("link_number", type=int)
|
|
21
21
|
@handle_service_errors(LinkNumberError)
|
|
22
22
|
def generate_set_link_number(serial_number: str, link_number: int) -> None:
|
|
23
|
-
r"""
|
|
23
|
+
r"""
|
|
24
|
+
Generate a telegram to set module link number.
|
|
24
25
|
|
|
25
26
|
Args:
|
|
26
27
|
serial_number: 10-digit module serial number.
|
|
@@ -57,7 +58,8 @@ def generate_set_link_number(serial_number: str, link_number: int) -> None:
|
|
|
57
58
|
@click.argument("serial_number", type=SERIAL)
|
|
58
59
|
@handle_service_errors(LinkNumberError)
|
|
59
60
|
def generate_read_link_number(serial_number: str) -> None:
|
|
60
|
-
r"""
|
|
61
|
+
r"""
|
|
62
|
+
Generate a telegram to read module link number.
|
|
61
63
|
|
|
62
64
|
Args:
|
|
63
65
|
serial_number: 10-digit module serial number.
|
|
@@ -17,7 +17,8 @@ from xp.services.telegram.telegram_service import TelegramParsingError, Telegram
|
|
|
17
17
|
@click.argument("telegram_string")
|
|
18
18
|
@handle_service_errors(TelegramParsingError)
|
|
19
19
|
def parse_any_telegram(telegram_string: str) -> None:
|
|
20
|
-
r"""
|
|
20
|
+
r"""
|
|
21
|
+
Auto-detect and parse any type of telegram (event, system, reply, or discover).
|
|
21
22
|
|
|
22
23
|
Args:
|
|
23
24
|
telegram_string: Telegram string to parse.
|
|
@@ -47,7 +48,8 @@ def parse_any_telegram(telegram_string: str) -> None:
|
|
|
47
48
|
@click.argument("telegram_string")
|
|
48
49
|
@handle_service_errors(TelegramParsingError)
|
|
49
50
|
def validate_telegram(telegram_string: str) -> None:
|
|
50
|
-
r"""
|
|
51
|
+
r"""
|
|
52
|
+
Validate the format of an event telegram.
|
|
51
53
|
|
|
52
54
|
Args:
|
|
53
55
|
telegram_string: Telegram string to validate.
|
|
@@ -19,7 +19,8 @@ from xp.services.telegram.telegram_version_service import (
|
|
|
19
19
|
@click.argument("serial_number", type=SERIAL)
|
|
20
20
|
@handle_service_errors(VersionParsingError)
|
|
21
21
|
def generate_version_request(serial_number: str) -> None:
|
|
22
|
-
r"""
|
|
22
|
+
r"""
|
|
23
|
+
Generate a telegram to request version information from a device.
|
|
23
24
|
|
|
24
25
|
Args:
|
|
25
26
|
serial_number: 10-digit module serial number.
|
|
@@ -9,7 +9,8 @@ from xp.cli.commands.term.term import term
|
|
|
9
9
|
@term.command("protocol")
|
|
10
10
|
@click.pass_context
|
|
11
11
|
def protocol_monitor(ctx: Context) -> None:
|
|
12
|
-
r"""
|
|
12
|
+
r"""
|
|
13
|
+
Start TUI for real-time protocol monitoring.
|
|
13
14
|
|
|
14
15
|
Displays live RX/TX telegram stream from Conbus server
|
|
15
16
|
in an interactive terminal interface.
|
|
@@ -30,7 +31,8 @@ def protocol_monitor(ctx: Context) -> None:
|
|
|
30
31
|
@term.command("state")
|
|
31
32
|
@click.pass_context
|
|
32
33
|
def state_monitor(ctx: Context) -> None:
|
|
33
|
-
r"""
|
|
34
|
+
r"""
|
|
35
|
+
Start TUI for module state monitoring.
|
|
34
36
|
|
|
35
37
|
Displays module states from Conson configuration with real-time
|
|
36
38
|
updates in an interactive terminal interface.
|
xp/cli/main.py
CHANGED
|
@@ -28,7 +28,8 @@ from xp.utils.logging import LoggerService
|
|
|
28
28
|
@click.version_option()
|
|
29
29
|
@click.pass_context
|
|
30
30
|
def cli(ctx: click.Context) -> None:
|
|
31
|
-
"""
|
|
31
|
+
"""
|
|
32
|
+
XP CLI tool for remote console bus operations.
|
|
32
33
|
|
|
33
34
|
Args:
|
|
34
35
|
ctx: Click context object for passing state between commands.
|
xp/cli/utils/click_tree.py
CHANGED
|
@@ -6,7 +6,8 @@ import click
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def add_tree_command(cli_group: click.Group, command_name: str = "help") -> Any:
|
|
9
|
-
"""
|
|
9
|
+
"""
|
|
10
|
+
Add a tree command to any Click group.
|
|
10
11
|
|
|
11
12
|
Args:
|
|
12
13
|
cli_group: The Click group to add the tree command to.
|
|
@@ -17,7 +18,8 @@ def add_tree_command(cli_group: click.Group, command_name: str = "help") -> Any:
|
|
|
17
18
|
"""
|
|
18
19
|
|
|
19
20
|
def print_command_tree(group: click.Group, ctx: click.Context, suffix: str) -> None:
|
|
20
|
-
"""
|
|
21
|
+
"""
|
|
22
|
+
Print command tree recursively.
|
|
21
23
|
|
|
22
24
|
Args:
|
|
23
25
|
group: The Click group to print.
|
|
@@ -39,7 +41,8 @@ def add_tree_command(cli_group: click.Group, command_name: str = "help") -> Any:
|
|
|
39
41
|
@cli_group.command(command_name)
|
|
40
42
|
@click.pass_context
|
|
41
43
|
def tree_command(ctx: click.Context) -> None:
|
|
42
|
-
"""
|
|
44
|
+
"""
|
|
45
|
+
Show complete command tree.
|
|
43
46
|
|
|
44
47
|
Args:
|
|
45
48
|
ctx: The Click context.
|
|
@@ -9,7 +9,8 @@ from xp.models.telegram.datapoint_type import DataPointType
|
|
|
9
9
|
|
|
10
10
|
# noinspection DuplicatedCode
|
|
11
11
|
class DatapointTypeChoice(click.ParamType):
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
Click parameter type for validating DataPointType enum values.
|
|
13
14
|
|
|
14
15
|
Attributes:
|
|
15
16
|
name: The parameter type name.
|
|
@@ -25,7 +26,8 @@ class DatapointTypeChoice(click.ParamType):
|
|
|
25
26
|
def convert(
|
|
26
27
|
self, value: Any, param: Optional[click.Parameter], ctx: Optional[click.Context]
|
|
27
28
|
) -> Any:
|
|
28
|
-
"""
|
|
29
|
+
"""
|
|
30
|
+
Convert and validate input to DataPointType enum.
|
|
29
31
|
|
|
30
32
|
Args:
|
|
31
33
|
value: The input value to convert.
|
xp/cli/utils/decorators.py
CHANGED
|
@@ -11,7 +11,8 @@ from xp.cli.utils.formatters import OutputFormatter
|
|
|
11
11
|
def handle_service_errors(
|
|
12
12
|
*service_exceptions: Type[Exception],
|
|
13
13
|
) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
14
|
-
"""
|
|
14
|
+
"""
|
|
15
|
+
Handle common service exceptions with consistent JSON error formatting.
|
|
15
16
|
|
|
16
17
|
Args:
|
|
17
18
|
service_exceptions: Tuple of exception types to catch and handle.
|
|
@@ -21,7 +22,8 @@ def handle_service_errors(
|
|
|
21
22
|
"""
|
|
22
23
|
|
|
23
24
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
24
|
-
"""
|
|
25
|
+
"""
|
|
26
|
+
Apply error handling to the decorated function.
|
|
25
27
|
|
|
26
28
|
Args:
|
|
27
29
|
func: The function to decorate.
|
|
@@ -32,7 +34,8 @@ def handle_service_errors(
|
|
|
32
34
|
|
|
33
35
|
@functools.wraps(func)
|
|
34
36
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
35
|
-
"""
|
|
37
|
+
"""
|
|
38
|
+
Execute function with error handling.
|
|
36
39
|
|
|
37
40
|
Args:
|
|
38
41
|
args: Positional arguments passed to the decorated function.
|
|
@@ -64,7 +67,8 @@ def handle_service_errors(
|
|
|
64
67
|
|
|
65
68
|
|
|
66
69
|
def common_options(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
67
|
-
"""
|
|
70
|
+
"""
|
|
71
|
+
Add validation option to command.
|
|
68
72
|
|
|
69
73
|
Args:
|
|
70
74
|
func: The function to decorate.
|
|
@@ -78,7 +82,8 @@ def common_options(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
|
78
82
|
def telegram_parser_command(
|
|
79
83
|
service_exceptions: Tuple[Type[Exception], ...] = (),
|
|
80
84
|
) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
81
|
-
"""
|
|
85
|
+
"""
|
|
86
|
+
Apply telegram parsing commands with standard error handling.
|
|
82
87
|
|
|
83
88
|
Args:
|
|
84
89
|
service_exceptions: Additional service exceptions to handle.
|
|
@@ -88,7 +93,8 @@ def telegram_parser_command(
|
|
|
88
93
|
"""
|
|
89
94
|
|
|
90
95
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
91
|
-
"""
|
|
96
|
+
"""
|
|
97
|
+
Apply telegram parser decorators.
|
|
92
98
|
|
|
93
99
|
Args:
|
|
94
100
|
func: The function to decorate.
|
|
@@ -113,7 +119,8 @@ def telegram_parser_command(
|
|
|
113
119
|
def service_command(
|
|
114
120
|
*service_exceptions: Type[Exception],
|
|
115
121
|
) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
116
|
-
"""
|
|
122
|
+
"""
|
|
123
|
+
Apply service-based commands with error handling and JSON output.
|
|
117
124
|
|
|
118
125
|
Args:
|
|
119
126
|
service_exceptions: Service exception types to handle.
|
|
@@ -123,7 +130,8 @@ def service_command(
|
|
|
123
130
|
"""
|
|
124
131
|
|
|
125
132
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
126
|
-
"""
|
|
133
|
+
"""
|
|
134
|
+
Apply service command decorators.
|
|
127
135
|
|
|
128
136
|
Args:
|
|
129
137
|
func: The function to decorate.
|
|
@@ -140,7 +148,8 @@ def service_command(
|
|
|
140
148
|
def list_command(
|
|
141
149
|
*service_exceptions: Type[Exception],
|
|
142
150
|
) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
143
|
-
"""
|
|
151
|
+
"""
|
|
152
|
+
Apply list/search commands with common options.
|
|
144
153
|
|
|
145
154
|
Args:
|
|
146
155
|
service_exceptions: Service exception types to handle.
|
|
@@ -150,7 +159,8 @@ def list_command(
|
|
|
150
159
|
"""
|
|
151
160
|
|
|
152
161
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
153
|
-
"""
|
|
162
|
+
"""
|
|
163
|
+
Apply list command decorators.
|
|
154
164
|
|
|
155
165
|
Args:
|
|
156
166
|
func: The function to decorate.
|
|
@@ -165,14 +175,16 @@ def list_command(
|
|
|
165
175
|
|
|
166
176
|
|
|
167
177
|
def file_operation_command() -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
168
|
-
"""
|
|
178
|
+
"""
|
|
179
|
+
Apply file operation commands with common filters.
|
|
169
180
|
|
|
170
181
|
Returns:
|
|
171
182
|
Decorator function for file operation commands.
|
|
172
183
|
"""
|
|
173
184
|
|
|
174
185
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
175
|
-
"""
|
|
186
|
+
"""
|
|
187
|
+
Apply file operation decorators.
|
|
176
188
|
|
|
177
189
|
Args:
|
|
178
190
|
func: The function to decorate.
|
|
@@ -201,7 +213,8 @@ def file_operation_command() -> Callable[[Callable[..., Any]], Callable[..., Any
|
|
|
201
213
|
def with_formatter(
|
|
202
214
|
formatter_class: Any = None,
|
|
203
215
|
) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
204
|
-
"""
|
|
216
|
+
"""
|
|
217
|
+
Inject a formatter instance into the command.
|
|
205
218
|
|
|
206
219
|
Args:
|
|
207
220
|
formatter_class: Custom formatter class to use.
|
|
@@ -211,7 +224,8 @@ def with_formatter(
|
|
|
211
224
|
"""
|
|
212
225
|
|
|
213
226
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
214
|
-
"""
|
|
227
|
+
"""
|
|
228
|
+
Apply formatter injection.
|
|
215
229
|
|
|
216
230
|
Args:
|
|
217
231
|
func: The function to decorate.
|
|
@@ -222,7 +236,8 @@ def with_formatter(
|
|
|
222
236
|
|
|
223
237
|
@functools.wraps(func)
|
|
224
238
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
225
|
-
"""
|
|
239
|
+
"""
|
|
240
|
+
Execute function with injected formatter.
|
|
226
241
|
|
|
227
242
|
Args:
|
|
228
243
|
args: Positional arguments passed to the decorated function.
|
|
@@ -244,7 +259,8 @@ def with_formatter(
|
|
|
244
259
|
def require_arguments(
|
|
245
260
|
*required_args: str,
|
|
246
261
|
) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
247
|
-
"""
|
|
262
|
+
"""
|
|
263
|
+
Validate required arguments are present.
|
|
248
264
|
|
|
249
265
|
Args:
|
|
250
266
|
required_args: Names of required arguments.
|
|
@@ -254,7 +270,8 @@ def require_arguments(
|
|
|
254
270
|
"""
|
|
255
271
|
|
|
256
272
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
257
|
-
"""
|
|
273
|
+
"""
|
|
274
|
+
Apply argument validation.
|
|
258
275
|
|
|
259
276
|
Args:
|
|
260
277
|
func: The function to decorate.
|
|
@@ -265,7 +282,8 @@ def require_arguments(
|
|
|
265
282
|
|
|
266
283
|
@functools.wraps(func)
|
|
267
284
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
268
|
-
"""
|
|
285
|
+
"""
|
|
286
|
+
Execute function with argument validation.
|
|
269
287
|
|
|
270
288
|
Args:
|
|
271
289
|
args: Positional arguments passed to the decorated function.
|
|
@@ -300,14 +318,16 @@ def require_arguments(
|
|
|
300
318
|
|
|
301
319
|
|
|
302
320
|
def connection_command() -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
303
|
-
"""
|
|
321
|
+
"""
|
|
322
|
+
Apply commands that connect to remote services.
|
|
304
323
|
|
|
305
324
|
Returns:
|
|
306
325
|
Decorator function for connection commands.
|
|
307
326
|
"""
|
|
308
327
|
|
|
309
328
|
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
310
|
-
"""
|
|
329
|
+
"""
|
|
330
|
+
Apply connection command decorators.
|
|
311
331
|
|
|
312
332
|
Args:
|
|
313
333
|
func: The function to decorate.
|
|
@@ -318,7 +338,8 @@ def connection_command() -> Callable[[Callable[..., Any]], Callable[..., Any]]:
|
|
|
318
338
|
|
|
319
339
|
@functools.wraps(func)
|
|
320
340
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
321
|
-
"""
|
|
341
|
+
"""
|
|
342
|
+
Execute function with connection error handling.
|
|
322
343
|
|
|
323
344
|
Args:
|
|
324
345
|
args: Positional arguments passed to the decorated function.
|
xp/cli/utils/error_handlers.py
CHANGED
|
@@ -16,7 +16,8 @@ class CLIErrorHandler:
|
|
|
16
16
|
raw_input: str,
|
|
17
17
|
context: Optional[Dict[str, Any]] = None,
|
|
18
18
|
) -> None:
|
|
19
|
-
"""
|
|
19
|
+
"""
|
|
20
|
+
Handle telegram parsing errors with JSON formatting.
|
|
20
21
|
|
|
21
22
|
Args:
|
|
22
23
|
error: The parsing error that occurred.
|
|
@@ -40,7 +41,8 @@ class CLIErrorHandler:
|
|
|
40
41
|
def handle_connection_error(
|
|
41
42
|
error: Exception, config: Optional[Dict[str, Any]] = None
|
|
42
43
|
) -> None:
|
|
43
|
-
"""
|
|
44
|
+
"""
|
|
45
|
+
Handle connection/network errors with JSON formatting.
|
|
44
46
|
|
|
45
47
|
Args:
|
|
46
48
|
error: The connection error that occurred.
|
|
@@ -76,7 +78,8 @@ class CLIErrorHandler:
|
|
|
76
78
|
def handle_service_error(
|
|
77
79
|
error: Exception, operation: str, context: Optional[Dict[str, Any]] = None
|
|
78
80
|
) -> None:
|
|
79
|
-
"""
|
|
81
|
+
"""
|
|
82
|
+
Handle general service errors with JSON formatting.
|
|
80
83
|
|
|
81
84
|
Args:
|
|
82
85
|
error: The service error that occurred.
|
|
@@ -98,7 +101,8 @@ class CLIErrorHandler:
|
|
|
98
101
|
|
|
99
102
|
@staticmethod
|
|
100
103
|
def handle_validation_error(error: Exception, input_data: str) -> None:
|
|
101
|
-
"""
|
|
104
|
+
"""
|
|
105
|
+
Handle validation errors with JSON formatting.
|
|
102
106
|
|
|
103
107
|
Args:
|
|
104
108
|
error: The validation error that occurred.
|
|
@@ -120,7 +124,8 @@ class CLIErrorHandler:
|
|
|
120
124
|
file_path: str,
|
|
121
125
|
operation: str = "processing",
|
|
122
126
|
) -> None:
|
|
123
|
-
"""
|
|
127
|
+
"""
|
|
128
|
+
Handle file operation errors with JSON formatting.
|
|
124
129
|
|
|
125
130
|
Args:
|
|
126
131
|
error: The file error that occurred.
|
|
@@ -141,7 +146,8 @@ class CLIErrorHandler:
|
|
|
141
146
|
def handle_not_found_error(
|
|
142
147
|
error: Exception, item_type: str, identifier: str
|
|
143
148
|
) -> None:
|
|
144
|
-
"""
|
|
149
|
+
"""
|
|
150
|
+
Handle 'not found' errors with JSON formatting.
|
|
145
151
|
|
|
146
152
|
Args:
|
|
147
153
|
error: The not found error that occurred.
|
|
@@ -166,7 +172,8 @@ class ServerErrorHandler(CLIErrorHandler):
|
|
|
166
172
|
def handle_server_startup_error(
|
|
167
173
|
error: Exception, port: int, config_path: str
|
|
168
174
|
) -> None:
|
|
169
|
-
"""
|
|
175
|
+
"""
|
|
176
|
+
Handle server startup errors with JSON formatting.
|
|
170
177
|
|
|
171
178
|
Args:
|
|
172
179
|
error: The server startup error that occurred.
|
|
@@ -189,7 +196,8 @@ class ServerErrorHandler(CLIErrorHandler):
|
|
|
189
196
|
|
|
190
197
|
@staticmethod
|
|
191
198
|
def handle_server_not_running_error() -> None:
|
|
192
|
-
"""
|
|
199
|
+
"""
|
|
200
|
+
Handle errors when server is not running with JSON formatting.
|
|
193
201
|
|
|
194
202
|
Raises:
|
|
195
203
|
SystemExit: Always exits with code 1 after displaying error.
|