conson-xp 1.34.0__py3-none-any.whl → 1.35.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.
Files changed (29) hide show
  1. {conson_xp-1.34.0.dist-info → conson_xp-1.35.0.dist-info}/METADATA +1 -1
  2. {conson_xp-1.34.0.dist-info → conson_xp-1.35.0.dist-info}/RECORD +29 -29
  3. xp/__init__.py +1 -1
  4. xp/cli/commands/conbus/conbus_actiontable_commands.py +34 -35
  5. xp/cli/commands/conbus/conbus_autoreport_commands.py +11 -10
  6. xp/cli/commands/conbus/conbus_custom_commands.py +6 -4
  7. xp/cli/commands/conbus/conbus_datapoint_commands.py +8 -6
  8. xp/cli/commands/conbus/conbus_lightlevel_commands.py +19 -16
  9. xp/cli/commands/conbus/conbus_linknumber_commands.py +7 -6
  10. xp/cli/commands/conbus/conbus_modulenumber_commands.py +7 -6
  11. xp/cli/commands/conbus/conbus_msactiontable_commands.py +7 -9
  12. xp/cli/commands/conbus/conbus_output_commands.py +9 -7
  13. xp/cli/commands/conbus/conbus_raw_commands.py +7 -2
  14. xp/cli/commands/conbus/conbus_scan_commands.py +4 -2
  15. xp/services/conbus/actiontable/actiontable_download_service.py +79 -37
  16. xp/services/conbus/actiontable/actiontable_list_service.py +17 -17
  17. xp/services/conbus/actiontable/actiontable_upload_service.py +78 -36
  18. xp/services/conbus/actiontable/msactiontable_service.py +88 -48
  19. xp/services/conbus/conbus_custom_service.py +81 -26
  20. xp/services/conbus/conbus_datapoint_queryall_service.py +90 -43
  21. xp/services/conbus/conbus_datapoint_service.py +76 -28
  22. xp/services/conbus/conbus_output_service.py +82 -22
  23. xp/services/conbus/conbus_raw_service.py +78 -37
  24. xp/services/conbus/conbus_scan_service.py +86 -42
  25. xp/services/conbus/write_config_service.py +76 -26
  26. xp/utils/dependencies.py +10 -20
  27. {conson_xp-1.34.0.dist-info → conson_xp-1.35.0.dist-info}/WHEEL +0 -0
  28. {conson_xp-1.34.0.dist-info → conson_xp-1.35.0.dist-info}/entry_points.txt +0 -0
  29. {conson_xp-1.34.0.dist-info → conson_xp-1.35.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: conson-xp
3
- Version: 1.34.0
3
+ Version: 1.35.0
4
4
  Summary: XP Protocol Communication Tools
5
5
  Author-Email: ldvchosal <ldvchosal@github.com>
6
6
  License: MIT License
@@ -1,30 +1,30 @@
1
- conson_xp-1.34.0.dist-info/METADATA,sha256=9ID-C2KoLbshYqzErSWWIRc0q_O9loTVJIOJxGe57NY,11246
2
- conson_xp-1.34.0.dist-info/WHEEL,sha256=tsUv_t7BDeJeRHaSrczbGeuK-TtDpGsWi_JfpzD255I,90
3
- conson_xp-1.34.0.dist-info/entry_points.txt,sha256=1OcdIcDM1hz3ljCXgybaPUh1IOFEwkaTgLIW9u9zGeg,50
4
- conson_xp-1.34.0.dist-info/licenses/LICENSE,sha256=rxj6woMM-r3YCyGq_UHFtbh7kHTAJgrccH6O-33IDE4,1419
5
- xp/__init__.py,sha256=vXeJqE3QI_Fjqi5W7xgUMPTwKhql9XhCnkj3f7fKMjs,181
1
+ conson_xp-1.35.0.dist-info/METADATA,sha256=-Lw1Rw_5jRvY22Z8moRh9N31dx9EuzV7qQ8oZeW_7Og,11246
2
+ conson_xp-1.35.0.dist-info/WHEEL,sha256=tsUv_t7BDeJeRHaSrczbGeuK-TtDpGsWi_JfpzD255I,90
3
+ conson_xp-1.35.0.dist-info/entry_points.txt,sha256=1OcdIcDM1hz3ljCXgybaPUh1IOFEwkaTgLIW9u9zGeg,50
4
+ conson_xp-1.35.0.dist-info/licenses/LICENSE,sha256=rxj6woMM-r3YCyGq_UHFtbh7kHTAJgrccH6O-33IDE4,1419
5
+ xp/__init__.py,sha256=UiuNf-HRLrftHgahYFnTtw0rkyT8zacWREPahcTjY3Q,181
6
6
  xp/cli/__init__.py,sha256=QjnKB1KaI2aIyKlzrnvCwfbBuUj8HNgwNMvNJVQofbI,81
7
7
  xp/cli/__main__.py,sha256=l2iKwMdat5rTGd3JWs-uGksnYYDDffp_Npz05QdKEeU,117
8
8
  xp/cli/commands/__init__.py,sha256=noh8fdZAWq-ihJEboP8WugbIgq4LJ3jUWMRA7720xWE,4909
9
9
  xp/cli/commands/conbus/__init__.py,sha256=gE3K5OEoXkkZX8UOc2v3nreQQzwkOQi7n0VZ-Z2juXA,495
10
10
  xp/cli/commands/conbus/conbus.py,sha256=eqdY8ArapvD08Z4p7Xk7eh4z0dESHuMSw7PKtwTJRYU,3021
11
- xp/cli/commands/conbus/conbus_actiontable_commands.py,sha256=cdjLV9cnm7teEOlu5Jf1MS_aL7lNy8KiDIyjCQa5Nzw,7138
12
- xp/cli/commands/conbus/conbus_autoreport_commands.py,sha256=oZgyUUFNsb4yf2WO81l2w1PrasNwdC__QwxNkJ2jCaU,3794
11
+ xp/cli/commands/conbus/conbus_actiontable_commands.py,sha256=tqZzKU5-PQ1JbdqcbarUA5nlybpB0Es656jG_5Bz3Wg,7128
12
+ xp/cli/commands/conbus/conbus_autoreport_commands.py,sha256=1ltokrvbzoCwwSAKvki-0EuL2M6i-q2E9RSYHwQX2js,3856
13
13
  xp/cli/commands/conbus/conbus_blink_commands.py,sha256=HRn4Lr_BO7_WynsaUnO_hKezOi3MVhkPYEOnh0rMMlg,5324
14
14
  xp/cli/commands/conbus/conbus_config_commands.py,sha256=BugIbgNX6_s4MySGvI6tWZkwguciajHUX2Xz8XBux7k,716
15
- xp/cli/commands/conbus/conbus_custom_commands.py,sha256=lICT93ijMdhVRm8KjNMLo7kQ2BLlnOZvMPbR3SxSmZ4,1692
16
- xp/cli/commands/conbus/conbus_datapoint_commands.py,sha256=r36OuTjREtbGKL-bskAGa0-WLw7x06td6woZn3GYJNA,3630
15
+ xp/cli/commands/conbus/conbus_custom_commands.py,sha256=nQttCXzmuUVLy5u7mZaRqYXzy8MIHyHRJQBdkDLunYc,1735
16
+ xp/cli/commands/conbus/conbus_datapoint_commands.py,sha256=UZ_wTO0cdxjed0fGGZYylfJN9gaXwqLg3cn80JqqWt0,3751
17
17
  xp/cli/commands/conbus/conbus_discover_commands.py,sha256=MnTCzvERO5xerfs0fuuIBoo1O9h_0IfoJ6snLGVl0lA,1899
18
18
  xp/cli/commands/conbus/conbus_event_commands.py,sha256=7URf-2u8Kzcy0chLYShbZfCbKawf--i-8U88AjhxleQ,3177
19
19
  xp/cli/commands/conbus/conbus_export_commands.py,sha256=s3jgg3Wqi1P6rYujpE_9aPA47S4UBQfrZPTr9vzH-UA,2951
20
- xp/cli/commands/conbus/conbus_lightlevel_commands.py,sha256=FpCwogdxa7yFUjlrxM7e8Q2Ut32tKAHabngQQChvtJI,6763
21
- xp/cli/commands/conbus/conbus_linknumber_commands.py,sha256=KitaGDM5HpwVUz8rLpO8VZUypUTcAg3Bzl0DVm6gnSk,3391
22
- xp/cli/commands/conbus/conbus_modulenumber_commands.py,sha256=L7-6y3rDllOjQ9g6Bk_RiTKIhAOHVPLdxWif9exkngs,3463
23
- xp/cli/commands/conbus/conbus_msactiontable_commands.py,sha256=fb9MQ4O04H0Dinpt7vSF5GtfntTZHelQ5TuUmSBbCTg,2899
24
- xp/cli/commands/conbus/conbus_output_commands.py,sha256=zdRVbHzVhMbZpG2x5WXtujc3wKTsoQUV4IgkVIbJbCc,5019
25
- xp/cli/commands/conbus/conbus_raw_commands.py,sha256=8BKUarwvHgz-sxML7n99YVsb8B1HJNExjQpRsuY_tQw,1829
20
+ xp/cli/commands/conbus/conbus_lightlevel_commands.py,sha256=7KeR9YVW2u6DfuEXlrkrv65Q5cfgFnSwJQjK1TuQrLs,6973
21
+ xp/cli/commands/conbus/conbus_linknumber_commands.py,sha256=cd7kvG6Ikf_VqqSxv9enksckd3onUOwziVS9Mr6Yf6k,3465
22
+ xp/cli/commands/conbus/conbus_modulenumber_commands.py,sha256=Z9deoalANi0fkqBUosFvkuD-dnSP5vvi9VPdy0osyDs,3537
23
+ xp/cli/commands/conbus/conbus_msactiontable_commands.py,sha256=rNLWuC19Nj8CxGJNQRCnwl-mEAipz1iufBcIbCytkGM,2847
24
+ xp/cli/commands/conbus/conbus_output_commands.py,sha256=k4DqraUWCbWY6cfSk8WF2WBDz6Dc4ABU1TPq1fCZnRk,5160
25
+ xp/cli/commands/conbus/conbus_raw_commands.py,sha256=892-S6wxp5xNPz6K86Le8KtQXNO4a0PQv20Hzx3vhiA,1996
26
26
  xp/cli/commands/conbus/conbus_receive_commands.py,sha256=_PsC-3xidmJBuOWUS60iDzhSHYYn5ZFmORXap-ljVGM,1902
27
- xp/cli/commands/conbus/conbus_scan_commands.py,sha256=JfXucOwOadvLEKT_fW9fwvqWKHaEODOojLjnO8JV_00,1730
27
+ xp/cli/commands/conbus/conbus_scan_commands.py,sha256=L7YHNnDUWxT8UHkQoNgyKa6twoUrE126XBkT1G76xK0,1805
28
28
  xp/cli/commands/file_commands.py,sha256=GV102X7FRZDUNKLlzvSsIGcoXAaofOzmjCp3HUpE9lw,5532
29
29
  xp/cli/commands/homekit/__init__.py,sha256=qqwY8ulxTx1S74Mzpb6EKjBLT6fWTNdf9PQ3HKuERKY,50
30
30
  xp/cli/commands/homekit/homekit.py,sha256=fiPBlE_nSndyO1ftEyTjL6xmgTh44Q3uZJEIcsf6W9I,3594
@@ -122,25 +122,25 @@ xp/services/actiontable/msactiontable_xp24_serializer.py,sha256=zdKzcrKqD41POqj_
122
122
  xp/services/actiontable/msactiontable_xp33_serializer.py,sha256=xoZBA38pBSUPA9nn7HgaH1ZM5sR2heQbJ6JVlPVbzUY,8400
123
123
  xp/services/conbus/__init__.py,sha256=Hi35sMKu9o6LpYoi2tQDaQoMb8M5sOt_-LUTxxaCU_0,28
124
124
  xp/services/conbus/actiontable/__init__.py,sha256=oD6vRk_Ye-eZ9s_hldAgtRJFu4mfAnODqpkJUGHHszk,40
125
- xp/services/conbus/actiontable/actiontable_download_service.py,sha256=x9k5VlVjvsAJi4McDGqErLaBE_dosV5uMSrNF_r6ic0,6013
126
- xp/services/conbus/actiontable/actiontable_list_service.py,sha256=6izVZkM2hlWXUMUo1NkNzSMvPo0wFfDxYTADQBXQptU,3000
125
+ xp/services/conbus/actiontable/actiontable_download_service.py,sha256=1sk_STBdMfq8YlZnr_7zC_de2Rqkb3SHiKwioTJK2mw,7484
126
+ xp/services/conbus/actiontable/actiontable_list_service.py,sha256=PH8B-5j1ON_Q50INylYhrVDE1gG7vNE1nMyy-2DJfqA,2808
127
127
  xp/services/conbus/actiontable/actiontable_show_service.py,sha256=jqNZ4UvZPHH66OYuryjnU1Km-a83OCwYvK0vc56oL8I,3017
128
- xp/services/conbus/actiontable/actiontable_upload_service.py,sha256=txhMumjcIHPI4TZk6CERhjyyTKUNhUb7fdSmaylYC48,8189
129
- xp/services/conbus/actiontable/msactiontable_service.py,sha256=K0TiYL8g4ac8BS1tqS0UAIYJigOlNhxVLIb8ZFybnVE,8393
128
+ xp/services/conbus/actiontable/actiontable_upload_service.py,sha256=kXV99ReAYcMZt0icPU04lX9ZWWkiiYcxzsty0pnfzwE,9707
129
+ xp/services/conbus/actiontable/msactiontable_service.py,sha256=W44Uy2m2vM_yL57gwyyz59j9zRu5dyAG1g8PJcT7vE8,9777
130
130
  xp/services/conbus/conbus_blink_all_service.py,sha256=6XsqtgHUgPDPWG0Mx2W2gnG_1eiaHrt2DiPXGqGHS50,8472
131
131
  xp/services/conbus/conbus_blink_service.py,sha256=wFCUbHYInbzfE4Ks_qjkav0FhtHXsxM9IY6tD5r0oAk,7898
132
- xp/services/conbus/conbus_custom_service.py,sha256=4aneYdPObiZOGxPFYg5Wr70cl_xFxlQIdJBPQSa0enI,5826
133
- xp/services/conbus/conbus_datapoint_queryall_service.py,sha256=p9R02cVimhdJILHQ6BoeZj8Hog4oRpqBnMo3t4R8ecY,6816
134
- xp/services/conbus/conbus_datapoint_service.py,sha256=SYhHj9RmTmaJ750tyZ1IW2kl7tgDQ1xm_EM1zUjk1aQ,6421
132
+ xp/services/conbus/conbus_custom_service.py,sha256=uPsBkoVGr8I5JwpHiCM8Xf2DUYy6e34cQHmGSheY98Y,7766
133
+ xp/services/conbus/conbus_datapoint_queryall_service.py,sha256=K8a_aO5rXuOx9ZHTrN1rpQ6KIOAkhYx-HsqDf0HIo-E,8399
134
+ xp/services/conbus/conbus_datapoint_service.py,sha256=MjUHHkFgFD5Ex5sESamylPzoHfYRmIOZWnTIdI0AXjY,8037
135
135
  xp/services/conbus/conbus_discover_service.py,sha256=ZwjYBlgP6FgpHBJk7pcKr4JHfH7WUHDxe4he4F_HblQ,12740
136
136
  xp/services/conbus/conbus_event_list_service.py,sha256=0xyXXNU44epN5bFkU6oiZMyhxfUguul3evqClvPJDcA,3618
137
137
  xp/services/conbus/conbus_event_raw_service.py,sha256=FZFu-LNLInrTKTpiGLyootozvyIF5Si5FMrxNk2ALD0,7000
138
138
  xp/services/conbus/conbus_export_service.py,sha256=3Zb58qqRDNR9gA4rQ_fyT--ZgRIK_lkqnXJFbQnrZOA,17300
139
- xp/services/conbus/conbus_output_service.py,sha256=mHFOAPx2zo0TStZ3pokp6v94AQjIamcwZDeg5YH_-eo,7240
140
- xp/services/conbus/conbus_raw_service.py,sha256=4yZLLTIAOxpgByUTWZXw1ihGa6Xtl98ckj9T7VfprDI,4335
139
+ xp/services/conbus/conbus_output_service.py,sha256=XHn_htcTt2TBSpuXr2DNsT8oOC2soctNFIojhYfd_v0,9297
140
+ xp/services/conbus/conbus_raw_service.py,sha256=FmUaF9o2nFZVP8LpabKIwkg0P8coLCkeJC4yYgsA6U0,5780
141
141
  xp/services/conbus/conbus_receive_service.py,sha256=7wOaEDrdoXwZE9MeUM89eB3hobYpvtbYk_YLv3MVAtc,5352
142
- xp/services/conbus/conbus_scan_service.py,sha256=tHJ5qaxcNXxAZb2D2F1v6IrzydfxjJOYllM6Txt1eBE,5176
143
- xp/services/conbus/write_config_service.py,sha256=6feNdixI_Nli4MRLe15nea-7gTEXMUwZIvTqv_1OqHI,7157
142
+ xp/services/conbus/conbus_scan_service.py,sha256=QN7_x8BtNbHnqG7akcooAAcjz9Ex2y3VNDdhShKHUX8,6824
143
+ xp/services/conbus/write_config_service.py,sha256=PQsN7rtTKHpwtAG8moLksUfRVqqE_0sxdE37meR1ZQ0,8935
144
144
  xp/services/homekit/__init__.py,sha256=xAMKmln_AmEFdOOJGKWYi96seRlKDQpKx3-hm7XbdIo,36
145
145
  xp/services/homekit/homekit_cache_service.py,sha256=NdijyH5_iyhsTHBb-OyT8Y2xnNDj8F5MP8neoVQ26hY,11010
146
146
  xp/services/homekit/homekit_conbus_service.py,sha256=porvo4nZ4PE0R6bdaKwClDW2kevkW_8DOzw4NOO6DZQ,3348
@@ -198,10 +198,10 @@ xp/term/widgets/protocol_log.py,sha256=CJUpckWj7GC1kVqixDadteyGnI4aHyzd4kkH-pSbz
198
198
  xp/term/widgets/status_footer.py,sha256=bxrcqKzJ9V0aPSn_WwraVpJz7NxBUh3yIjA3fwv5nVA,3256
199
199
  xp/utils/__init__.py,sha256=_avMF_UOkfR3tNeDIPqQ5odmbq5raKkaq1rZ9Cn1CJs,332
200
200
  xp/utils/checksum.py,sha256=HDpiQxmdIedbCbZ4o_Box0i_Zig417BtCV_46ZyhiTk,1711
201
- xp/utils/dependencies.py,sha256=jN2FNwUUacmrEXsOA-zWe-1yWr16x9BaVfLjmFxIJKg,24437
201
+ xp/utils/dependencies.py,sha256=dA43oSFnhqqthSkX_wVlJorxWuSBT21rubkaYxWHbKY,23837
202
202
  xp/utils/event_helper.py,sha256=W-A_xmoXlpWZBbJH6qdaN50o3-XrwFsDgvAGMJDiAgo,1001
203
203
  xp/utils/logging.py,sha256=rZDXwlBrYK8A6MPq5StsMNpgsRowzJXM6fvROPwJdGM,3750
204
204
  xp/utils/serialization.py,sha256=RWHHk86feaB4ZP7rjE4qOWK0900yg2joUBDkP76gfOY,4618
205
205
  xp/utils/state_machine.py,sha256=Oe2sLwCh9z_vr1tF6X0ZRGTeuckRQAGzmef7xc9CNdc,2413
206
206
  xp/utils/time_utils.py,sha256=dEyViDlAG9GWU-J3D_YVa-sGma6yiyyMTgN4h2x3PY4,3781
207
- conson_xp-1.34.0.dist-info/RECORD,,
207
+ conson_xp-1.35.0.dist-info/RECORD,,
xp/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  conson-xp package.
4
4
  """
5
5
 
6
- __version__ = "1.34.0"
6
+ __version__ = "1.35.0"
7
7
  __manufacturer__ = "salchichon"
8
8
  __model__ = "xp.cli"
9
9
  __serial__ = "2025.09.23.000"
@@ -3,7 +3,6 @@
3
3
  import json
4
4
  from contextlib import suppress
5
5
  from pathlib import Path
6
- from typing import Any
7
6
 
8
7
  import click
9
8
  from click import Context
@@ -13,7 +12,6 @@ from xp.cli.utils.decorators import (
13
12
  connection_command,
14
13
  )
15
14
  from xp.cli.utils.serial_number_type import SERIAL
16
- from xp.models.actiontable.actiontable import ActionTable
17
15
  from xp.models.homekit.homekit_conson_config import (
18
16
  ConsonModuleConfig,
19
17
  ConsonModuleListConfig,
@@ -53,7 +51,7 @@ def conbus_download_actiontable(ctx: Context, serial_number: str) -> None:
53
51
  ctx.obj.get("container").get_container().resolve(ActionTableService)
54
52
  )
55
53
 
56
- def progress_callback(progress: str) -> None:
54
+ def on_progress(progress: str) -> None:
57
55
  """Handle progress updates during action table download.
58
56
 
59
57
  Args:
@@ -61,40 +59,36 @@ def conbus_download_actiontable(ctx: Context, serial_number: str) -> None:
61
59
  """
62
60
  click.echo(progress)
63
61
 
64
- def on_finish(
65
- _actiontable: ActionTable,
66
- actiontable_dict: dict[str, Any],
67
- actiontable_short: list[str],
68
- ) -> None:
62
+ def on_finish(result: tuple) -> None:
69
63
  """Handle successful completion of action table download.
70
64
 
71
65
  Args:
72
- _actiontable: Downloaded action table object.
73
- actiontable_dict: Dictionary representation of action table.
74
- actiontable_short: List of textual format strings.
66
+ result: Tuple of (_actiontable, actiontable_dict, actiontable_short).
75
67
  """
68
+ _actiontable, actiontable_dict, actiontable_short = result
76
69
  output = {
77
70
  "serial_number": serial_number,
78
71
  "actiontable_short": actiontable_short,
79
72
  "actiontable": actiontable_dict,
80
73
  }
81
74
  click.echo(json.dumps(output, indent=2, default=str))
75
+ service.stop_reactor()
82
76
 
83
- def error_callback(error: str) -> None:
77
+ def on_error(error: str) -> None:
84
78
  """Handle errors during action table download.
85
79
 
86
80
  Args:
87
81
  error: Error message string.
88
82
  """
89
83
  click.echo(error)
84
+ service.stop_reactor()
90
85
 
91
86
  with service:
92
- service.start(
93
- serial_number=serial_number,
94
- progress_callback=progress_callback,
95
- finish_callback=on_finish,
96
- error_callback=error_callback,
97
- )
87
+ service.on_progress.connect(on_progress)
88
+ service.on_finish.connect(on_finish)
89
+ service.on_error.connect(on_error)
90
+ service.start(serial_number=serial_number)
91
+ service.start_reactor()
98
92
 
99
93
 
100
94
  @conbus_actiontable.command("upload", short_help="Upload ActionTable")
@@ -125,13 +119,19 @@ def conbus_upload_actiontable(ctx: Context, serial_number: str) -> None:
125
119
  """
126
120
  click.echo(progress, nl=False)
127
121
 
128
- def success_callback() -> None:
129
- """Handle successful completion of action table upload."""
130
- click.echo("\nAction table uploaded successfully")
131
- if entries_count > 0:
132
- click.echo(f"{entries_count} entries written")
122
+ def on_finish(success: bool) -> None:
123
+ """Handle completion of action table upload.
133
124
 
134
- def error_callback(error: str) -> None:
125
+ Args:
126
+ success: True if upload succeeded.
127
+ """
128
+ if success:
129
+ click.echo("\nAction table uploaded successfully")
130
+ if entries_count > 0:
131
+ click.echo(f"{entries_count} entries written")
132
+ service.stop_reactor()
133
+
134
+ def on_error(error: str) -> None:
135
135
  """Handle errors during action table upload.
136
136
 
137
137
  Args:
@@ -140,6 +140,7 @@ def conbus_upload_actiontable(ctx: Context, serial_number: str) -> None:
140
140
  Raises:
141
141
  ActionTableError: Always raised with upload failure message.
142
142
  """
143
+ service.stop_reactor()
143
144
  raise ActionTableError(f"Upload failed: {error}")
144
145
 
145
146
  with service:
@@ -152,12 +153,11 @@ def conbus_upload_actiontable(ctx: Context, serial_number: str) -> None:
152
153
  if module and module.action_table:
153
154
  entries_count = len(module.action_table)
154
155
 
155
- service.start(
156
- serial_number=serial_number,
157
- progress_callback=progress_callback,
158
- success_callback=success_callback,
159
- error_callback=error_callback,
160
- )
156
+ service.on_progress.connect(progress_callback)
157
+ service.on_finish.connect(on_finish)
158
+ service.on_error.connect(on_error)
159
+ service.start(serial_number=serial_number)
160
+ service.start_reactor()
161
161
 
162
162
 
163
163
  @conbus_actiontable.command("list", short_help="List modules with ActionTable")
@@ -180,7 +180,7 @@ def conbus_list_actiontable(ctx: Context) -> None:
180
180
  """
181
181
  click.echo(json.dumps(module_list, indent=2, default=str))
182
182
 
183
- def error_callback(error: str) -> None:
183
+ def on_error(error: str) -> None:
184
184
  """Handle errors during action table list.
185
185
 
186
186
  Args:
@@ -189,10 +189,9 @@ def conbus_list_actiontable(ctx: Context) -> None:
189
189
  click.echo(error)
190
190
 
191
191
  with service:
192
- service.start(
193
- finish_callback=on_finish,
194
- error_callback=error_callback,
195
- )
192
+ service.on_finish.connect(on_finish)
193
+ service.on_error.connect(on_error)
194
+ service.start()
196
195
 
197
196
 
198
197
  @conbus_actiontable.command("show", short_help="Show ActionTable configuration")
@@ -55,10 +55,9 @@ def get_autoreport_command(ctx: Context, serial_number: str) -> None:
55
55
  click.echo(json.dumps(result, indent=2))
56
56
 
57
57
  with service:
58
+ service.on_finish.connect(on_finish)
58
59
  service.query_datapoint(
59
- serial_number=serial_number,
60
- datapoint_type=DataPointType.AUTO_REPORT_STATUS,
61
- finish_callback=on_finish,
60
+ serial_number=serial_number, datapoint_type=DataPointType.AUTO_REPORT_STATUS
62
61
  )
63
62
 
64
63
 
@@ -80,6 +79,12 @@ def set_autoreport_command(ctx: Context, serial_number: str, status: str) -> Non
80
79
  xp conbus autoreport set 0123450001 on
81
80
  xp conbus autoreport set 0123450001 off
82
81
  """
82
+ service: WriteConfigService = (
83
+ ctx.obj.get("container").get_container().resolve(WriteConfigService)
84
+ )
85
+ telegram_service: TelegramDatapointService = (
86
+ ctx.obj.get("container").get_container().resolve(TelegramDatapointService)
87
+ )
83
88
 
84
89
  def on_finish(response: "ConbusWriteConfigResponse") -> None:
85
90
  """Handle successful completion of light level on command.
@@ -88,21 +93,17 @@ def set_autoreport_command(ctx: Context, serial_number: str, status: str) -> Non
88
93
  response: Light level response object.
89
94
  """
90
95
  click.echo(json.dumps(response.to_dict(), indent=2))
96
+ service.stop_reactor()
91
97
 
92
- service: WriteConfigService = (
93
- ctx.obj.get("container").get_container().resolve(WriteConfigService)
94
- )
95
- telegram_service: TelegramDatapointService = (
96
- ctx.obj.get("container").get_container().resolve(TelegramDatapointService)
97
- )
98
98
  status_value = True if status == "on" else False
99
99
  data_value = telegram_service.get_autoreport_status_data_value(status_value)
100
100
 
101
101
  with service:
102
+ service.on_finish.connect(on_finish)
102
103
  service.write_config(
103
104
  serial_number=serial_number,
104
105
  datapoint_type=DataPointType.AUTO_REPORT_STATUS,
105
106
  data_value=data_value,
106
- finish_callback=on_finish,
107
107
  timeout_seconds=0.5,
108
108
  )
109
+ service.start_reactor()
@@ -40,18 +40,20 @@ def send_custom_telegram(
40
40
  ctx.obj.get("container").get_container().resolve(ConbusCustomService)
41
41
  )
42
42
 
43
- def on_finish(service_response: "ConbusCustomResponse") -> None:
43
+ def on_finish(response: ConbusCustomResponse) -> None:
44
44
  """Handle successful completion of custom telegram.
45
45
 
46
46
  Args:
47
- service_response: Custom response object.
47
+ response: Custom response object.
48
48
  """
49
- click.echo(json.dumps(service_response.to_dict(), indent=2))
49
+ click.echo(json.dumps(response.to_dict(), indent=2))
50
+ service.stop_reactor()
50
51
 
51
52
  with service:
53
+ service.on_finish.connect(on_finish)
52
54
  service.send_custom_telegram(
53
55
  serial_number=serial_number,
54
56
  function_code=function_code,
55
57
  data=datapoint_code,
56
- finish_callback=on_finish,
57
58
  )
59
+ service.start_reactor()
@@ -56,14 +56,16 @@ def query_datapoint(ctx: Context, serial_number: str, datapoint: DataPointType)
56
56
  service_response: Datapoint response object.
57
57
  """
58
58
  click.echo(json.dumps(service_response.to_dict(), indent=2))
59
+ service.stop_reactor()
59
60
 
60
61
  # Send telegram
61
62
  with service:
63
+ service.on_finish.connect(on_finish)
62
64
  service.query_datapoint(
63
65
  serial_number=serial_number,
64
66
  datapoint_type=datapoint,
65
- finish_callback=on_finish,
66
67
  )
68
+ service.start_reactor()
67
69
 
68
70
 
69
71
  # Add the single datapoint query command to the group
@@ -96,6 +98,7 @@ def query_all_datapoints(ctx: Context, serial_number: str) -> None:
96
98
  service_response: Datapoint response object with all datapoints.
97
99
  """
98
100
  click.echo(json.dumps(service_response.to_dict(), indent=2))
101
+ service.stop_reactor()
99
102
 
100
103
  def on_progress(reply_telegram: ReplyTelegram) -> None:
101
104
  """Handle progress updates during all datapoints query.
@@ -106,8 +109,7 @@ def query_all_datapoints(ctx: Context, serial_number: str) -> None:
106
109
  click.echo(json.dumps(reply_telegram.to_dict(), indent=2))
107
110
 
108
111
  with service:
109
- service.query_all_datapoints(
110
- serial_number=serial_number,
111
- finish_callback=on_finish,
112
- progress_callback=on_progress,
113
- )
112
+ service.on_finish.connect(on_finish)
113
+ service.on_progress.connect(on_progress)
114
+ service.query_all_datapoints(serial_number=serial_number)
115
+ service.start_reactor()
@@ -39,6 +39,9 @@ def xp_lightlevel_set(
39
39
  xp conbus lightlevel set 0123450001 2 50 # Set output 2 to 50%
40
40
  xp conbus lightlevel set 0011223344 0 100 # Set output 0 to 100%
41
41
  """
42
+ service: WriteConfigService = (
43
+ ctx.obj.get("container").get_container().resolve(WriteConfigService)
44
+ )
42
45
 
43
46
  def on_finish(response: "ConbusWriteConfigResponse") -> None:
44
47
  """Handle successful completion of light level on command.
@@ -47,21 +50,19 @@ def xp_lightlevel_set(
47
50
  response: Light level response object.
48
51
  """
49
52
  click.echo(json.dumps(response.to_dict(), indent=2))
50
-
51
- service: WriteConfigService = (
52
- ctx.obj.get("container").get_container().resolve(WriteConfigService)
53
- )
53
+ service.stop_reactor()
54
54
 
55
55
  data_value = f"{output_number:02d}:{level:03d}"
56
56
 
57
57
  with service:
58
+ service.on_finish.connect(on_finish)
58
59
  service.write_config(
59
60
  serial_number=serial_number,
60
61
  datapoint_type=DataPointType.MODULE_LIGHT_LEVEL,
61
62
  data_value=data_value,
62
- finish_callback=on_finish,
63
63
  timeout_seconds=0.5,
64
64
  )
65
+ service.start_reactor()
65
66
 
66
67
 
67
68
  @conbus_lightlevel.command("off")
@@ -84,6 +85,9 @@ def xp_lightlevel_off(
84
85
  xp conbus lightlevel off 0123450001 2 # Turn off output 2
85
86
  xp conbus lightlevel off 0011223344 0 # Turn off output 0
86
87
  """
88
+ service: WriteConfigService = (
89
+ ctx.obj.get("container").get_container().resolve(WriteConfigService)
90
+ )
87
91
 
88
92
  def on_finish(response: "ConbusWriteConfigResponse") -> None:
89
93
  """Handle successful completion of light level on command.
@@ -92,22 +96,20 @@ def xp_lightlevel_off(
92
96
  response: Light level response object.
93
97
  """
94
98
  click.echo(json.dumps(response.to_dict(), indent=2))
95
-
96
- service: WriteConfigService = (
97
- ctx.obj.get("container").get_container().resolve(WriteConfigService)
98
- )
99
+ service.stop_reactor()
99
100
 
100
101
  level = 0
101
102
  data_value = f"{output_number:02d}:{level:03d}"
102
103
 
103
104
  with service:
105
+ service.on_finish.connect(on_finish)
104
106
  service.write_config(
105
107
  serial_number=serial_number,
106
108
  datapoint_type=DataPointType.MODULE_LIGHT_LEVEL,
107
109
  data_value=data_value,
108
- finish_callback=on_finish,
109
110
  timeout_seconds=0.5,
110
111
  )
112
+ service.start_reactor()
111
113
 
112
114
 
113
115
  @conbus_lightlevel.command("on")
@@ -130,6 +132,9 @@ def xp_lightlevel_on(
130
132
  xp conbus lightlevel on 0123450001 2 # Turn on output 2 (80%)
131
133
  xp conbus lightlevel on 0011223344 0 # Turn on output 0 (80%)
132
134
  """
135
+ service: WriteConfigService = (
136
+ ctx.obj.get("container").get_container().resolve(WriteConfigService)
137
+ )
133
138
 
134
139
  def on_finish(response: "ConbusWriteConfigResponse") -> None:
135
140
  """Handle successful completion of light level on command.
@@ -138,22 +143,20 @@ def xp_lightlevel_on(
138
143
  response: Light level response object.
139
144
  """
140
145
  click.echo(json.dumps(response.to_dict(), indent=2))
141
-
142
- service: WriteConfigService = (
143
- ctx.obj.get("container").get_container().resolve(WriteConfigService)
144
- )
146
+ service.stop_reactor()
145
147
 
146
148
  level = 60
147
149
  data_value = f"{output_number:02d}:{level:03d}"
148
150
 
149
151
  with service:
152
+ service.on_finish.connect(on_finish)
150
153
  service.write_config(
151
154
  serial_number=serial_number,
152
155
  datapoint_type=DataPointType.MODULE_LIGHT_LEVEL,
153
156
  data_value=data_value,
154
- finish_callback=on_finish,
155
157
  timeout_seconds=0.5,
156
158
  )
159
+ service.start_reactor()
157
160
 
158
161
 
159
162
  @conbus_lightlevel.command("get")
@@ -199,9 +202,9 @@ def xp_lightlevel_get(
199
202
  click.echo(json.dumps(result, indent=2))
200
203
 
201
204
  with service:
205
+ service.on_finish.connect(on_finish)
202
206
  service.query_datapoint(
203
207
  serial_number=serial_number,
204
208
  datapoint_type=DataPointType.MODULE_LIGHT_LEVEL,
205
- finish_callback=on_finish,
206
209
  timeout_seconds=0.5,
207
210
  )
@@ -36,6 +36,9 @@ def set_linknumber_command(
36
36
  \b
37
37
  xp conbus linknumber set 0123450001 25
38
38
  """
39
+ service: WriteConfigService = (
40
+ ctx.obj.get("container").get_container().resolve(WriteConfigService)
41
+ )
39
42
 
40
43
  def on_finish(response: "ConbusWriteConfigResponse") -> None:
41
44
  """Handle successful completion of light level on command.
@@ -44,20 +47,18 @@ def set_linknumber_command(
44
47
  response: Light level response object.
45
48
  """
46
49
  click.echo(json.dumps(response.to_dict(), indent=2))
47
-
48
- service: WriteConfigService = (
49
- ctx.obj.get("container").get_container().resolve(WriteConfigService)
50
- )
50
+ service.stop_reactor()
51
51
 
52
52
  data_value = f"{link_number:02d}"
53
53
  with service:
54
+ service.on_finish.connect(on_finish)
54
55
  service.write_config(
55
56
  serial_number=serial_number,
56
57
  datapoint_type=DataPointType.LINK_NUMBER,
57
58
  data_value=data_value,
58
- finish_callback=on_finish,
59
59
  timeout_seconds=0.5,
60
60
  )
61
+ service.start_reactor()
61
62
 
62
63
 
63
64
  @conbus_linknumber.command("get", short_help="Get link number for a module")
@@ -94,9 +95,9 @@ def get_linknumber_command(ctx: click.Context, serial_number: str) -> None:
94
95
  click.echo(json.dumps(result, indent=2))
95
96
 
96
97
  with service:
98
+ service.on_finish.connect(on_finish)
97
99
  service.query_datapoint(
98
100
  serial_number=serial_number,
99
101
  datapoint_type=DataPointType.LINK_NUMBER,
100
- finish_callback=on_finish,
101
102
  timeout_seconds=0.5,
102
103
  )
@@ -36,6 +36,9 @@ def set_modulenumber_command(
36
36
  \b
37
37
  xp conbus modulenumber set 0123450001 25
38
38
  """
39
+ service: WriteConfigService = (
40
+ ctx.obj.get("container").get_container().resolve(WriteConfigService)
41
+ )
39
42
 
40
43
  def on_finish(response: "ConbusWriteConfigResponse") -> None:
41
44
  """Handle successful completion of light level on command.
@@ -44,20 +47,18 @@ def set_modulenumber_command(
44
47
  response: Light level response object.
45
48
  """
46
49
  click.echo(json.dumps(response.to_dict(), indent=2))
47
-
48
- service: WriteConfigService = (
49
- ctx.obj.get("container").get_container().resolve(WriteConfigService)
50
- )
50
+ service.stop_reactor()
51
51
 
52
52
  data_value = f"{module_number:02d}"
53
53
  with service:
54
+ service.on_finish.connect(on_finish)
54
55
  service.write_config(
55
56
  serial_number=serial_number,
56
57
  datapoint_type=DataPointType.MODULE_NUMBER,
57
58
  data_value=data_value,
58
- finish_callback=on_finish,
59
59
  timeout_seconds=0.5,
60
60
  )
61
+ service.start_reactor()
61
62
 
62
63
 
63
64
  @conbus_modulenumber.command("get", short_help="Get module number for a module")
@@ -96,9 +97,9 @@ def get_modulenumber_command(ctx: click.Context, serial_number: str) -> None:
96
97
  click.echo(json.dumps(result, indent=2))
97
98
 
98
99
  with service:
100
+ service.on_finish.connect(on_finish)
99
101
  service.query_datapoint(
100
102
  serial_number=serial_number,
101
103
  datapoint_type=DataPointType.MODULE_NUMBER,
102
- finish_callback=on_finish,
103
104
  timeout_seconds=0.5,
104
105
  )
@@ -40,7 +40,7 @@ def conbus_download_msactiontable(
40
40
  ctx.obj.get("container").get_container().resolve(MsActionTableService)
41
41
  )
42
42
 
43
- def progress_callback(progress: str) -> None:
43
+ def on_progress(progress: str) -> None:
44
44
  """Handle progress updates during MS action table download.
45
45
 
46
46
  Args:
@@ -61,6 +61,7 @@ def conbus_download_msactiontable(
61
61
  Raises:
62
62
  Abort: If action table download failed.
63
63
  """
64
+ service.stop_reactor()
64
65
  if action_table is None:
65
66
  click.echo("Error: Failed to download MS action table")
66
67
  raise click.Abort()
@@ -72,23 +73,20 @@ def conbus_download_msactiontable(
72
73
  }
73
74
  click.echo(json.dumps(output, indent=2, default=str))
74
75
 
75
- def error_callback(error: str) -> None:
76
+ def on_error(error: str) -> None:
76
77
  """Handle errors during MS action table download.
77
78
 
78
79
  Args:
79
80
  error: Error message string.
80
-
81
- Raises:
82
- Abort: Always raised to abort the command on error.
83
81
  """
84
82
  click.echo(f"Error: {error}")
85
- raise click.Abort()
86
83
 
87
84
  with service:
85
+ service.on_progress.connect(on_progress)
86
+ service.on_error.connect(on_error)
87
+ service.on_finish.connect(on_finish)
88
88
  service.start(
89
89
  serial_number=serial_number,
90
90
  xpmoduletype=xpmoduletype,
91
- progress_callback=progress_callback,
92
- finish_callback=on_finish,
93
- error_callback=error_callback,
94
91
  )
92
+ service.start_reactor()