conson-xp 0.11.19__py3-none-any.whl → 1.0.1__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-0.11.19.dist-info → conson_xp-1.0.1.dist-info}/METADATA +1 -1
- {conson_xp-0.11.19.dist-info → conson_xp-1.0.1.dist-info}/RECORD +23 -23
- xp/__init__.py +1 -1
- xp/cli/commands/__init__.py +0 -1
- xp/cli/commands/conbus/conbus_config_commands.py +3 -12
- xp/cli/commands/conbus/conbus_lightlevel_commands.py +35 -16
- xp/cli/commands/conbus/conbus_linknumber_commands.py +24 -11
- xp/cli/commands/conbus/conbus_output_commands.py +44 -18
- xp/models/conbus/conbus.py +12 -11
- xp/models/conbus/conbus_linknumber.py +1 -1
- xp/services/conbus/conbus_autoreport_get_service.py +29 -73
- xp/services/conbus/conbus_datapoint_service.py +6 -1
- xp/services/conbus/conbus_lightlevel_get_service.py +101 -0
- xp/services/conbus/conbus_lightlevel_set_service.py +205 -0
- xp/services/conbus/conbus_linknumber_get_service.py +86 -0
- xp/services/conbus/conbus_linknumber_set_service.py +155 -0
- xp/services/conbus/conbus_output_service.py +129 -92
- xp/services/conbus/conbus_scan_service.py +94 -98
- xp/services/protocol/conbus_protocol.py +1 -0
- xp/utils/dependencies.py +26 -50
- xp/services/conbus/conbus_connection_pool.py +0 -148
- xp/services/conbus/conbus_lightlevel_service.py +0 -205
- xp/services/conbus/conbus_linknumber_service.py +0 -197
- xp/services/conbus/conbus_service.py +0 -306
- {conson_xp-0.11.19.dist-info → conson_xp-1.0.1.dist-info}/WHEEL +0 -0
- {conson_xp-0.11.19.dist-info → conson_xp-1.0.1.dist-info}/entry_points.txt +0 -0
- {conson_xp-0.11.19.dist-info → conson_xp-1.0.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
conson_xp-0.
|
|
2
|
-
conson_xp-0.
|
|
3
|
-
conson_xp-0.
|
|
4
|
-
conson_xp-0.
|
|
5
|
-
xp/__init__.py,sha256=
|
|
1
|
+
conson_xp-1.0.1.dist-info/METADATA,sha256=wo_NyCrK54bsHkSF0LihKlfeDtxR02DHb8ONbd-Wv_I,9296
|
|
2
|
+
conson_xp-1.0.1.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
conson_xp-1.0.1.dist-info/entry_points.txt,sha256=1OcdIcDM1hz3ljCXgybaPUh1IOFEwkaTgLIW9u9zGeg,50
|
|
4
|
+
conson_xp-1.0.1.dist-info/licenses/LICENSE,sha256=rxj6woMM-r3YCyGq_UHFtbh7kHTAJgrccH6O-33IDE4,1419
|
|
5
|
+
xp/__init__.py,sha256=vAQhsuRRkcqth5YA78Q1OHLSN5KKxSPyl7s7tokrbis,175
|
|
6
6
|
xp/api/__init__.py,sha256=fCWjkuTzDlyJ8hIpU_QEBNcah3BB2bqVSfZwmP4ee5k,51
|
|
7
7
|
xp/api/main.py,sha256=8OMXUYKnpsqjjnLChokC_M0DXZy-whrxY2dU4QTvr8A,3389
|
|
8
8
|
xp/api/models/__init__.py,sha256=Xl8j2qiHc-Vb8b1ZmNZaMj7RtMvk0G_2SOvMgQumYzs,54
|
|
@@ -17,7 +17,7 @@ xp/api/routers/conbus_output.py,sha256=U-i7kjZv7H6aE0O_8AcZIKZDJuYwU8XostEWoNccn
|
|
|
17
17
|
xp/api/routers/errors.py,sha256=5vzpeTt0cPQZDHL5YgrYJUxMh4uI7IgUNFAvL0NpLKM,1267
|
|
18
18
|
xp/cli/__init__.py,sha256=KWYwhOU46dNEerlc2i4FHsVR4Fxmt90Pw5L5i2v1Jqc,80
|
|
19
19
|
xp/cli/__main__.py,sha256=l2iKwMdat5rTGd3JWs-uGksnYYDDffp_Npz05QdKEeU,117
|
|
20
|
-
xp/cli/commands/__init__.py,sha256=
|
|
20
|
+
xp/cli/commands/__init__.py,sha256=dJ_VaOojg14vdx4OwxbDH-egJd16h3uT7f5DSQX4ZB0,4459
|
|
21
21
|
xp/cli/commands/api.py,sha256=d9uD5NnDV807suEK6eLzJSl62TGTtFSwIA_foPc6wtg,340
|
|
22
22
|
xp/cli/commands/api_start_commands.py,sha256=q9yOkiIY-NmRD04pq3N6rRe-BjnrcMRZmai8Jg5TKhA,3116
|
|
23
23
|
xp/cli/commands/conbus/__init__.py,sha256=gE3K5OEoXkkZX8UOc2v3nreQQzwkOQi7n0VZ-Z2juXA,495
|
|
@@ -25,14 +25,14 @@ xp/cli/commands/conbus/conbus.py,sha256=fVLbAg0kuodUdx9RfE4vVR3L_bc8liDP2cOEyup7
|
|
|
25
25
|
xp/cli/commands/conbus/conbus_actiontable_commands.py,sha256=CjJKFTB_oHENKY165j0lQBBndf9S36K-ykogv7kSppQ,1436
|
|
26
26
|
xp/cli/commands/conbus/conbus_autoreport_commands.py,sha256=EfCLZhuDu8uXDVGKE1eJ5Ji9mUauJLoGXqP4zFn2LhA,2501
|
|
27
27
|
xp/cli/commands/conbus/conbus_blink_commands.py,sha256=g2zGEXce2aTReCCNp7ph0-uI7YhWEgz_Z048-3YC36w,3696
|
|
28
|
-
xp/cli/commands/conbus/conbus_config_commands.py,sha256=
|
|
28
|
+
xp/cli/commands/conbus/conbus_config_commands.py,sha256=Wphy_gxjc5pdPRzw8ElHC3G1jLxoUqmIBe-MFL54LN8,593
|
|
29
29
|
xp/cli/commands/conbus/conbus_custom_commands.py,sha256=NH8WDm31-7tb-KYH8nZprEXgo8a4asLWmNd0EgJVSHQ,1336
|
|
30
30
|
xp/cli/commands/conbus/conbus_datapoint_commands.py,sha256=Ozc36DFKVfzDZyWU9xVdhebiYy8yodb_DgVKEpzK9Jg,2842
|
|
31
31
|
xp/cli/commands/conbus/conbus_discover_commands.py,sha256=5HwuhlC3qyYJqLBuqQVyu5kr493BJOZ281V2pXtfoCY,961
|
|
32
|
-
xp/cli/commands/conbus/conbus_lightlevel_commands.py,sha256
|
|
33
|
-
xp/cli/commands/conbus/conbus_linknumber_commands.py,sha256=
|
|
32
|
+
xp/cli/commands/conbus/conbus_lightlevel_commands.py,sha256=hMzQewTgqGNB6s_Pag2HNfImhpgXnitwUVgMM6XXJv8,4161
|
|
33
|
+
xp/cli/commands/conbus/conbus_linknumber_commands.py,sha256=IQ_DjBoUOYSkP5JxUuJYaKdxjwcOWGUZz7R-6sFeAAk,2256
|
|
34
34
|
xp/cli/commands/conbus/conbus_msactiontable_commands.py,sha256=n1g-ZKjjjbCQqTPGCrcCB595QoRClv0DGvGEx8y7BAY,1728
|
|
35
|
-
xp/cli/commands/conbus/conbus_output_commands.py,sha256=
|
|
35
|
+
xp/cli/commands/conbus/conbus_output_commands.py,sha256=Y98-ibcgGB_L52VtczyJqtkGLKESzZjeGvwdLdwM35E,3900
|
|
36
36
|
xp/cli/commands/conbus/conbus_raw_commands.py,sha256=NRST1cg9tO7zVUwiTKqCBpwfwP1-yvnKTDrwwIMaz68,1572
|
|
37
37
|
xp/cli/commands/conbus/conbus_receive_commands.py,sha256=jV5zAmiIKK3_oDpTs9yF1YklIRcJNvOrkI6O2deb1eQ,1380
|
|
38
38
|
xp/cli/commands/conbus/conbus_scan_commands.py,sha256=HjZMhU1hPRuUSWMURB9UUeZt8aNMDlBYCktwrXUgsCY,4190
|
|
@@ -71,7 +71,7 @@ xp/models/actiontable/msactiontable_xp20.py,sha256=JNi2gx0ObbEZ-qq-MNECc4zoCypDp
|
|
|
71
71
|
xp/models/actiontable/msactiontable_xp24.py,sha256=edDG2wCf1IFgUPm4qnfB9GlXHagf5T6JgCLRVJEfBDw,1390
|
|
72
72
|
xp/models/actiontable/msactiontable_xp33.py,sha256=vYXJnyqnazUQ_6lkoDnDVh31bo-Mq6-6tQOnYiC766Y,1101
|
|
73
73
|
xp/models/conbus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
-
xp/models/conbus/conbus.py,sha256=
|
|
74
|
+
xp/models/conbus/conbus.py,sha256=ePdihpX2w-A3t-nrvOpWVNwNoS4cDRJ9jpVvhEM_Jwg,1735
|
|
75
75
|
xp/models/conbus/conbus_autoreport.py,sha256=dx9CzlDwDWrLkyvfVsz4dKFouiCl4YcQ80rue97Zfbk,1652
|
|
76
76
|
xp/models/conbus/conbus_blink.py,sha256=xwe8A-C1ywbLKYARRUwUEX0sq6QALQiv1C8R3RyQOSM,2196
|
|
77
77
|
xp/models/conbus/conbus_client_config.py,sha256=HVaGZkhZI6cBpJaEgybq8TFARyrI9-dM6U6IPc2hOKQ,940
|
|
@@ -80,7 +80,7 @@ xp/models/conbus/conbus_custom.py,sha256=hjzL7n5eIWfascyWNA2F6L3W5nnG4JgzAz2wL_c
|
|
|
80
80
|
xp/models/conbus/conbus_datapoint.py,sha256=t41goYkzDf7booC6yBbvlYgX-nH5H0-YE7Yb-JncXJ4,2525
|
|
81
81
|
xp/models/conbus/conbus_discover.py,sha256=lLwWkQYMZXMc0cbjx8oFfippE0aFWjfapgfOBIGkMlc,1087
|
|
82
82
|
xp/models/conbus/conbus_lightlevel.py,sha256=A4DYVejsTa3_SR37oFfG4XNRqjbOKCDbmHg_vA8PqVM,1091
|
|
83
|
-
xp/models/conbus/conbus_linknumber.py,sha256=
|
|
83
|
+
xp/models/conbus/conbus_linknumber.py,sha256=IaA-Lk6o3KQoEvxcYf9cWNpVdjkzOZIQSPVOylzqCWU,1198
|
|
84
84
|
xp/models/conbus/conbus_output.py,sha256=tXAAJqySzbpHJauDEQf8PCYP_hbz31NK5bFs6GUJu_U,1238
|
|
85
85
|
xp/models/conbus/conbus_raw.py,sha256=kP_w9_e-qHv-2cDMm4_nAa1g3G8GFlrxOiYXR5IOq8o,994
|
|
86
86
|
xp/models/conbus/conbus_receive.py,sha256=hVI3CEGQ74UqqLVH8RhlQvOVtmqlcmeI2kWVY1CPPCI,896
|
|
@@ -118,22 +118,22 @@ xp/services/conbus/actiontable/msactiontable_service.py,sha256=89pxbUVlKd6mplpIe
|
|
|
118
118
|
xp/services/conbus/actiontable/msactiontable_xp20_serializer.py,sha256=EYspooOdi0Z8oaXGxpazwnUoTmh-d7U9auhu11iBgmU,6527
|
|
119
119
|
xp/services/conbus/actiontable/msactiontable_xp24_serializer.py,sha256=J_ve6uyMmsb_QT2Py1ciZngf4C0pfHpkbWFc8OL2QEk,3752
|
|
120
120
|
xp/services/conbus/actiontable/msactiontable_xp33_serializer.py,sha256=AeGBbum5eIqlgVm9t4igfF6vyl-ACVpuzSUQm4TYfUQ,7962
|
|
121
|
-
xp/services/conbus/conbus_autoreport_get_service.py,sha256=
|
|
121
|
+
xp/services/conbus/conbus_autoreport_get_service.py,sha256=Jzu8tBIwt9nb9X60LcWnV72wblpVJCZjyfPb45kkCtA,3165
|
|
122
122
|
xp/services/conbus/conbus_autoreport_set_service.py,sha256=0fa2xGVE1GSoBvEcOH8cnjAdhvEoamvHE27t40f7lUk,4937
|
|
123
123
|
xp/services/conbus/conbus_blink_all_service.py,sha256=t_oaztEFRirjS3nL50AEBrKKpNXYssWwSBwWjWhhKqU,5959
|
|
124
124
|
xp/services/conbus/conbus_blink_service.py,sha256=mHaD-84RCmEGqD2cD4Ve85A36D08tMBPwMgDEyAEMCc,5031
|
|
125
|
-
xp/services/conbus/conbus_connection_pool.py,sha256=uiuuZ1S2_BBg6sTWqWIStCPFnWJjsfi2PuD53DalPv8,5616
|
|
126
125
|
xp/services/conbus/conbus_custom_service.py,sha256=jM6B085GTT8epCE9EqVTT8mZLPMXM3tVwvO-yJulJ5s,5290
|
|
127
126
|
xp/services/conbus/conbus_datapoint_queryall_service.py,sha256=FBpFmwXVKoTiqMwQW-z2eYbamKL_ZGlTI86720ZcGt8,6095
|
|
128
|
-
xp/services/conbus/conbus_datapoint_service.py,sha256=
|
|
127
|
+
xp/services/conbus/conbus_datapoint_service.py,sha256=YpInc-Wq4pIjy6ksTWE2mdBSeGWU-VxUNEVyYUi07jM,5577
|
|
129
128
|
xp/services/conbus/conbus_discover_service.py,sha256=kA_ewxXgbqXng0cXBjSgQSGYesyesbN2wK0tMp1fgfc,4281
|
|
130
|
-
xp/services/conbus/
|
|
131
|
-
xp/services/conbus/
|
|
132
|
-
xp/services/conbus/
|
|
129
|
+
xp/services/conbus/conbus_lightlevel_get_service.py,sha256=Z7Pg_c0sI6gMNnoThN7DruEOGyM3-i4D-rO2WKfHXjw,3699
|
|
130
|
+
xp/services/conbus/conbus_lightlevel_set_service.py,sha256=6Mhq9xjWx-ixGVfcWBcJSnuYT256m8Lps1g8Tg-1nkM,7483
|
|
131
|
+
xp/services/conbus/conbus_linknumber_get_service.py,sha256=debaacIbwFLUkXwhG0cJ9Wh31rzmWEmd_o1YC9PvpBY,3195
|
|
132
|
+
xp/services/conbus/conbus_linknumber_set_service.py,sha256=cmCP8zZ8Szb-vwYHvDbZUyEfZJOjO_zSptJUZhHRctQ,6019
|
|
133
|
+
xp/services/conbus/conbus_output_service.py,sha256=w2yBeMdZn3g3wbwUoUnv3gKbqUuGcabeEaH8qw1AyUs,6689
|
|
133
134
|
xp/services/conbus/conbus_raw_service.py,sha256=riANTAiXTdSzOWbp_g-IQjdRhAf8CzZnNJtlT-aDvRs,3746
|
|
134
135
|
xp/services/conbus/conbus_receive_service.py,sha256=k6hzxh-D4piizb3e5Vsz-2Mfft_5KnAXoov4xk9wVY0,3123
|
|
135
|
-
xp/services/conbus/conbus_scan_service.py,sha256=
|
|
136
|
-
xp/services/conbus/conbus_service.py,sha256=MdT01cE_KjAqx6gZOiL0k6z9dPBd-CG19wiKrK8GqB4,10873
|
|
136
|
+
xp/services/conbus/conbus_scan_service.py,sha256=ODKXqD84aSkT6z_B7KHolUx2o5yuLP0gpTCAR-UoHOk,4505
|
|
137
137
|
xp/services/homekit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
138
|
xp/services/homekit/homekit_cache_service.py,sha256=XMZBTz2ZVTq8OZM3h0Fxu738XPlPRdvq6JLaWMbAS4Q,10289
|
|
139
139
|
xp/services/homekit/homekit_conbus_service.py,sha256=71JeM-phBTiGMRr2bEfCiF85eHNIzmxtkCi2Zn0B5uA,2595
|
|
@@ -151,7 +151,7 @@ xp/services/homekit/homekit_service.py,sha256=yksnbcqbrckxWTqtJkaaPh_wd2xYH9yCOt
|
|
|
151
151
|
xp/services/log_file_service.py,sha256=E2CSVbw5W_uk13efILb6OGqeERbxCBWjIsCbHjeps_0,10401
|
|
152
152
|
xp/services/module_type_service.py,sha256=Q3TFZdiknF24OqGAP6Op1F8_SL8aslkHwPh6o_M7wxM,7010
|
|
153
153
|
xp/services/protocol/__init__.py,sha256=XUj54if_nJTfqrEDZfj40nfLr-2xjfKm4CIgHMabp-o,719
|
|
154
|
-
xp/services/protocol/conbus_protocol.py,sha256=
|
|
154
|
+
xp/services/protocol/conbus_protocol.py,sha256=GKmEB4hXAJO4sr3QHfhS_zF-J5BqV3Yi7QNexeSfzLg,7610
|
|
155
155
|
xp/services/protocol/protocol_factory.py,sha256=c3CkMoWAuk9lmHdXIG51B5-S0aIaB7-mHuyULyr_jS4,1248
|
|
156
156
|
xp/services/protocol/telegram_protocol.py,sha256=4mybR5gFreN_Kxw04fujt1gKIvr3Mg6O_6WwoTXe2i8,8568
|
|
157
157
|
xp/services/reverse_proxy_service.py,sha256=OIPm-9y2I-xf1tESZBfgiLd_hgfGQdgrsxAFdhotmJ0,13231
|
|
@@ -174,8 +174,8 @@ xp/services/telegram/telegram_service.py,sha256=Mp20QB50WDp43QBl8TzsR9BKV_hHP53R
|
|
|
174
174
|
xp/services/telegram/telegram_version_service.py,sha256=21v256THg0lidTyUtp2i8r6TAl8J0CTaZo4bZw59nFk,10479
|
|
175
175
|
xp/utils/__init__.py,sha256=clisBctja_VwtkAM9wnbOGDRPfbKHlCUqq4Sa4Z6zng,331
|
|
176
176
|
xp/utils/checksum.py,sha256=HDpiQxmdIedbCbZ4o_Box0i_Zig417BtCV_46ZyhiTk,1711
|
|
177
|
-
xp/utils/dependencies.py,sha256=
|
|
177
|
+
xp/utils/dependencies.py,sha256=PbdI30ug3JCNn1IS9B1jGDEq5wQ_3hDrTLE2Pr-f7AA,19602
|
|
178
178
|
xp/utils/event_helper.py,sha256=W-A_xmoXlpWZBbJH6qdaN50o3-XrwFsDgvAGMJDiAgo,1001
|
|
179
179
|
xp/utils/serialization.py,sha256=hZcrpzaBOe3a2wS_RFCIRs9PvnYsrbK7Ulq6s1rU0q4,4456
|
|
180
180
|
xp/utils/time_utils.py,sha256=Yi3JxHrHsd9ZZxTBRIqlTOz1FYTCeE1IZbefDaXIop8,3800
|
|
181
|
-
conson_xp-0.
|
|
181
|
+
conson_xp-1.0.1.dist-info/RECORD,,
|
xp/__init__.py
CHANGED
xp/cli/commands/__init__.py
CHANGED
|
@@ -38,7 +38,6 @@ from xp.cli.commands.conbus.conbus_datapoint_commands import (
|
|
|
38
38
|
)
|
|
39
39
|
from xp.cli.commands.conbus.conbus_discover_commands import send_discover_telegram
|
|
40
40
|
from xp.cli.commands.conbus.conbus_lightlevel_commands import (
|
|
41
|
-
xp_lightlevel_get,
|
|
42
41
|
xp_lightlevel_off,
|
|
43
42
|
xp_lightlevel_on,
|
|
44
43
|
xp_lightlevel_set,
|
|
@@ -5,9 +5,7 @@ from click import Context
|
|
|
5
5
|
|
|
6
6
|
from xp.cli.commands.conbus.conbus import conbus
|
|
7
7
|
from xp.cli.utils.decorators import handle_service_errors
|
|
8
|
-
from xp.
|
|
9
|
-
from xp.cli.utils.formatters import OutputFormatter
|
|
10
|
-
from xp.services.conbus.conbus_service import ConbusService
|
|
8
|
+
from xp.models import ConbusClientConfig
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
@conbus.command("config")
|
|
@@ -22,12 +20,5 @@ def show_config(ctx: Context) -> None:
|
|
|
22
20
|
\b
|
|
23
21
|
xp conbus config
|
|
24
22
|
"""
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
try:
|
|
29
|
-
config = service.get_config()
|
|
30
|
-
click.echo(json.dumps(config.conbus.model_dump(mode="json"), indent=2))
|
|
31
|
-
|
|
32
|
-
except Exception as e:
|
|
33
|
-
CLIErrorHandler.handle_service_error(e, "configuration retrieval")
|
|
23
|
+
config = ctx.obj.get("container").get_container().resolve(ConbusClientConfig)
|
|
24
|
+
click.echo(json.dumps(config.conbus.model_dump(mode="json"), indent=2))
|
|
@@ -10,9 +10,10 @@ from xp.cli.utils.decorators import (
|
|
|
10
10
|
handle_service_errors,
|
|
11
11
|
)
|
|
12
12
|
from xp.cli.utils.serial_number_type import SERIAL
|
|
13
|
-
from xp.
|
|
13
|
+
from xp.models.conbus.conbus_lightlevel import ConbusLightlevelResponse
|
|
14
|
+
from xp.services.conbus.conbus_lightlevel_set_service import (
|
|
14
15
|
ConbusLightlevelError,
|
|
15
|
-
|
|
16
|
+
ConbusLightlevelSetService,
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
|
|
@@ -34,12 +35,17 @@ def xp_lightlevel_set(
|
|
|
34
35
|
xp conbus lightlevel set 0123450001 2 50 # Set output 2 to 50%
|
|
35
36
|
xp conbus lightlevel set 0011223344 0 100 # Set output 0 to 100%
|
|
36
37
|
"""
|
|
37
|
-
service = ctx.obj.get("container").get_container().resolve(ConbusLightlevelService)
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
response = service.set_lightlevel(serial_number, output_number, level)
|
|
39
|
+
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
41
40
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
42
41
|
|
|
42
|
+
service = (
|
|
43
|
+
ctx.obj.get("container").get_container().resolve(ConbusLightlevelSetService)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
with service:
|
|
47
|
+
service.set_lightlevel(serial_number, output_number, level, finish, 0.5)
|
|
48
|
+
|
|
43
49
|
|
|
44
50
|
@conbus_lightlevel.command("off")
|
|
45
51
|
@click.argument("serial_number", type=SERIAL)
|
|
@@ -58,12 +64,17 @@ def xp_lightlevel_off(
|
|
|
58
64
|
xp conbus lightlevel off 0123450001 2 # Turn off output 2
|
|
59
65
|
xp conbus lightlevel off 0011223344 0 # Turn off output 0
|
|
60
66
|
"""
|
|
61
|
-
service = ctx.obj.get("container").get_container().resolve(ConbusLightlevelService)
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
response = service.turn_off(serial_number, output_number)
|
|
68
|
+
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
65
69
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
66
70
|
|
|
71
|
+
service = (
|
|
72
|
+
ctx.obj.get("container").get_container().resolve(ConbusLightlevelSetService)
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
with service:
|
|
76
|
+
service.turn_off(serial_number, output_number, finish, 0.5)
|
|
77
|
+
|
|
67
78
|
|
|
68
79
|
@conbus_lightlevel.command("on")
|
|
69
80
|
@click.argument("serial_number", type=SERIAL)
|
|
@@ -82,12 +93,17 @@ def xp_lightlevel_on(
|
|
|
82
93
|
xp conbus lightlevel on 0123450001 2 # Turn on output 2 (80%)
|
|
83
94
|
xp conbus lightlevel on 0011223344 0 # Turn on output 0 (80%)
|
|
84
95
|
"""
|
|
85
|
-
service = ctx.obj.get("container").get_container().resolve(ConbusLightlevelService)
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
response = service.turn_on(serial_number, output_number)
|
|
97
|
+
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
89
98
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
90
99
|
|
|
100
|
+
service = (
|
|
101
|
+
ctx.obj.get("container").get_container().resolve(ConbusLightlevelSetService)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
with service:
|
|
105
|
+
service.turn_on(serial_number, output_number, finish, 0.5)
|
|
106
|
+
|
|
91
107
|
|
|
92
108
|
@conbus_lightlevel.command("get")
|
|
93
109
|
@click.argument("serial_number", type=SERIAL)
|
|
@@ -99,15 +115,18 @@ def xp_lightlevel_get(
|
|
|
99
115
|
ctx: click.Context, serial_number: str, output_number: int
|
|
100
116
|
) -> None:
|
|
101
117
|
"""Get current light level for output_number on XP module serial_number
|
|
102
|
-
|
|
103
118
|
Examples:
|
|
104
|
-
|
|
105
119
|
\b
|
|
106
120
|
xp conbus lightlevel get 0123450001 2 # Get light level for output 2
|
|
107
121
|
xp conbus lightlevel get 0011223344 0 # Get light level for output 0
|
|
108
122
|
"""
|
|
109
|
-
service = ctx.obj.get("container").get_container().resolve(ConbusLightlevelService)
|
|
110
123
|
|
|
111
|
-
|
|
112
|
-
response = service.get_lightlevel(serial_number, output_number)
|
|
124
|
+
def finish(response: "ConbusLightlevelResponse") -> None:
|
|
113
125
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
126
|
+
|
|
127
|
+
service = (
|
|
128
|
+
ctx.obj.get("container").get_container().resolve(ConbusLightlevelSetService)
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
with service:
|
|
132
|
+
service.get_lightlevel(serial_number, output_number, finish, 0.5)
|
|
@@ -7,11 +7,11 @@ import click
|
|
|
7
7
|
from xp.cli.commands.conbus.conbus import conbus_linknumber
|
|
8
8
|
from xp.cli.utils.decorators import (
|
|
9
9
|
connection_command,
|
|
10
|
-
handle_service_errors,
|
|
11
10
|
)
|
|
12
11
|
from xp.cli.utils.serial_number_type import SERIAL
|
|
13
|
-
from xp.
|
|
14
|
-
from xp.services.
|
|
12
|
+
from xp.models.conbus.conbus_linknumber import ConbusLinknumberResponse
|
|
13
|
+
from xp.services.conbus.conbus_linknumber_get_service import ConbusLinknumberGetService
|
|
14
|
+
from xp.services.conbus.conbus_linknumber_set_service import ConbusLinknumberSetService
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
@conbus_linknumber.command("set", short_help="Set link number for a module")
|
|
@@ -19,7 +19,6 @@ from xp.services.telegram.telegram_link_number_service import LinkNumberError
|
|
|
19
19
|
@click.argument("link_number", type=click.IntRange(0, 99))
|
|
20
20
|
@click.pass_context
|
|
21
21
|
@connection_command()
|
|
22
|
-
@handle_service_errors(LinkNumberError)
|
|
23
22
|
def set_linknumber_command(
|
|
24
23
|
ctx: click.Context, serial_number: str, link_number: int
|
|
25
24
|
) -> None:
|
|
@@ -34,18 +33,25 @@ def set_linknumber_command(
|
|
|
34
33
|
\b
|
|
35
34
|
xp conbus linknumber set 0123450001 25
|
|
36
35
|
"""
|
|
37
|
-
service =
|
|
36
|
+
service = (
|
|
37
|
+
ctx.obj.get("container").get_container().resolve(ConbusLinknumberSetService)
|
|
38
|
+
)
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
response = service.set_linknumber(serial_number, link_number)
|
|
40
|
+
def on_finish(response: ConbusLinknumberResponse) -> None:
|
|
41
41
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
42
42
|
|
|
43
|
+
with service:
|
|
44
|
+
service.set_linknumber(
|
|
45
|
+
serial_number=serial_number,
|
|
46
|
+
link_number=link_number,
|
|
47
|
+
finish_callback=on_finish,
|
|
48
|
+
)
|
|
49
|
+
|
|
43
50
|
|
|
44
51
|
@conbus_linknumber.command("get", short_help="Get link number for a module")
|
|
45
52
|
@click.argument("serial_number", type=SERIAL)
|
|
46
53
|
@click.pass_context
|
|
47
54
|
@connection_command()
|
|
48
|
-
@handle_service_errors(LinkNumberError)
|
|
49
55
|
def get_linknumber_command(ctx: click.Context, serial_number: str) -> None:
|
|
50
56
|
"""
|
|
51
57
|
Get the current link number for a specific module.
|
|
@@ -57,8 +63,15 @@ def get_linknumber_command(ctx: click.Context, serial_number: str) -> None:
|
|
|
57
63
|
\b
|
|
58
64
|
xp conbus linknumber get 0123450001
|
|
59
65
|
"""
|
|
60
|
-
service =
|
|
66
|
+
service = (
|
|
67
|
+
ctx.obj.get("container").get_container().resolve(ConbusLinknumberGetService)
|
|
68
|
+
)
|
|
61
69
|
|
|
62
|
-
|
|
63
|
-
response = service.get_linknumber(serial_number)
|
|
70
|
+
def on_finish(response: ConbusLinknumberResponse) -> None:
|
|
64
71
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
72
|
+
|
|
73
|
+
with service:
|
|
74
|
+
service.get_linknumber(
|
|
75
|
+
serial_number=serial_number,
|
|
76
|
+
finish_callback=on_finish,
|
|
77
|
+
)
|
|
@@ -9,7 +9,11 @@ from xp.cli.utils.decorators import (
|
|
|
9
9
|
connection_command,
|
|
10
10
|
)
|
|
11
11
|
from xp.cli.utils.serial_number_type import SERIAL
|
|
12
|
+
from xp.models import ConbusDatapointResponse
|
|
13
|
+
from xp.models.conbus.conbus_output import ConbusOutputResponse
|
|
12
14
|
from xp.models.telegram.action_type import ActionType
|
|
15
|
+
from xp.models.telegram.datapoint_type import DataPointType
|
|
16
|
+
from xp.services.conbus.conbus_datapoint_service import ConbusDatapointService
|
|
13
17
|
from xp.services.conbus.conbus_output_service import ConbusOutputService
|
|
14
18
|
|
|
15
19
|
|
|
@@ -24,16 +28,20 @@ def xp_output_on(ctx: click.Context, serial_number: str, output_number: int) ->
|
|
|
24
28
|
Examples:
|
|
25
29
|
|
|
26
30
|
\b
|
|
27
|
-
xp conbus
|
|
31
|
+
xp conbus output on 0011223344 0 # Turn on output 0
|
|
28
32
|
"""
|
|
29
33
|
service = ctx.obj.get("container").get_container().resolve(ConbusOutputService)
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
def on_finish(response: ConbusOutputResponse) -> None:
|
|
36
|
+
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
with service:
|
|
39
|
+
service.send_action(
|
|
40
|
+
serial_number=serial_number,
|
|
41
|
+
output_number=output_number,
|
|
42
|
+
action_type=ActionType.ON_RELEASE,
|
|
43
|
+
finish_callback=on_finish,
|
|
35
44
|
)
|
|
36
|
-
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
37
45
|
|
|
38
46
|
|
|
39
47
|
@conbus_output.command("off")
|
|
@@ -47,16 +55,20 @@ def xp_output_off(ctx: click.Context, serial_number: str, output_number: int) ->
|
|
|
47
55
|
Examples:
|
|
48
56
|
|
|
49
57
|
\b
|
|
50
|
-
xp conbus
|
|
58
|
+
xp conbus output off 0011223344 1 # Turn off output 1
|
|
51
59
|
"""
|
|
52
60
|
service = ctx.obj.get("container").get_container().resolve(ConbusOutputService)
|
|
53
61
|
|
|
54
|
-
|
|
62
|
+
def on_finish(response: ConbusOutputResponse) -> None:
|
|
63
|
+
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
55
64
|
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
with service:
|
|
66
|
+
service.send_action(
|
|
67
|
+
serial_number=serial_number,
|
|
68
|
+
output_number=output_number,
|
|
69
|
+
action_type=ActionType.OFF_PRESS,
|
|
70
|
+
finish_callback=on_finish,
|
|
58
71
|
)
|
|
59
|
-
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
60
72
|
|
|
61
73
|
|
|
62
74
|
@conbus_output.command("status")
|
|
@@ -71,13 +83,20 @@ def xp_output_status(ctx: click.Context, serial_number: str) -> None:
|
|
|
71
83
|
\b
|
|
72
84
|
xp conbus output status 0011223344 # Query output status
|
|
73
85
|
"""
|
|
74
|
-
service =
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
service: ConbusDatapointService = (
|
|
87
|
+
ctx.obj.get("container").get_container().resolve(ConbusDatapointService)
|
|
88
|
+
)
|
|
77
89
|
|
|
78
|
-
|
|
90
|
+
def on_finish(response: ConbusDatapointResponse) -> None:
|
|
79
91
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
80
92
|
|
|
93
|
+
with service:
|
|
94
|
+
service.query_datapoint(
|
|
95
|
+
serial_number=serial_number,
|
|
96
|
+
datapoint_type=DataPointType.MODULE_OUTPUT_STATE,
|
|
97
|
+
finish_callback=on_finish,
|
|
98
|
+
)
|
|
99
|
+
|
|
81
100
|
|
|
82
101
|
@conbus_output.command("state")
|
|
83
102
|
@click.argument("serial_number", type=SERIAL)
|
|
@@ -91,9 +110,16 @@ def xp_module_state(ctx: click.Context, serial_number: str) -> None:
|
|
|
91
110
|
\b
|
|
92
111
|
xp conbus output state 0011223344 # Query module state
|
|
93
112
|
"""
|
|
94
|
-
service =
|
|
113
|
+
service: ConbusDatapointService = (
|
|
114
|
+
ctx.obj.get("container").get_container().resolve(ConbusDatapointService)
|
|
115
|
+
)
|
|
95
116
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
response = service.get_module_state(serial_number)
|
|
117
|
+
def on_finish(response: ConbusDatapointResponse) -> None:
|
|
99
118
|
click.echo(json.dumps(response.to_dict(), indent=2))
|
|
119
|
+
|
|
120
|
+
with service:
|
|
121
|
+
service.query_datapoint(
|
|
122
|
+
serial_number=serial_number,
|
|
123
|
+
datapoint_type=DataPointType.MODULE_STATE,
|
|
124
|
+
finish_callback=on_finish,
|
|
125
|
+
)
|
xp/models/conbus/conbus.py
CHANGED
|
@@ -32,24 +32,25 @@ class ConbusResponse:
|
|
|
32
32
|
"""Represents a response from Conbus send operation"""
|
|
33
33
|
|
|
34
34
|
success: bool
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
error:
|
|
39
|
-
|
|
35
|
+
sent_telegrams: list[str]
|
|
36
|
+
received_telegrams: list[str]
|
|
37
|
+
timestamp: datetime
|
|
38
|
+
error: str = ""
|
|
39
|
+
serial_number: str = ""
|
|
40
|
+
function_code: str = ""
|
|
40
41
|
|
|
41
42
|
def __post_init__(self) -> None:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
self.received_telegrams = []
|
|
43
|
+
self.timestamp = datetime.now()
|
|
44
|
+
self.sent_telegrams = []
|
|
45
|
+
self.received_telegrams = []
|
|
46
46
|
|
|
47
47
|
def to_dict(self) -> Dict[str, Any]:
|
|
48
48
|
"""Convert to dictionary for JSON serialization"""
|
|
49
49
|
return {
|
|
50
50
|
"success": self.success,
|
|
51
|
-
"
|
|
52
|
-
"
|
|
51
|
+
"serial_number": self.serial_number,
|
|
52
|
+
"function_code": self.function_code,
|
|
53
|
+
"sent_telegrams": self.sent_telegrams,
|
|
53
54
|
"received_telegrams": self.received_telegrams,
|
|
54
55
|
"error": self.error,
|
|
55
56
|
"timestamp": self.timestamp.isoformat() if self.timestamp else None,
|
|
@@ -8,8 +8,8 @@ class ConbusLinknumberResponse:
|
|
|
8
8
|
"""Represents a response from Conbus link number operations (set/get)"""
|
|
9
9
|
|
|
10
10
|
success: bool
|
|
11
|
-
result: str
|
|
12
11
|
serial_number: str
|
|
12
|
+
result: str
|
|
13
13
|
sent_telegram: Optional[str] = None
|
|
14
14
|
received_telegrams: Optional[list] = None
|
|
15
15
|
link_number: Optional[int] = None
|
|
@@ -4,22 +4,18 @@ This service handles auto report status operations for modules through Conbus te
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
|
-
from datetime import datetime
|
|
8
7
|
from typing import Callable, Optional
|
|
9
8
|
|
|
10
9
|
from twisted.internet.posixbase import PosixReactorBase
|
|
11
10
|
|
|
12
|
-
from xp.models import ConbusClientConfig
|
|
11
|
+
from xp.models import ConbusClientConfig, ConbusDatapointResponse
|
|
13
12
|
from xp.models.conbus.conbus_autoreport import ConbusAutoreportResponse
|
|
14
|
-
from xp.models.protocol.conbus_protocol import TelegramReceivedEvent
|
|
15
13
|
from xp.models.telegram.datapoint_type import DataPointType
|
|
16
|
-
from xp.
|
|
17
|
-
from xp.models.telegram.telegram_type import TelegramType
|
|
18
|
-
from xp.services.protocol import ConbusProtocol
|
|
14
|
+
from xp.services.conbus.conbus_datapoint_service import ConbusDatapointService
|
|
19
15
|
from xp.services.telegram.telegram_service import TelegramService
|
|
20
16
|
|
|
21
17
|
|
|
22
|
-
class ConbusAutoreportGetService(
|
|
18
|
+
class ConbusAutoreportGetService(ConbusDatapointService):
|
|
23
19
|
"""
|
|
24
20
|
Service for receiving telegrams from Conbus servers.
|
|
25
21
|
|
|
@@ -34,71 +30,35 @@ class ConbusAutoreportGetService(ConbusProtocol):
|
|
|
34
30
|
reactor: PosixReactorBase,
|
|
35
31
|
) -> None:
|
|
36
32
|
"""Initialize the Conbus client send service"""
|
|
37
|
-
super().__init__(cli_config, reactor)
|
|
38
|
-
self.
|
|
39
|
-
self.serial_number: str = ""
|
|
40
|
-
self.finish_callback: Optional[Callable[[ConbusAutoreportResponse], None]] = (
|
|
33
|
+
super().__init__(telegram_service, cli_config, reactor)
|
|
34
|
+
self.service_callback: Optional[Callable[[ConbusAutoreportResponse], None]] = (
|
|
41
35
|
None
|
|
42
36
|
)
|
|
43
|
-
self.service_response: ConbusAutoreportResponse = ConbusAutoreportResponse(
|
|
44
|
-
success=False,
|
|
45
|
-
serial_number=self.serial_number,
|
|
46
|
-
)
|
|
47
37
|
|
|
48
38
|
# Set up logging
|
|
49
39
|
self.logger = logging.getLogger(__name__)
|
|
50
40
|
|
|
51
|
-
def
|
|
52
|
-
self
|
|
53
|
-
|
|
54
|
-
telegram_type=TelegramType.SYSTEM,
|
|
55
|
-
serial_number=self.serial_number,
|
|
56
|
-
system_function=SystemFunction.READ_DATAPOINT,
|
|
57
|
-
data_value=str(DataPointType.AUTO_REPORT_STATUS.value),
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
def telegram_sent(self, telegram_sent: str) -> None:
|
|
61
|
-
self.service_response.sent_telegram = telegram_sent
|
|
62
|
-
|
|
63
|
-
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
64
|
-
|
|
65
|
-
self.logger.debug(f"Telegram received: {telegram_received}")
|
|
66
|
-
if not self.service_response.received_telegrams:
|
|
67
|
-
self.service_response.received_telegrams = []
|
|
68
|
-
self.service_response.received_telegrams.append(telegram_received.frame)
|
|
41
|
+
def finish_service_callback(
|
|
42
|
+
self, datapoint_response: ConbusDatapointResponse
|
|
43
|
+
) -> None:
|
|
69
44
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
):
|
|
75
|
-
self.logger.debug("Not a reply")
|
|
76
|
-
return
|
|
45
|
+
self.logger.debug("Parsing datapoint response")
|
|
46
|
+
autoreport_status = ""
|
|
47
|
+
if datapoint_response.success and datapoint_response.datapoint_telegram:
|
|
48
|
+
autoreport_status = datapoint_response.datapoint_telegram.data_value
|
|
77
49
|
|
|
78
|
-
|
|
79
|
-
|
|
50
|
+
service_response = ConbusAutoreportResponse(
|
|
51
|
+
success=datapoint_response.success,
|
|
52
|
+
serial_number=self.serial_number,
|
|
53
|
+
auto_report_status=autoreport_status,
|
|
54
|
+
error=datapoint_response.error,
|
|
55
|
+
sent_telegram=datapoint_response.sent_telegram,
|
|
56
|
+
received_telegrams=datapoint_response.received_telegrams,
|
|
57
|
+
timestamp=datapoint_response.timestamp,
|
|
80
58
|
)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
and reply_telegram.datapoint_type == DataPointType.AUTO_REPORT_STATUS
|
|
85
|
-
):
|
|
86
|
-
self.logger.debug("Received autoreport status telegram")
|
|
87
|
-
self.service_response.success = True
|
|
88
|
-
self.service_response.timestamp = datetime.now()
|
|
89
|
-
self.service_response.serial_number = self.serial_number
|
|
90
|
-
self.service_response.auto_report_status = reply_telegram.data_value
|
|
91
|
-
|
|
92
|
-
if self.finish_callback:
|
|
93
|
-
self.finish_callback(self.service_response)
|
|
94
|
-
|
|
95
|
-
def failed(self, message: str) -> None:
|
|
96
|
-
self.logger.debug(f"Failed with message: {message}")
|
|
97
|
-
self.service_response.success = False
|
|
98
|
-
self.service_response.timestamp = datetime.now()
|
|
99
|
-
self.service_response.error = message
|
|
100
|
-
if self.finish_callback:
|
|
101
|
-
self.finish_callback(self.service_response)
|
|
59
|
+
|
|
60
|
+
if self.service_callback:
|
|
61
|
+
self.service_callback(service_response)
|
|
102
62
|
|
|
103
63
|
def get_autoreport_status(
|
|
104
64
|
self,
|
|
@@ -110,20 +70,16 @@ class ConbusAutoreportGetService(ConbusProtocol):
|
|
|
110
70
|
Get the current auto report status for a specific module.
|
|
111
71
|
|
|
112
72
|
Args:
|
|
113
|
-
serial_number: 10-digit module serial number
|
|
114
|
-
finish_callback: callback function to call when the
|
|
115
|
-
timeout_seconds: timeout in seconds
|
|
116
|
-
|
|
117
|
-
Returns:
|
|
118
|
-
ConbusAutoreportResponse with operation result and auto report status
|
|
73
|
+
:param serial_number: 10-digit module serial number
|
|
74
|
+
:param finish_callback: callback function to call when the linknumber status is
|
|
75
|
+
:param timeout_seconds: timeout in seconds
|
|
119
76
|
|
|
120
|
-
Raises:
|
|
121
|
-
ConbusAutoreportError: If the operation fails
|
|
122
77
|
"""
|
|
123
|
-
|
|
124
78
|
self.logger.info("Starting get_autoreport_status")
|
|
125
79
|
if timeout_seconds:
|
|
126
80
|
self.timeout_seconds = timeout_seconds
|
|
127
|
-
self.finish_callback = finish_callback
|
|
128
81
|
self.serial_number = serial_number
|
|
82
|
+
self.datapoint_type = DataPointType.AUTO_REPORT_STATUS
|
|
83
|
+
self.finish_callback = self.finish_service_callback
|
|
84
|
+
self.service_callback = finish_callback
|
|
129
85
|
self.start_reactor()
|