conson-xp 1.1.0__py3-none-any.whl → 1.2.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.1.0.dist-info → conson_xp-1.2.0.dist-info}/METADATA +1 -1
- conson_xp-1.2.0.dist-info/RECORD +181 -0
- xp/__init__.py +4 -3
- xp/api/main.py +18 -3
- xp/api/models/api.py +13 -2
- xp/api/models/discover.py +12 -2
- xp/api/routers/conbus_blink.py +18 -6
- xp/api/routers/conbus_custom.py +11 -3
- xp/api/routers/conbus_datapoint.py +10 -3
- xp/api/routers/conbus_output.py +29 -9
- xp/api/routers/errors.py +6 -5
- xp/cli/__init__.py +1 -1
- xp/cli/commands/__init__.py +1 -0
- xp/cli/commands/api.py +1 -5
- xp/cli/commands/api_start_commands.py +14 -8
- xp/cli/commands/conbus/conbus.py +9 -37
- xp/cli/commands/conbus/conbus_actiontable_commands.py +21 -1
- xp/cli/commands/conbus/conbus_autoreport_commands.py +21 -11
- xp/cli/commands/conbus/conbus_blink_commands.py +53 -21
- xp/cli/commands/conbus/conbus_config_commands.py +7 -4
- xp/cli/commands/conbus/conbus_custom_commands.py +13 -4
- xp/cli/commands/conbus/conbus_datapoint_commands.py +28 -8
- xp/cli/commands/conbus/conbus_discover_commands.py +15 -4
- xp/cli/commands/conbus/conbus_lightlevel_commands.py +50 -11
- xp/cli/commands/conbus/conbus_linknumber_commands.py +21 -11
- xp/cli/commands/conbus/conbus_msactiontable_commands.py +25 -1
- xp/cli/commands/conbus/conbus_output_commands.py +46 -12
- xp/cli/commands/conbus/conbus_raw_commands.py +17 -6
- xp/cli/commands/conbus/conbus_receive_commands.py +15 -7
- xp/cli/commands/conbus/conbus_scan_commands.py +17 -4
- xp/cli/commands/file_commands.py +26 -15
- xp/cli/commands/homekit/homekit.py +14 -8
- xp/cli/commands/homekit/homekit_start_commands.py +5 -5
- xp/cli/commands/module_commands.py +26 -19
- xp/cli/commands/reverse_proxy_commands.py +24 -18
- xp/cli/commands/server/server_commands.py +18 -18
- xp/cli/commands/telegram/telegram.py +4 -12
- xp/cli/commands/telegram/telegram_blink_commands.py +10 -8
- xp/cli/commands/telegram/telegram_checksum_commands.py +19 -8
- xp/cli/commands/telegram/telegram_discover_commands.py +2 -4
- xp/cli/commands/telegram/telegram_linknumber_commands.py +11 -8
- xp/cli/commands/telegram/telegram_parse_commands.py +10 -9
- xp/cli/commands/telegram/telegram_version_commands.py +8 -4
- xp/cli/main.py +5 -1
- xp/cli/utils/click_tree.py +23 -3
- xp/cli/utils/datapoint_type_choice.py +20 -0
- xp/cli/utils/decorators.py +165 -14
- xp/cli/utils/error_handlers.py +49 -18
- xp/cli/utils/formatters.py +95 -10
- xp/cli/utils/serial_number_type.py +18 -0
- xp/cli/utils/system_function_choice.py +20 -0
- xp/cli/utils/xp_module_type.py +20 -0
- xp/connection/__init__.py +1 -1
- xp/connection/exceptions.py +5 -5
- xp/models/__init__.py +1 -1
- xp/models/actiontable/__init__.py +1 -0
- xp/models/actiontable/actiontable.py +17 -1
- xp/models/actiontable/msactiontable_xp20.py +10 -0
- xp/models/actiontable/msactiontable_xp24.py +20 -3
- xp/models/actiontable/msactiontable_xp33.py +27 -4
- xp/models/conbus/__init__.py +1 -0
- xp/models/conbus/conbus.py +34 -4
- xp/models/conbus/conbus_autoreport.py +20 -2
- xp/models/conbus/conbus_blink.py +22 -2
- xp/models/conbus/conbus_client_config.py +22 -1
- xp/models/conbus/conbus_connection_status.py +16 -2
- xp/models/conbus/conbus_custom.py +21 -2
- xp/models/conbus/conbus_datapoint.py +22 -2
- xp/models/conbus/conbus_discover.py +18 -2
- xp/models/conbus/conbus_lightlevel.py +20 -2
- xp/models/conbus/conbus_linknumber.py +20 -2
- xp/models/conbus/conbus_output.py +22 -2
- xp/models/conbus/conbus_raw.py +17 -2
- xp/models/conbus/conbus_receive.py +16 -2
- xp/models/homekit/__init__.py +1 -0
- xp/models/homekit/homekit_accessory.py +15 -1
- xp/models/homekit/homekit_config.py +52 -0
- xp/models/homekit/homekit_conson_config.py +32 -0
- xp/models/log_entry.py +49 -9
- xp/models/protocol/__init__.py +1 -0
- xp/models/protocol/conbus_protocol.py +130 -21
- xp/models/telegram/__init__.py +1 -0
- xp/models/telegram/action_type.py +16 -2
- xp/models/telegram/datapoint_type.py +36 -2
- xp/models/telegram/event_telegram.py +46 -10
- xp/models/telegram/event_type.py +8 -1
- xp/models/telegram/input_action_type.py +34 -2
- xp/models/telegram/input_type.py +9 -1
- xp/models/telegram/module_type.py +69 -19
- xp/models/telegram/module_type_code.py +43 -1
- xp/models/telegram/output_telegram.py +30 -6
- xp/models/telegram/reply_telegram.py +56 -11
- xp/models/telegram/system_function.py +35 -3
- xp/models/telegram/system_telegram.py +18 -4
- xp/models/telegram/telegram.py +12 -3
- xp/models/telegram/telegram_type.py +8 -1
- xp/models/telegram/timeparam_type.py +27 -0
- xp/models/write_config_type.py +17 -2
- xp/services/__init__.py +1 -1
- xp/services/conbus/__init__.py +1 -0
- xp/services/conbus/actiontable/__init__.py +1 -0
- xp/services/conbus/actiontable/actiontable_service.py +33 -2
- xp/services/conbus/actiontable/msactiontable_service.py +40 -3
- xp/services/conbus/actiontable/msactiontable_xp24_serializer.py +36 -4
- xp/services/conbus/actiontable/msactiontable_xp33_serializer.py +45 -5
- xp/services/conbus/conbus_autoreport_get_service.py +17 -8
- xp/services/conbus/conbus_autoreport_set_service.py +29 -16
- xp/services/conbus/conbus_blink_all_service.py +40 -21
- xp/services/conbus/conbus_blink_service.py +37 -13
- xp/services/conbus/conbus_custom_service.py +29 -13
- xp/services/conbus/conbus_datapoint_queryall_service.py +40 -16
- xp/services/conbus/conbus_datapoint_service.py +33 -12
- xp/services/conbus/conbus_discover_service.py +43 -7
- xp/services/conbus/conbus_lightlevel_get_service.py +22 -14
- xp/services/conbus/conbus_lightlevel_set_service.py +40 -20
- xp/services/conbus/conbus_linknumber_get_service.py +18 -10
- xp/services/conbus/conbus_linknumber_set_service.py +34 -8
- xp/services/conbus/conbus_output_service.py +33 -13
- xp/services/conbus/conbus_raw_service.py +36 -16
- xp/services/conbus/conbus_receive_service.py +38 -6
- xp/services/conbus/conbus_scan_service.py +44 -18
- xp/services/homekit/__init__.py +1 -0
- xp/services/homekit/homekit_cache_service.py +31 -6
- xp/services/homekit/homekit_conbus_service.py +33 -2
- xp/services/homekit/homekit_config_validator.py +97 -15
- xp/services/homekit/homekit_conson_validator.py +51 -7
- xp/services/homekit/homekit_dimminglight.py +47 -1
- xp/services/homekit/homekit_dimminglight_service.py +35 -1
- xp/services/homekit/homekit_hap_service.py +71 -18
- xp/services/homekit/homekit_lightbulb.py +35 -1
- xp/services/homekit/homekit_lightbulb_service.py +30 -2
- xp/services/homekit/homekit_module_service.py +23 -1
- xp/services/homekit/homekit_outlet.py +47 -1
- xp/services/homekit/homekit_outlet_service.py +44 -2
- xp/services/homekit/homekit_service.py +113 -19
- xp/services/log_file_service.py +37 -41
- xp/services/module_type_service.py +26 -5
- xp/services/protocol/__init__.py +1 -1
- xp/services/protocol/conbus_protocol.py +110 -16
- xp/services/protocol/protocol_factory.py +40 -0
- xp/services/protocol/telegram_protocol.py +38 -7
- xp/services/reverse_proxy_service.py +79 -14
- xp/services/server/__init__.py +1 -0
- xp/services/server/base_server_service.py +102 -14
- xp/services/server/cp20_server_service.py +12 -4
- xp/services/server/server_service.py +26 -11
- xp/services/server/xp130_server_service.py +11 -3
- xp/services/server/xp20_server_service.py +11 -3
- xp/services/server/xp230_server_service.py +11 -3
- xp/services/server/xp24_server_service.py +33 -6
- xp/services/server/xp33_server_service.py +41 -8
- xp/services/telegram/__init__.py +1 -0
- xp/services/telegram/telegram_blink_service.py +19 -31
- xp/services/telegram/telegram_checksum_service.py +10 -10
- xp/services/telegram/telegram_discover_service.py +58 -29
- xp/services/telegram/telegram_link_number_service.py +27 -40
- xp/services/telegram/telegram_output_service.py +46 -49
- xp/services/telegram/telegram_service.py +41 -41
- xp/services/telegram/telegram_version_service.py +4 -2
- xp/utils/__init__.py +1 -1
- xp/utils/dependencies.py +0 -1
- xp/utils/serialization.py +6 -0
- xp/utils/time_utils.py +6 -11
- conson_xp-1.1.0.dist-info/RECORD +0 -181
- {conson_xp-1.1.0.dist-info → conson_xp-1.2.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.1.0.dist-info → conson_xp-1.2.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.1.0.dist-info → conson_xp-1.2.0.dist-info}/licenses/LICENSE +0 -0
xp/cli/commands/conbus/conbus.py
CHANGED
|
@@ -8,9 +8,7 @@ from click_help_colors import HelpColorsGroup
|
|
|
8
8
|
cls=HelpColorsGroup, help_headers_color="yellow", help_options_color="green"
|
|
9
9
|
)
|
|
10
10
|
def conbus() -> None:
|
|
11
|
-
"""
|
|
12
|
-
Conbus client operations for sending telegrams to remote servers
|
|
13
|
-
"""
|
|
11
|
+
"""Perform Conbus client operations for sending telegrams to remote servers."""
|
|
14
12
|
pass
|
|
15
13
|
|
|
16
14
|
|
|
@@ -21,9 +19,7 @@ def conbus() -> None:
|
|
|
21
19
|
help_options_color="green",
|
|
22
20
|
)
|
|
23
21
|
def conbus_blink() -> None:
|
|
24
|
-
"""
|
|
25
|
-
Conbus client operations for sending blink telegrams to remote servers
|
|
26
|
-
"""
|
|
22
|
+
"""Perform Conbus client operations for sending blink telegrams to remote servers."""
|
|
27
23
|
pass
|
|
28
24
|
|
|
29
25
|
|
|
@@ -34,9 +30,7 @@ def conbus_blink() -> None:
|
|
|
34
30
|
help_options_color="green",
|
|
35
31
|
)
|
|
36
32
|
def conbus_output() -> None:
|
|
37
|
-
"""
|
|
38
|
-
Conbus input operations to remote servers
|
|
39
|
-
"""
|
|
33
|
+
"""Perform Conbus input operations to remote servers."""
|
|
40
34
|
pass
|
|
41
35
|
|
|
42
36
|
|
|
@@ -47,9 +41,7 @@ def conbus_output() -> None:
|
|
|
47
41
|
help_options_color="green",
|
|
48
42
|
)
|
|
49
43
|
def conbus_datapoint() -> None:
|
|
50
|
-
"""
|
|
51
|
-
Conbus datapoint operations for querying module datapoints
|
|
52
|
-
"""
|
|
44
|
+
"""Perform Conbus datapoint operations for querying module datapoints."""
|
|
53
45
|
pass
|
|
54
46
|
|
|
55
47
|
|
|
@@ -61,11 +53,7 @@ def conbus_datapoint() -> None:
|
|
|
61
53
|
short_help="Link number operations",
|
|
62
54
|
)
|
|
63
55
|
def conbus_linknumber() -> None:
|
|
64
|
-
"""
|
|
65
|
-
Link number operations for modules.
|
|
66
|
-
|
|
67
|
-
Set or get the link number for specific modules.
|
|
68
|
-
"""
|
|
56
|
+
"""Set or get the link number for specific modules."""
|
|
69
57
|
pass
|
|
70
58
|
|
|
71
59
|
|
|
@@ -77,11 +65,7 @@ def conbus_linknumber() -> None:
|
|
|
77
65
|
short_help="Auto report status operations",
|
|
78
66
|
)
|
|
79
67
|
def conbus_autoreport() -> None:
|
|
80
|
-
"""
|
|
81
|
-
Auto report status operations for modules.
|
|
82
|
-
|
|
83
|
-
Get or set the auto report status for specific modules.
|
|
84
|
-
"""
|
|
68
|
+
"""Get or set the auto report status for specific modules."""
|
|
85
69
|
pass
|
|
86
70
|
|
|
87
71
|
|
|
@@ -93,11 +77,7 @@ def conbus_autoreport() -> None:
|
|
|
93
77
|
short_help="Light level operations",
|
|
94
78
|
)
|
|
95
79
|
def conbus_lightlevel() -> None:
|
|
96
|
-
"""
|
|
97
|
-
Light level operations for modules.
|
|
98
|
-
|
|
99
|
-
Control light level (dimming) of outputs on Conbus modules.
|
|
100
|
-
"""
|
|
80
|
+
"""Control light level (dimming) of outputs on Conbus modules."""
|
|
101
81
|
pass
|
|
102
82
|
|
|
103
83
|
|
|
@@ -109,11 +89,7 @@ def conbus_lightlevel() -> None:
|
|
|
109
89
|
short_help="MSActionTable operations",
|
|
110
90
|
)
|
|
111
91
|
def conbus_msactiontable() -> None:
|
|
112
|
-
"""
|
|
113
|
-
msactiontable operations for modules.
|
|
114
|
-
|
|
115
|
-
Download msactiontable on Conbus modules.
|
|
116
|
-
"""
|
|
92
|
+
"""Download msactiontable on Conbus modules."""
|
|
117
93
|
pass
|
|
118
94
|
|
|
119
95
|
|
|
@@ -125,11 +101,7 @@ def conbus_msactiontable() -> None:
|
|
|
125
101
|
short_help="ActionTable operations",
|
|
126
102
|
)
|
|
127
103
|
def conbus_actiontable() -> None:
|
|
128
|
-
"""
|
|
129
|
-
ActionTable operations for modules.
|
|
130
|
-
|
|
131
|
-
Download ActionTable from Conbus modules.
|
|
132
|
-
"""
|
|
104
|
+
"""Download ActionTable from Conbus modules."""
|
|
133
105
|
pass
|
|
134
106
|
|
|
135
107
|
|
|
@@ -22,13 +22,28 @@ from xp.services.conbus.actiontable.actiontable_service import (
|
|
|
22
22
|
@click.pass_context
|
|
23
23
|
@connection_command()
|
|
24
24
|
def conbus_download_actiontable(ctx: Context, serial_number: str) -> None:
|
|
25
|
-
"""Download action table from XP module
|
|
25
|
+
"""Download action table from XP module.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
ctx: Click context object.
|
|
29
|
+
serial_number: 10-digit module serial number.
|
|
30
|
+
"""
|
|
26
31
|
service = ctx.obj.get("container").get_container().resolve(ActionTableService)
|
|
27
32
|
|
|
28
33
|
def progress_callback(progress: str) -> None:
|
|
34
|
+
"""Handle progress updates during action table download.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
progress: Progress message string.
|
|
38
|
+
"""
|
|
29
39
|
click.echo(progress)
|
|
30
40
|
|
|
31
41
|
def finish_callback(actiontable: ActionTable) -> None:
|
|
42
|
+
"""Handle successful completion of action table download.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
actiontable: Downloaded action table object.
|
|
46
|
+
"""
|
|
32
47
|
output = {
|
|
33
48
|
"serial_number": serial_number,
|
|
34
49
|
"actiontable": asdict(actiontable),
|
|
@@ -36,6 +51,11 @@ def conbus_download_actiontable(ctx: Context, serial_number: str) -> None:
|
|
|
36
51
|
click.echo(json.dumps(output, indent=2, default=str))
|
|
37
52
|
|
|
38
53
|
def error_callback(error: str) -> None:
|
|
54
|
+
"""Handle errors during action table download.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
error: Error message string.
|
|
58
|
+
"""
|
|
39
59
|
click.echo(error)
|
|
40
60
|
|
|
41
61
|
with service:
|
|
@@ -22,14 +22,14 @@ from xp.services.conbus.conbus_autoreport_set_service import ConbusAutoreportSet
|
|
|
22
22
|
@connection_command()
|
|
23
23
|
@click.pass_context
|
|
24
24
|
def get_autoreport_command(ctx: Context, serial_number: str) -> None:
|
|
25
|
-
"""
|
|
26
|
-
Get the current auto report status for a specific module.
|
|
25
|
+
r"""Get the current auto report status for a specific module.
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
Args:
|
|
28
|
+
ctx: Click context object.
|
|
29
|
+
serial_number: 10-digit module serial number.
|
|
29
30
|
|
|
30
31
|
Examples:
|
|
31
|
-
|
|
32
|
-
\b
|
|
32
|
+
\b
|
|
33
33
|
xp conbus autoreport get 0123450001
|
|
34
34
|
"""
|
|
35
35
|
# Get service from container
|
|
@@ -38,6 +38,11 @@ def get_autoreport_command(ctx: Context, serial_number: str) -> None:
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
def on_finish(service_response: ConbusAutoreportResponse) -> None:
|
|
41
|
+
"""Handle successful completion of auto report status retrieval.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
service_response: Auto report response object.
|
|
45
|
+
"""
|
|
41
46
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
42
47
|
|
|
43
48
|
with service:
|
|
@@ -53,15 +58,15 @@ def get_autoreport_command(ctx: Context, serial_number: str) -> None:
|
|
|
53
58
|
@connection_command()
|
|
54
59
|
@click.pass_context
|
|
55
60
|
def set_autoreport_command(ctx: Context, serial_number: str, status: str) -> None:
|
|
56
|
-
"""
|
|
57
|
-
Set the auto report status for a specific module.
|
|
61
|
+
r"""Set the auto report status for a specific module.
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
Args:
|
|
64
|
+
ctx: Click context object.
|
|
65
|
+
serial_number: 10-digit module serial number.
|
|
66
|
+
status: Auto report status - either 'on' or 'off'.
|
|
61
67
|
|
|
62
68
|
Examples:
|
|
63
|
-
|
|
64
|
-
\b
|
|
69
|
+
\b
|
|
65
70
|
xp conbus autoreport set 0123450001 on
|
|
66
71
|
xp conbus autoreport set 0123450001 off
|
|
67
72
|
"""
|
|
@@ -72,6 +77,11 @@ def set_autoreport_command(ctx: Context, serial_number: str, status: str) -> Non
|
|
|
72
77
|
status_bool = status.lower() == "on"
|
|
73
78
|
|
|
74
79
|
def on_finish(service_response: ConbusAutoreportResponse) -> None:
|
|
80
|
+
"""Handle successful completion of auto report status setting.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
service_response: Auto report response object.
|
|
84
|
+
"""
|
|
75
85
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
76
86
|
|
|
77
87
|
with service:
|
|
@@ -23,16 +23,23 @@ from xp.services.telegram.telegram_blink_service import BlinkError
|
|
|
23
23
|
@connection_command()
|
|
24
24
|
@handle_service_errors(BlinkError)
|
|
25
25
|
def send_blink_on_telegram(ctx: Context, serial_number: str) -> None:
|
|
26
|
-
"""
|
|
27
|
-
Send blink command to start blinking module LED.
|
|
26
|
+
r"""Send blink command to start blinking module LED.
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
Args:
|
|
29
|
+
ctx: Click context object.
|
|
30
|
+
serial_number: 10-digit module serial number.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
Examples:
|
|
33
|
+
\b
|
|
32
34
|
xp conbus blink on 0012345008
|
|
33
35
|
"""
|
|
34
36
|
|
|
35
37
|
def finish(service_response: ConbusBlinkResponse) -> None:
|
|
38
|
+
"""Handle successful completion of blink on command.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
service_response: Blink response object.
|
|
42
|
+
"""
|
|
36
43
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
37
44
|
|
|
38
45
|
service: ConbusBlinkService = (
|
|
@@ -48,16 +55,23 @@ def send_blink_on_telegram(ctx: Context, serial_number: str) -> None:
|
|
|
48
55
|
@connection_command()
|
|
49
56
|
@handle_service_errors(BlinkError)
|
|
50
57
|
def send_blink_off_telegram(ctx: Context, serial_number: str) -> None:
|
|
51
|
-
"""
|
|
52
|
-
Send blink command to start blinking module LED.
|
|
58
|
+
r"""Send blink command to stop blinking module LED.
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
Args:
|
|
61
|
+
ctx: Click context object.
|
|
62
|
+
serial_number: 10-digit module serial number.
|
|
55
63
|
|
|
56
|
-
|
|
64
|
+
Examples:
|
|
65
|
+
\b
|
|
57
66
|
xp conbus blink off 0012345008
|
|
58
67
|
"""
|
|
59
68
|
|
|
60
69
|
def finish(service_response: ConbusBlinkResponse) -> None:
|
|
70
|
+
"""Handle successful completion of blink off command.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
service_response: Blink response object.
|
|
74
|
+
"""
|
|
61
75
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
62
76
|
|
|
63
77
|
service: ConbusBlinkService = (
|
|
@@ -69,9 +83,7 @@ def send_blink_off_telegram(ctx: Context, serial_number: str) -> None:
|
|
|
69
83
|
|
|
70
84
|
@conbus_blink.group("all", short_help="Control blink state for all devices")
|
|
71
85
|
def conbus_blink_all() -> None:
|
|
72
|
-
"""
|
|
73
|
-
Control blink state for all discovered devices.
|
|
74
|
-
"""
|
|
86
|
+
"""Control blink state for all discovered devices."""
|
|
75
87
|
pass
|
|
76
88
|
|
|
77
89
|
|
|
@@ -80,21 +92,31 @@ def conbus_blink_all() -> None:
|
|
|
80
92
|
@connection_command()
|
|
81
93
|
@handle_service_errors(BlinkError)
|
|
82
94
|
def blink_all_off(ctx: Context) -> None:
|
|
83
|
-
"""
|
|
84
|
-
Turn off blinking for all discovered devices.
|
|
95
|
+
r"""Turn off blinking for all discovered devices.
|
|
85
96
|
|
|
86
|
-
|
|
97
|
+
Args:
|
|
98
|
+
ctx: Click context object.
|
|
87
99
|
|
|
88
|
-
|
|
100
|
+
Examples:
|
|
101
|
+
\b
|
|
89
102
|
xp conbus blink all off
|
|
90
103
|
"""
|
|
91
104
|
|
|
92
105
|
def finish(discovered_devices: ConbusBlinkResponse) -> None:
|
|
106
|
+
"""Handle successful completion of blink all off command.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
discovered_devices: Blink response with all devices.
|
|
110
|
+
"""
|
|
93
111
|
click.echo(json.dumps(discovered_devices.to_dict(), indent=2))
|
|
94
112
|
|
|
95
113
|
def progress(message: str) -> None:
|
|
114
|
+
"""Handle progress updates during blink all off operation.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
message: Progress message string.
|
|
118
|
+
"""
|
|
96
119
|
click.echo(message)
|
|
97
|
-
pass
|
|
98
120
|
|
|
99
121
|
service: ConbusBlinkAllService = (
|
|
100
122
|
ctx.obj.get("container").get_container().resolve(ConbusBlinkAllService)
|
|
@@ -108,21 +130,31 @@ def blink_all_off(ctx: Context) -> None:
|
|
|
108
130
|
@connection_command()
|
|
109
131
|
@handle_service_errors(BlinkError)
|
|
110
132
|
def blink_all_on(ctx: Context) -> None:
|
|
111
|
-
"""
|
|
112
|
-
Turn on blinking for all discovered devices.
|
|
133
|
+
r"""Turn on blinking for all discovered devices.
|
|
113
134
|
|
|
114
|
-
|
|
135
|
+
Args:
|
|
136
|
+
ctx: Click context object.
|
|
115
137
|
|
|
116
|
-
|
|
138
|
+
Examples:
|
|
139
|
+
\b
|
|
117
140
|
xp conbus blink all on
|
|
118
141
|
"""
|
|
119
142
|
|
|
120
143
|
def finish(discovered_devices: ConbusBlinkResponse) -> None:
|
|
144
|
+
"""Handle successful completion of blink all on command.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
discovered_devices: Blink response with all devices.
|
|
148
|
+
"""
|
|
121
149
|
click.echo(json.dumps(discovered_devices.to_dict(), indent=2))
|
|
122
150
|
|
|
123
151
|
def progress(message: str) -> None:
|
|
152
|
+
"""Handle progress updates during blink all on operation.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
message: Progress message string.
|
|
156
|
+
"""
|
|
124
157
|
click.echo(message)
|
|
125
|
-
pass
|
|
126
158
|
|
|
127
159
|
service: ConbusBlinkAllService = (
|
|
128
160
|
ctx.obj.get("container").get_container().resolve(ConbusBlinkAllService)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""Conbus configuration CLI commands."""
|
|
2
|
+
|
|
1
3
|
import json
|
|
2
4
|
|
|
3
5
|
import click
|
|
@@ -12,12 +14,13 @@ from xp.models import ConbusClientConfig
|
|
|
12
14
|
@click.pass_context
|
|
13
15
|
@handle_service_errors(Exception)
|
|
14
16
|
def show_config(ctx: Context) -> None:
|
|
15
|
-
"""
|
|
16
|
-
Display current Conbus client configuration.
|
|
17
|
+
r"""Display current Conbus client configuration.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
Args:
|
|
20
|
+
ctx: Click context object.
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
Examples:
|
|
23
|
+
\b
|
|
21
24
|
xp conbus config
|
|
22
25
|
"""
|
|
23
26
|
config = ctx.obj.get("container").get_container().resolve(ConbusClientConfig)
|
|
@@ -23,18 +23,27 @@ from xp.services.conbus.conbus_custom_service import ConbusCustomService
|
|
|
23
23
|
def send_custom_telegram(
|
|
24
24
|
ctx: Context, serial_number: str, function_code: str, datapoint_code: str
|
|
25
25
|
) -> None:
|
|
26
|
-
"""
|
|
27
|
-
Send custom telegram with specified function and data point codes.
|
|
26
|
+
r"""Send custom telegram with specified function and data point codes.
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
Args:
|
|
29
|
+
ctx: Click context object.
|
|
30
|
+
serial_number: 10-digit module serial number.
|
|
31
|
+
function_code: Function code.
|
|
32
|
+
datapoint_code: Data point code.
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
Examples:
|
|
35
|
+
\b
|
|
32
36
|
xp conbus custom 0012345011 02 E2
|
|
33
37
|
xp conbus custom 0012345011 17 AA
|
|
34
38
|
"""
|
|
35
39
|
service = ctx.obj.get("container").get_container().resolve(ConbusCustomService)
|
|
36
40
|
|
|
37
41
|
def on_finish(service_response: "ConbusCustomResponse") -> None:
|
|
42
|
+
"""Handle successful completion of custom telegram.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
service_response: Custom response object.
|
|
46
|
+
"""
|
|
38
47
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
39
48
|
|
|
40
49
|
with service:
|
|
@@ -30,12 +30,15 @@ from xp.services.conbus.conbus_datapoint_service import (
|
|
|
30
30
|
@click.pass_context
|
|
31
31
|
@connection_command()
|
|
32
32
|
def query_datapoint(ctx: Context, serial_number: str, datapoint: DataPointType) -> None:
|
|
33
|
-
"""
|
|
34
|
-
Query a specific datapoint from Conbus server.
|
|
33
|
+
r"""Query a specific datapoint from Conbus server.
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
Args:
|
|
36
|
+
ctx: Click context object.
|
|
37
|
+
serial_number: 10-digit module serial number.
|
|
38
|
+
datapoint: Datapoint type to query.
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
Examples:
|
|
41
|
+
\b
|
|
39
42
|
xp conbus datapoint query version 0012345011
|
|
40
43
|
xp conbus datapoint query voltage 0012345011
|
|
41
44
|
xp conbus datapoint query temperature 0012345011
|
|
@@ -45,6 +48,11 @@ def query_datapoint(ctx: Context, serial_number: str, datapoint: DataPointType)
|
|
|
45
48
|
service = ctx.obj.get("container").get_container().resolve(ConbusDatapointService)
|
|
46
49
|
|
|
47
50
|
def on_finish(service_response: ConbusDatapointResponse) -> None:
|
|
51
|
+
"""Handle successful completion of datapoint query.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
service_response: Datapoint response object.
|
|
55
|
+
"""
|
|
48
56
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
49
57
|
|
|
50
58
|
# Send telegram
|
|
@@ -65,12 +73,14 @@ conbus_datapoint.add_command(query_datapoint)
|
|
|
65
73
|
@click.pass_context
|
|
66
74
|
@connection_command()
|
|
67
75
|
def query_all_datapoints(ctx: Context, serial_number: str) -> None:
|
|
68
|
-
"""
|
|
69
|
-
Query all datapoints from a specific module.
|
|
76
|
+
r"""Query all datapoints from a specific module.
|
|
70
77
|
|
|
71
|
-
|
|
78
|
+
Args:
|
|
79
|
+
ctx: Click context object.
|
|
80
|
+
serial_number: 10-digit module serial number.
|
|
72
81
|
|
|
73
|
-
|
|
82
|
+
Examples:
|
|
83
|
+
\b
|
|
74
84
|
xp conbus datapoint all 0123450001
|
|
75
85
|
"""
|
|
76
86
|
service = (
|
|
@@ -78,9 +88,19 @@ def query_all_datapoints(ctx: Context, serial_number: str) -> None:
|
|
|
78
88
|
)
|
|
79
89
|
|
|
80
90
|
def on_finish(service_response: ConbusDatapointResponse) -> None:
|
|
91
|
+
"""Handle successful completion of all datapoints query.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
service_response: Datapoint response object with all datapoints.
|
|
95
|
+
"""
|
|
81
96
|
click.echo(json.dumps(service_response.to_dict(), indent=2))
|
|
82
97
|
|
|
83
98
|
def on_progress(reply_telegram: ReplyTelegram) -> None:
|
|
99
|
+
"""Handle progress updates during all datapoints query.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
reply_telegram: Reply telegram object with progress data.
|
|
103
|
+
"""
|
|
84
104
|
click.echo(json.dumps(reply_telegram.to_dict(), indent=2))
|
|
85
105
|
|
|
86
106
|
with service:
|
|
@@ -18,19 +18,30 @@ from xp.services.conbus.conbus_discover_service import (
|
|
|
18
18
|
@click.pass_context
|
|
19
19
|
@connection_command()
|
|
20
20
|
def send_discover_telegram(ctx: click.Context) -> None:
|
|
21
|
-
"""
|
|
22
|
-
Send discover telegram to Conbus server.
|
|
21
|
+
r"""Send discover telegram to Conbus server.
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
Args:
|
|
24
|
+
ctx: Click context object.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Examples:
|
|
27
|
+
\b
|
|
27
28
|
xp conbus discover
|
|
28
29
|
"""
|
|
29
30
|
|
|
30
31
|
def finish(discovered_devices: ConbusDiscoverResponse) -> None:
|
|
32
|
+
"""Handle successful completion of device discovery.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
discovered_devices: Discover response with all found devices.
|
|
36
|
+
"""
|
|
31
37
|
click.echo(json.dumps(discovered_devices.to_dict(), indent=2))
|
|
32
38
|
|
|
33
39
|
def progress(_serial_number: str) -> None:
|
|
40
|
+
"""Handle progress updates during device discovery.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
_serial_number: Serial number of discovered device (unused).
|
|
44
|
+
"""
|
|
34
45
|
# click.echo(f"Discovered : {serial_number}")
|
|
35
46
|
pass
|
|
36
47
|
|
|
@@ -27,16 +27,26 @@ from xp.services.conbus.conbus_lightlevel_set_service import (
|
|
|
27
27
|
def xp_lightlevel_set(
|
|
28
28
|
ctx: click.Context, serial_number: str, output_number: int, level: int
|
|
29
29
|
) -> None:
|
|
30
|
-
"""Set light level for output_number on XP module serial_number
|
|
30
|
+
r"""Set light level for output_number on XP module serial_number.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Args:
|
|
33
|
+
ctx: Click context object.
|
|
34
|
+
serial_number: 10-digit module serial number.
|
|
35
|
+
output_number: Output number (0-8).
|
|
36
|
+
level: Light level (0-100).
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
Examples:
|
|
39
|
+
\b
|
|
35
40
|
xp conbus lightlevel set 0123450001 2 50 # Set output 2 to 50%
|
|
36
41
|
xp conbus lightlevel set 0011223344 0 100 # Set output 0 to 100%
|
|
37
42
|
"""
|
|
38
43
|
|
|
39
44
|
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
45
|
+
"""Handle successful completion of light level set command.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
response: Light level response object.
|
|
49
|
+
"""
|
|
40
50
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
41
51
|
|
|
42
52
|
service = (
|
|
@@ -56,16 +66,25 @@ def xp_lightlevel_set(
|
|
|
56
66
|
def xp_lightlevel_off(
|
|
57
67
|
ctx: click.Context, serial_number: str, output_number: int
|
|
58
68
|
) -> None:
|
|
59
|
-
"""Turn off light for output_number on XP module serial_number (set level to 0)
|
|
69
|
+
r"""Turn off light for output_number on XP module serial_number (set level to 0).
|
|
60
70
|
|
|
61
|
-
|
|
71
|
+
Args:
|
|
72
|
+
ctx: Click context object.
|
|
73
|
+
serial_number: 10-digit module serial number.
|
|
74
|
+
output_number: Output number (0-8).
|
|
62
75
|
|
|
63
|
-
|
|
76
|
+
Examples:
|
|
77
|
+
\b
|
|
64
78
|
xp conbus lightlevel off 0123450001 2 # Turn off output 2
|
|
65
79
|
xp conbus lightlevel off 0011223344 0 # Turn off output 0
|
|
66
80
|
"""
|
|
67
81
|
|
|
68
82
|
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
83
|
+
"""Handle successful completion of light level off command.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
response: Light level response object.
|
|
87
|
+
"""
|
|
69
88
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
70
89
|
|
|
71
90
|
service = (
|
|
@@ -85,16 +104,25 @@ def xp_lightlevel_off(
|
|
|
85
104
|
def xp_lightlevel_on(
|
|
86
105
|
ctx: click.Context, serial_number: str, output_number: int
|
|
87
106
|
) -> None:
|
|
88
|
-
"""Turn on light for output_number on XP module serial_number (set level to 80%)
|
|
107
|
+
r"""Turn on light for output_number on XP module serial_number (set level to 80%).
|
|
89
108
|
|
|
90
|
-
|
|
109
|
+
Args:
|
|
110
|
+
ctx: Click context object.
|
|
111
|
+
serial_number: 10-digit module serial number.
|
|
112
|
+
output_number: Output number (0-8).
|
|
91
113
|
|
|
92
|
-
|
|
114
|
+
Examples:
|
|
115
|
+
\b
|
|
93
116
|
xp conbus lightlevel on 0123450001 2 # Turn on output 2 (80%)
|
|
94
117
|
xp conbus lightlevel on 0011223344 0 # Turn on output 0 (80%)
|
|
95
118
|
"""
|
|
96
119
|
|
|
97
120
|
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
121
|
+
"""Handle successful completion of light level on command.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
response: Light level response object.
|
|
125
|
+
"""
|
|
98
126
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
99
127
|
|
|
100
128
|
service = (
|
|
@@ -114,14 +142,25 @@ def xp_lightlevel_on(
|
|
|
114
142
|
def xp_lightlevel_get(
|
|
115
143
|
ctx: click.Context, serial_number: str, output_number: int
|
|
116
144
|
) -> None:
|
|
117
|
-
"""Get current light level for output_number on XP module serial_number
|
|
145
|
+
r"""Get current light level for output_number on XP module serial_number.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
ctx: Click context object.
|
|
149
|
+
serial_number: 10-digit module serial number.
|
|
150
|
+
output_number: Output number (0-8).
|
|
151
|
+
|
|
118
152
|
Examples:
|
|
119
|
-
|
|
153
|
+
\b
|
|
120
154
|
xp conbus lightlevel get 0123450001 2 # Get light level for output 2
|
|
121
155
|
xp conbus lightlevel get 0011223344 0 # Get light level for output 0
|
|
122
156
|
"""
|
|
123
157
|
|
|
124
158
|
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
159
|
+
"""Handle successful completion of light level get command.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
response: Light level response object.
|
|
163
|
+
"""
|
|
125
164
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
126
165
|
|
|
127
166
|
service = (
|