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
|
@@ -19,7 +19,8 @@ from xp.services.conbus.conbus_discover_service import (
|
|
|
19
19
|
@click.pass_context
|
|
20
20
|
@connection_command()
|
|
21
21
|
def send_discover_telegram(ctx: click.Context) -> None:
|
|
22
|
-
r"""
|
|
22
|
+
r"""
|
|
23
|
+
Send discover telegram to Conbus server.
|
|
23
24
|
|
|
24
25
|
Args:
|
|
25
26
|
ctx: Click context object.
|
|
@@ -30,7 +31,8 @@ def send_discover_telegram(ctx: click.Context) -> None:
|
|
|
30
31
|
"""
|
|
31
32
|
|
|
32
33
|
def on_finish(discovered_devices: ConbusDiscoverResponse) -> None:
|
|
33
|
-
"""
|
|
34
|
+
"""
|
|
35
|
+
Handle successful completion of device discovery.
|
|
34
36
|
|
|
35
37
|
Args:
|
|
36
38
|
discovered_devices: Discover response with all found devices.
|
|
@@ -39,7 +41,8 @@ def send_discover_telegram(ctx: click.Context) -> None:
|
|
|
39
41
|
service.stop_reactor()
|
|
40
42
|
|
|
41
43
|
def on_device_discovered(discovered_device: DiscoveredDevice) -> None:
|
|
42
|
-
"""
|
|
44
|
+
"""
|
|
45
|
+
Handle discovery of sa single module.
|
|
43
46
|
|
|
44
47
|
Args:
|
|
45
48
|
discovered_device: Discover device.
|
|
@@ -47,7 +50,8 @@ def send_discover_telegram(ctx: click.Context) -> None:
|
|
|
47
50
|
click.echo(json.dumps(discovered_device, indent=2))
|
|
48
51
|
|
|
49
52
|
def progress(_serial_number: str) -> None:
|
|
50
|
-
"""
|
|
53
|
+
"""
|
|
54
|
+
Handle progress updates during device discovery.
|
|
51
55
|
|
|
52
56
|
Args:
|
|
53
57
|
_serial_number: Serial number of discovered device (unused).
|
|
@@ -15,7 +15,8 @@ from xp.services.conbus.conbus_event_raw_service import ConbusEventRawService
|
|
|
15
15
|
@conbus_event.command("list")
|
|
16
16
|
@click.pass_context
|
|
17
17
|
def list_events(ctx: click.Context) -> None:
|
|
18
|
-
r"""
|
|
18
|
+
r"""
|
|
19
|
+
List configured event telegrams from module action tables.
|
|
19
20
|
|
|
20
21
|
Reads conson.yml configuration, parses action tables, and groups
|
|
21
22
|
modules by their event keys to show which modules are assigned to
|
|
@@ -50,7 +51,8 @@ def send_event_raw(
|
|
|
50
51
|
input_number: int,
|
|
51
52
|
time_ms: int,
|
|
52
53
|
) -> None:
|
|
53
|
-
r"""
|
|
54
|
+
r"""
|
|
55
|
+
Send raw event telegrams to simulate button presses.
|
|
54
56
|
|
|
55
57
|
Args:
|
|
56
58
|
ctx: Click context object.
|
|
@@ -66,7 +68,8 @@ def send_event_raw(
|
|
|
66
68
|
"""
|
|
67
69
|
|
|
68
70
|
def on_finish(response: ConbusEventRawResponse) -> None:
|
|
69
|
-
"""
|
|
71
|
+
"""
|
|
72
|
+
Handle successful completion of event raw operation.
|
|
70
73
|
|
|
71
74
|
Args:
|
|
72
75
|
response: Event raw response with sent and received telegrams.
|
|
@@ -74,7 +77,8 @@ def send_event_raw(
|
|
|
74
77
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
75
78
|
|
|
76
79
|
def on_progress(telegram: str) -> None:
|
|
77
|
-
"""
|
|
80
|
+
"""
|
|
81
|
+
Handle progress updates during event operation.
|
|
78
82
|
|
|
79
83
|
Args:
|
|
80
84
|
telegram: Received telegram.
|
|
@@ -15,7 +15,8 @@ from xp.services.conbus.conbus_export_service import ConbusExportService
|
|
|
15
15
|
@click.pass_context
|
|
16
16
|
@connection_command()
|
|
17
17
|
def export_conbus_config(ctx: click.Context) -> None:
|
|
18
|
-
r"""
|
|
18
|
+
r"""
|
|
19
|
+
Export Conbus device metadata to YAML file.
|
|
19
20
|
|
|
20
21
|
Discovers all devices on the Conbus network and queries their configuration
|
|
21
22
|
datapoints to generate a complete export.yml file in conson.yml format.
|
|
@@ -31,7 +32,8 @@ def export_conbus_config(ctx: click.Context) -> None:
|
|
|
31
32
|
"""
|
|
32
33
|
|
|
33
34
|
def on_progress(serial_number: str, current: int, total: int) -> None:
|
|
34
|
-
"""
|
|
35
|
+
"""
|
|
36
|
+
Handle progress updates during export.
|
|
35
37
|
|
|
36
38
|
Args:
|
|
37
39
|
serial_number: Serial number of discovered device.
|
|
@@ -41,7 +43,8 @@ def export_conbus_config(ctx: click.Context) -> None:
|
|
|
41
43
|
click.echo(f"Querying device {current}/{total}: {serial_number}...")
|
|
42
44
|
|
|
43
45
|
def on_device_exported(module: ConsonModuleConfig) -> None:
|
|
44
|
-
"""
|
|
46
|
+
"""
|
|
47
|
+
Handle device export completion.
|
|
45
48
|
|
|
46
49
|
Args:
|
|
47
50
|
module: Exported module configuration.
|
|
@@ -58,7 +61,8 @@ def export_conbus_config(ctx: click.Context) -> None:
|
|
|
58
61
|
click.echo(f" ✓ Software version: {module.sw_version}")
|
|
59
62
|
|
|
60
63
|
def on_finish(result: ConbusExportResponse) -> None:
|
|
61
|
-
"""
|
|
64
|
+
"""
|
|
65
|
+
Handle export completion.
|
|
62
66
|
|
|
63
67
|
Args:
|
|
64
68
|
result: Export result.
|
|
@@ -26,7 +26,8 @@ from xp.services.telegram.telegram_datapoint_service import TelegramDatapointSer
|
|
|
26
26
|
def xp_lightlevel_set(
|
|
27
27
|
ctx: click.Context, serial_number: str, output_number: int, level: int
|
|
28
28
|
) -> None:
|
|
29
|
-
r"""
|
|
29
|
+
r"""
|
|
30
|
+
Set light level for output_number on XP module serial_number.
|
|
30
31
|
|
|
31
32
|
Args:
|
|
32
33
|
ctx: Click context object.
|
|
@@ -44,7 +45,8 @@ def xp_lightlevel_set(
|
|
|
44
45
|
)
|
|
45
46
|
|
|
46
47
|
def on_finish(response: "ConbusWriteConfigResponse") -> None:
|
|
47
|
-
"""
|
|
48
|
+
"""
|
|
49
|
+
Handle successful completion of light level on command.
|
|
48
50
|
|
|
49
51
|
Args:
|
|
50
52
|
response: Light level response object.
|
|
@@ -73,7 +75,8 @@ def xp_lightlevel_set(
|
|
|
73
75
|
def xp_lightlevel_off(
|
|
74
76
|
ctx: click.Context, serial_number: str, output_number: int
|
|
75
77
|
) -> None:
|
|
76
|
-
r"""
|
|
78
|
+
r"""
|
|
79
|
+
Turn off light for output_number on XP module serial_number (set level to 0).
|
|
77
80
|
|
|
78
81
|
Args:
|
|
79
82
|
ctx: Click context object.
|
|
@@ -90,7 +93,8 @@ def xp_lightlevel_off(
|
|
|
90
93
|
)
|
|
91
94
|
|
|
92
95
|
def on_finish(response: "ConbusWriteConfigResponse") -> None:
|
|
93
|
-
"""
|
|
96
|
+
"""
|
|
97
|
+
Handle successful completion of light level on command.
|
|
94
98
|
|
|
95
99
|
Args:
|
|
96
100
|
response: Light level response object.
|
|
@@ -120,7 +124,8 @@ def xp_lightlevel_off(
|
|
|
120
124
|
def xp_lightlevel_on(
|
|
121
125
|
ctx: click.Context, serial_number: str, output_number: int
|
|
122
126
|
) -> None:
|
|
123
|
-
r"""
|
|
127
|
+
r"""
|
|
128
|
+
Turn on light for output_number on XP module serial_number (set level to 80%).
|
|
124
129
|
|
|
125
130
|
Args:
|
|
126
131
|
ctx: Click context object.
|
|
@@ -137,7 +142,8 @@ def xp_lightlevel_on(
|
|
|
137
142
|
)
|
|
138
143
|
|
|
139
144
|
def on_finish(response: "ConbusWriteConfigResponse") -> None:
|
|
140
|
-
"""
|
|
145
|
+
"""
|
|
146
|
+
Handle successful completion of light level on command.
|
|
141
147
|
|
|
142
148
|
Args:
|
|
143
149
|
response: Light level response object.
|
|
@@ -167,7 +173,8 @@ def xp_lightlevel_on(
|
|
|
167
173
|
def xp_lightlevel_get(
|
|
168
174
|
ctx: click.Context, serial_number: str, output_number: int
|
|
169
175
|
) -> None:
|
|
170
|
-
r"""
|
|
176
|
+
r"""
|
|
177
|
+
Get current light level for output_number on XP module serial_number.
|
|
171
178
|
|
|
172
179
|
Args:
|
|
173
180
|
ctx: Click context object.
|
|
@@ -188,7 +195,8 @@ def xp_lightlevel_get(
|
|
|
188
195
|
)
|
|
189
196
|
|
|
190
197
|
def on_finish(service_response: "ConbusDatapointResponse") -> None:
|
|
191
|
-
"""
|
|
198
|
+
"""
|
|
199
|
+
Handle successful completion of light level get command.
|
|
192
200
|
|
|
193
201
|
Args:
|
|
194
202
|
service_response: Light level response object.
|
|
@@ -25,7 +25,8 @@ from xp.services.telegram.telegram_datapoint_service import TelegramDatapointSer
|
|
|
25
25
|
def set_linknumber_command(
|
|
26
26
|
ctx: click.Context, serial_number: str, link_number: int
|
|
27
27
|
) -> None:
|
|
28
|
-
r"""
|
|
28
|
+
r"""
|
|
29
|
+
Set the link number for a specific module.
|
|
29
30
|
|
|
30
31
|
Args:
|
|
31
32
|
ctx: Click context object.
|
|
@@ -41,7 +42,8 @@ def set_linknumber_command(
|
|
|
41
42
|
)
|
|
42
43
|
|
|
43
44
|
def on_finish(response: "ConbusWriteConfigResponse") -> None:
|
|
44
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Handle successful completion of light level on command.
|
|
45
47
|
|
|
46
48
|
Args:
|
|
47
49
|
response: Light level response object.
|
|
@@ -66,7 +68,8 @@ def set_linknumber_command(
|
|
|
66
68
|
@click.pass_context
|
|
67
69
|
@connection_command()
|
|
68
70
|
def get_linknumber_command(ctx: click.Context, serial_number: str) -> None:
|
|
69
|
-
r"""
|
|
71
|
+
r"""
|
|
72
|
+
Get the current link number for a specific module.
|
|
70
73
|
|
|
71
74
|
Args:
|
|
72
75
|
ctx: Click context object.
|
|
@@ -84,7 +87,8 @@ def get_linknumber_command(ctx: click.Context, serial_number: str) -> None:
|
|
|
84
87
|
)
|
|
85
88
|
|
|
86
89
|
def on_finish(service_response: ConbusDatapointResponse) -> None:
|
|
87
|
-
"""
|
|
90
|
+
"""
|
|
91
|
+
Handle successful completion of link number get command.
|
|
88
92
|
|
|
89
93
|
Args:
|
|
90
94
|
service_response: Link number response object.
|
|
@@ -25,7 +25,8 @@ from xp.services.telegram.telegram_datapoint_service import TelegramDatapointSer
|
|
|
25
25
|
def set_modulenumber_command(
|
|
26
26
|
ctx: click.Context, serial_number: str, module_number: int
|
|
27
27
|
) -> None:
|
|
28
|
-
r"""
|
|
28
|
+
r"""
|
|
29
|
+
Set the module number for a specific module.
|
|
29
30
|
|
|
30
31
|
Args:
|
|
31
32
|
ctx: Click context object.
|
|
@@ -41,7 +42,8 @@ def set_modulenumber_command(
|
|
|
41
42
|
)
|
|
42
43
|
|
|
43
44
|
def on_finish(response: "ConbusWriteConfigResponse") -> None:
|
|
44
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Handle successful completion of light level on command.
|
|
45
47
|
|
|
46
48
|
Args:
|
|
47
49
|
response: Light level response object.
|
|
@@ -66,7 +68,8 @@ def set_modulenumber_command(
|
|
|
66
68
|
@click.pass_context
|
|
67
69
|
@connection_command()
|
|
68
70
|
def get_modulenumber_command(ctx: click.Context, serial_number: str) -> None:
|
|
69
|
-
r"""
|
|
71
|
+
r"""
|
|
72
|
+
Get the current module number for a specific module.
|
|
70
73
|
|
|
71
74
|
Args:
|
|
72
75
|
ctx: Click context object.
|
|
@@ -84,7 +87,8 @@ def get_modulenumber_command(ctx: click.Context, serial_number: str) -> None:
|
|
|
84
87
|
)
|
|
85
88
|
|
|
86
89
|
def on_finish(service_response: ConbusDatapointResponse) -> None:
|
|
87
|
-
"""
|
|
90
|
+
"""
|
|
91
|
+
Handle successful completion of module number get command.
|
|
88
92
|
|
|
89
93
|
Args:
|
|
90
94
|
service_response: Module number response object.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""XP24 Action Table CLI commands."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
-
from typing import Union
|
|
4
|
+
from typing import Any, Union
|
|
5
5
|
|
|
6
6
|
import click
|
|
7
7
|
from click import Context
|
|
@@ -12,24 +12,45 @@ from xp.cli.utils.decorators import (
|
|
|
12
12
|
)
|
|
13
13
|
from xp.cli.utils.serial_number_type import SERIAL
|
|
14
14
|
from xp.cli.utils.xp_module_type import XP_MODULE_TYPE
|
|
15
|
-
from xp.models.actiontable.
|
|
16
|
-
from xp.models.actiontable.msactiontable_xp24 import Xp24MsActionTable
|
|
17
|
-
from xp.models.actiontable.msactiontable_xp33 import Xp33MsActionTable
|
|
15
|
+
from xp.models.actiontable.actiontable_type import ActionTableType
|
|
18
16
|
from xp.models.config.conson_module_config import ConsonModuleConfig
|
|
19
|
-
from xp.services.conbus.
|
|
20
|
-
|
|
17
|
+
from xp.services.conbus.actiontable.actiontable_download_service import (
|
|
18
|
+
ActionTableDownloadService,
|
|
21
19
|
)
|
|
22
|
-
from xp.services.conbus.
|
|
23
|
-
|
|
20
|
+
from xp.services.conbus.actiontable.actiontable_list_service import (
|
|
21
|
+
ActionTableListService,
|
|
24
22
|
)
|
|
25
|
-
from xp.services.conbus.
|
|
26
|
-
|
|
23
|
+
from xp.services.conbus.actiontable.actiontable_show_service import (
|
|
24
|
+
ActionTableShowService,
|
|
27
25
|
)
|
|
28
26
|
from xp.services.conbus.msactiontable.msactiontable_upload_service import (
|
|
29
27
|
MsActionTableUploadService,
|
|
30
28
|
)
|
|
31
29
|
|
|
32
30
|
|
|
31
|
+
def _get_actiontable_type(xpmoduletype: str) -> ActionTableType:
|
|
32
|
+
"""
|
|
33
|
+
Map xpmoduletype string to ActionTableType enum.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
xpmoduletype: XP module type string (xp20, xp24, xp33).
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Corresponding ActionTableType enum value.
|
|
40
|
+
|
|
41
|
+
Raises:
|
|
42
|
+
ClickException: If module type is not supported.
|
|
43
|
+
"""
|
|
44
|
+
type_map = {
|
|
45
|
+
"xp20": ActionTableType.MSACTIONTABLE_XP20,
|
|
46
|
+
"xp24": ActionTableType.MSACTIONTABLE_XP24,
|
|
47
|
+
"xp33": ActionTableType.MSACTIONTABLE_XP33,
|
|
48
|
+
}
|
|
49
|
+
if xpmoduletype not in type_map:
|
|
50
|
+
raise click.ClickException(f"Unsupported module type: {xpmoduletype}")
|
|
51
|
+
return type_map[xpmoduletype]
|
|
52
|
+
|
|
53
|
+
|
|
33
54
|
@conbus_msactiontable.command("download", short_help="Download MSActionTable")
|
|
34
55
|
@click.argument("serial_number", type=SERIAL)
|
|
35
56
|
@click.argument("xpmoduletype", type=XP_MODULE_TYPE)
|
|
@@ -38,37 +59,38 @@ from xp.services.conbus.msactiontable.msactiontable_upload_service import (
|
|
|
38
59
|
def conbus_download_msactiontable(
|
|
39
60
|
ctx: Context, serial_number: str, xpmoduletype: str
|
|
40
61
|
) -> None:
|
|
41
|
-
"""
|
|
62
|
+
"""
|
|
63
|
+
Download MS action table from XP24 module.
|
|
42
64
|
|
|
43
65
|
Args:
|
|
44
66
|
ctx: Click context object.
|
|
45
67
|
serial_number: 10-digit module serial number.
|
|
46
68
|
xpmoduletype: XP module type.
|
|
47
69
|
"""
|
|
48
|
-
service:
|
|
49
|
-
ctx.obj.get("container").get_container().resolve(
|
|
70
|
+
service: ActionTableDownloadService = (
|
|
71
|
+
ctx.obj.get("container").get_container().resolve(ActionTableDownloadService)
|
|
50
72
|
)
|
|
51
73
|
|
|
52
74
|
def on_progress(progress: str) -> None:
|
|
53
|
-
"""
|
|
75
|
+
"""
|
|
76
|
+
Handle progress updates during MS action table download.
|
|
54
77
|
|
|
55
78
|
Args:
|
|
56
79
|
progress: Progress message string.
|
|
57
80
|
"""
|
|
58
81
|
click.echo(progress, nl=False)
|
|
59
82
|
|
|
60
|
-
def
|
|
61
|
-
msaction_table:
|
|
83
|
+
def on_actiontable_received(
|
|
84
|
+
msaction_table: Any,
|
|
62
85
|
msaction_table_short: list[str],
|
|
63
86
|
) -> None:
|
|
64
|
-
"""
|
|
87
|
+
"""
|
|
88
|
+
Handle successful completion of XP24 MS action table download.
|
|
65
89
|
|
|
66
90
|
Args:
|
|
67
91
|
msaction_table: Downloaded XP MS action table object.
|
|
68
92
|
msaction_table_short: Short version of XP24 MS action table.
|
|
69
93
|
"""
|
|
70
|
-
service.stop_reactor()
|
|
71
|
-
|
|
72
94
|
# Format short representation based on module type
|
|
73
95
|
short_field_name = f"{xpmoduletype}_msaction_table"
|
|
74
96
|
# XP24 returns single-element list, XP20/XP33 return multi-line lists
|
|
@@ -86,23 +108,28 @@ def conbus_download_msactiontable(
|
|
|
86
108
|
}
|
|
87
109
|
click.echo(json.dumps(output, indent=2, default=str))
|
|
88
110
|
|
|
111
|
+
def on_finish() -> None:
|
|
112
|
+
"""Handle download completion."""
|
|
113
|
+
service.stop_reactor()
|
|
114
|
+
|
|
89
115
|
def on_error(error: str) -> None:
|
|
90
|
-
"""
|
|
116
|
+
"""
|
|
117
|
+
Handle errors during MS action table download.
|
|
91
118
|
|
|
92
119
|
Args:
|
|
93
120
|
error: Error message string.
|
|
94
121
|
"""
|
|
95
122
|
click.echo(f"Error: {error}")
|
|
123
|
+
service.stop_reactor()
|
|
96
124
|
|
|
97
125
|
with service:
|
|
98
126
|
service.on_progress.connect(on_progress)
|
|
99
|
-
service.
|
|
100
|
-
|
|
101
|
-
# Connect to the appropriate signal based on module type
|
|
127
|
+
service.on_actiontable_received.connect(on_actiontable_received)
|
|
102
128
|
service.on_finish.connect(on_finish)
|
|
103
|
-
service.
|
|
129
|
+
service.on_error.connect(on_error)
|
|
130
|
+
service.configure(
|
|
104
131
|
serial_number=serial_number,
|
|
105
|
-
|
|
132
|
+
actiontable_type=_get_actiontable_type(xpmoduletype),
|
|
106
133
|
)
|
|
107
134
|
service.start_reactor()
|
|
108
135
|
|
|
@@ -110,17 +137,19 @@ def conbus_download_msactiontable(
|
|
|
110
137
|
@conbus_msactiontable.command("list", short_help="List modules with MsActionTable")
|
|
111
138
|
@click.pass_context
|
|
112
139
|
def conbus_list_msactiontable(ctx: Context) -> None:
|
|
113
|
-
"""
|
|
140
|
+
"""
|
|
141
|
+
List all modules with action table configurations from conson.yml.
|
|
114
142
|
|
|
115
143
|
Args:
|
|
116
144
|
ctx: Click context object.
|
|
117
145
|
"""
|
|
118
|
-
service:
|
|
119
|
-
ctx.obj.get("container").get_container().resolve(
|
|
146
|
+
service: ActionTableListService = (
|
|
147
|
+
ctx.obj.get("container").get_container().resolve(ActionTableListService)
|
|
120
148
|
)
|
|
121
149
|
|
|
122
150
|
def on_finish(module_list: dict) -> None:
|
|
123
|
-
"""
|
|
151
|
+
"""
|
|
152
|
+
Handle successful completion of action table list.
|
|
124
153
|
|
|
125
154
|
Args:
|
|
126
155
|
module_list: Dictionary containing modules and total count.
|
|
@@ -128,7 +157,8 @@ def conbus_list_msactiontable(ctx: Context) -> None:
|
|
|
128
157
|
click.echo(json.dumps(module_list, indent=2, default=str))
|
|
129
158
|
|
|
130
159
|
def on_error(error: str) -> None:
|
|
131
|
-
"""
|
|
160
|
+
"""
|
|
161
|
+
Handle errors during action table list.
|
|
132
162
|
|
|
133
163
|
Args:
|
|
134
164
|
error: Error message string.
|
|
@@ -145,18 +175,20 @@ def conbus_list_msactiontable(ctx: Context) -> None:
|
|
|
145
175
|
@click.argument("serial_number", type=SERIAL)
|
|
146
176
|
@click.pass_context
|
|
147
177
|
def conbus_show_msactiontable(ctx: Context, serial_number: str) -> None:
|
|
148
|
-
"""
|
|
178
|
+
"""
|
|
179
|
+
Show ms action table configuration for a specific module from conson.yml.
|
|
149
180
|
|
|
150
181
|
Args:
|
|
151
182
|
ctx: Click context object.
|
|
152
183
|
serial_number: 10-digit module serial number.
|
|
153
184
|
"""
|
|
154
|
-
service:
|
|
155
|
-
ctx.obj.get("container").get_container().resolve(
|
|
185
|
+
service: ActionTableShowService = (
|
|
186
|
+
ctx.obj.get("container").get_container().resolve(ActionTableShowService)
|
|
156
187
|
)
|
|
157
188
|
|
|
158
189
|
def on_finish(module: ConsonModuleConfig) -> None:
|
|
159
|
-
"""
|
|
190
|
+
"""
|
|
191
|
+
Handle successful completion of action table show.
|
|
160
192
|
|
|
161
193
|
Args:
|
|
162
194
|
module: Dictionary containing module configuration.
|
|
@@ -194,7 +226,8 @@ def conbus_show_msactiontable(ctx: Context, serial_number: str) -> None:
|
|
|
194
226
|
click.echo(_format_yaml(yaml_dict, indent=2))
|
|
195
227
|
|
|
196
228
|
def error_callback(error: str) -> None:
|
|
197
|
-
"""
|
|
229
|
+
"""
|
|
230
|
+
Handle errors during action table show.
|
|
198
231
|
|
|
199
232
|
Args:
|
|
200
233
|
error: Error message string.
|
|
@@ -217,7 +250,8 @@ def conbus_show_msactiontable(ctx: Context, serial_number: str) -> None:
|
|
|
217
250
|
def conbus_upload_msactiontable(
|
|
218
251
|
ctx: Context, serial_number: str, xpmoduletype: str
|
|
219
252
|
) -> None:
|
|
220
|
-
"""
|
|
253
|
+
"""
|
|
254
|
+
Upload MS action table from conson.yml to XP module.
|
|
221
255
|
|
|
222
256
|
Args:
|
|
223
257
|
ctx: Click context object.
|
|
@@ -229,7 +263,8 @@ def conbus_upload_msactiontable(
|
|
|
229
263
|
)
|
|
230
264
|
|
|
231
265
|
def on_progress(progress: str) -> None:
|
|
232
|
-
"""
|
|
266
|
+
"""
|
|
267
|
+
Handle progress updates during MS action table upload.
|
|
233
268
|
|
|
234
269
|
Args:
|
|
235
270
|
progress: Progress message string.
|
|
@@ -237,7 +272,8 @@ def conbus_upload_msactiontable(
|
|
|
237
272
|
click.echo(progress, nl=False)
|
|
238
273
|
|
|
239
274
|
def on_finish(success: bool) -> None:
|
|
240
|
-
"""
|
|
275
|
+
"""
|
|
276
|
+
Handle successful completion of MS action table upload.
|
|
241
277
|
|
|
242
278
|
Args:
|
|
243
279
|
success: Whether upload was successful.
|
|
@@ -247,7 +283,8 @@ def conbus_upload_msactiontable(
|
|
|
247
283
|
click.echo("\nMsactiontable uploaded successfully")
|
|
248
284
|
|
|
249
285
|
def on_error(error: str) -> None:
|
|
250
|
-
"""
|
|
286
|
+
"""
|
|
287
|
+
Handle errors during MS action table upload.
|
|
251
288
|
|
|
252
289
|
Args:
|
|
253
290
|
error: Error message string.
|
|
@@ -269,7 +306,8 @@ def conbus_upload_msactiontable(
|
|
|
269
306
|
|
|
270
307
|
|
|
271
308
|
def _format_yaml(data: dict, indent: int = 0) -> str:
|
|
272
|
-
"""
|
|
309
|
+
"""
|
|
310
|
+
Format a dictionary as YAML-like output.
|
|
273
311
|
|
|
274
312
|
Args:
|
|
275
313
|
data: Dictionary to format.
|
|
@@ -21,7 +21,8 @@ from xp.services.conbus.conbus_output_service import ConbusOutputService
|
|
|
21
21
|
@click.pass_context
|
|
22
22
|
@connection_command()
|
|
23
23
|
def xp_output_on(ctx: click.Context, serial_number: str, output_number: int) -> None:
|
|
24
|
-
r"""
|
|
24
|
+
r"""
|
|
25
|
+
Send ON command for output_number XP module serial_number.
|
|
25
26
|
|
|
26
27
|
Args:
|
|
27
28
|
ctx: Click context object.
|
|
@@ -37,7 +38,8 @@ def xp_output_on(ctx: click.Context, serial_number: str, output_number: int) ->
|
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
def on_finish(response: ConbusOutputResponse) -> None:
|
|
40
|
-
"""
|
|
41
|
+
"""
|
|
42
|
+
Handle successful completion of output on command.
|
|
41
43
|
|
|
42
44
|
Args:
|
|
43
45
|
response: Output response object.
|
|
@@ -61,7 +63,8 @@ def xp_output_on(ctx: click.Context, serial_number: str, output_number: int) ->
|
|
|
61
63
|
@click.pass_context
|
|
62
64
|
@connection_command()
|
|
63
65
|
def xp_output_off(ctx: click.Context, serial_number: str, output_number: int) -> None:
|
|
64
|
-
r"""
|
|
66
|
+
r"""
|
|
67
|
+
Send OFF command for output_number XP module serial_number.
|
|
65
68
|
|
|
66
69
|
Args:
|
|
67
70
|
ctx: Click context object.
|
|
@@ -77,7 +80,8 @@ def xp_output_off(ctx: click.Context, serial_number: str, output_number: int) ->
|
|
|
77
80
|
)
|
|
78
81
|
|
|
79
82
|
def on_finish(response: ConbusOutputResponse) -> None:
|
|
80
|
-
"""
|
|
83
|
+
"""
|
|
84
|
+
Handle successful completion of output off command.
|
|
81
85
|
|
|
82
86
|
Args:
|
|
83
87
|
response: Output response object.
|
|
@@ -100,7 +104,8 @@ def xp_output_off(ctx: click.Context, serial_number: str, output_number: int) ->
|
|
|
100
104
|
@click.pass_context
|
|
101
105
|
@connection_command()
|
|
102
106
|
def xp_output_status(ctx: click.Context, serial_number: str) -> None:
|
|
103
|
-
r"""
|
|
107
|
+
r"""
|
|
108
|
+
Query output state command to XP module serial_number.
|
|
104
109
|
|
|
105
110
|
Args:
|
|
106
111
|
ctx: Click context object.
|
|
@@ -115,7 +120,8 @@ def xp_output_status(ctx: click.Context, serial_number: str) -> None:
|
|
|
115
120
|
)
|
|
116
121
|
|
|
117
122
|
def on_finish(response: ConbusDatapointResponse) -> None:
|
|
118
|
-
"""
|
|
123
|
+
"""
|
|
124
|
+
Handle successful completion of output status query.
|
|
119
125
|
|
|
120
126
|
Args:
|
|
121
127
|
response: Datapoint response object.
|
|
@@ -137,7 +143,8 @@ def xp_output_status(ctx: click.Context, serial_number: str) -> None:
|
|
|
137
143
|
@click.pass_context
|
|
138
144
|
@connection_command()
|
|
139
145
|
def xp_module_state(ctx: click.Context, serial_number: str) -> None:
|
|
140
|
-
r"""
|
|
146
|
+
r"""
|
|
147
|
+
Query module state of the XP module serial_number.
|
|
141
148
|
|
|
142
149
|
Args:
|
|
143
150
|
ctx: Click context object.
|
|
@@ -152,7 +159,8 @@ def xp_module_state(ctx: click.Context, serial_number: str) -> None:
|
|
|
152
159
|
)
|
|
153
160
|
|
|
154
161
|
def on_finish(response: ConbusDatapointResponse) -> None:
|
|
155
|
-
"""
|
|
162
|
+
"""
|
|
163
|
+
Handle successful completion of module state query.
|
|
156
164
|
|
|
157
165
|
Args:
|
|
158
166
|
response: Datapoint response object.
|
|
@@ -18,7 +18,8 @@ from xp.services.conbus.conbus_raw_service import ConbusRawService
|
|
|
18
18
|
@click.pass_context
|
|
19
19
|
@connection_command()
|
|
20
20
|
def send_raw_telegrams(ctx: Context, raw_telegrams: str) -> None:
|
|
21
|
-
r"""
|
|
21
|
+
r"""
|
|
22
|
+
Send raw telegram sequence to Conbus server.
|
|
22
23
|
|
|
23
24
|
Accepts a string containing one or more telegrams in format <...>.
|
|
24
25
|
Multiple telegrams should be concatenated without separators.
|
|
@@ -38,7 +39,8 @@ def send_raw_telegrams(ctx: Context, raw_telegrams: str) -> None:
|
|
|
38
39
|
)
|
|
39
40
|
|
|
40
41
|
def on_progress(message: str) -> None:
|
|
41
|
-
"""
|
|
42
|
+
"""
|
|
43
|
+
Handle progress updates during raw telegram sending.
|
|
42
44
|
|
|
43
45
|
Args:
|
|
44
46
|
message: Progress message string.
|
|
@@ -46,7 +48,8 @@ def send_raw_telegrams(ctx: Context, raw_telegrams: str) -> None:
|
|
|
46
48
|
click.echo(message)
|
|
47
49
|
|
|
48
50
|
def on_finish(service_response: ConbusRawResponse) -> None:
|
|
49
|
-
"""
|
|
51
|
+
"""
|
|
52
|
+
Handle successful completion of raw telegram sending.
|
|
50
53
|
|
|
51
54
|
Args:
|
|
52
55
|
service_response: Raw response object.
|
|
@@ -20,7 +20,8 @@ from xp.services.conbus.conbus_receive_service import (
|
|
|
20
20
|
@connection_command()
|
|
21
21
|
@click.pass_context
|
|
22
22
|
def receive_telegrams(ctx: Context, timeout: float) -> None:
|
|
23
|
-
r"""
|
|
23
|
+
r"""
|
|
24
|
+
Receive waiting event telegrams from Conbus server.
|
|
24
25
|
|
|
25
26
|
Connects to the Conbus server and receives any waiting event telegrams
|
|
26
27
|
without sending any data first. Useful for collecting pending notifications
|
|
@@ -37,7 +38,8 @@ def receive_telegrams(ctx: Context, timeout: float) -> None:
|
|
|
37
38
|
"""
|
|
38
39
|
|
|
39
40
|
def on_finish(response_received: ConbusReceiveResponse) -> None:
|
|
40
|
-
"""
|
|
41
|
+
"""
|
|
42
|
+
Handle successful completion of telegram receive operation.
|
|
41
43
|
|
|
42
44
|
Args:
|
|
43
45
|
response_received: Receive response object with telegrams.
|
|
@@ -46,7 +48,8 @@ def receive_telegrams(ctx: Context, timeout: float) -> None:
|
|
|
46
48
|
service.stop_reactor()
|
|
47
49
|
|
|
48
50
|
def on_progress(telegram_received: str) -> None:
|
|
49
|
-
"""
|
|
51
|
+
"""
|
|
52
|
+
Handle progress updates during telegram receive operation.
|
|
50
53
|
|
|
51
54
|
Args:
|
|
52
55
|
telegram_received: Received telegram string.
|