conson-xp 1.11.0__py3-none-any.whl → 1.15.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: conson-xp
3
- Version: 1.11.0
3
+ Version: 1.15.0
4
4
  Summary: XP Protocol Communication Tools
5
5
  Author-Email: ldvchosal <ldvchosal@github.com>
6
6
  License: MIT License
@@ -316,6 +316,11 @@ xp conbus linknumber get
316
316
  xp conbus linknumber set
317
317
 
318
318
 
319
+ xp conbus modulenumber
320
+ xp conbus modulenumber get
321
+ xp conbus modulenumber set
322
+
323
+
319
324
  xp conbus msactiontable
320
325
  xp conbus msactiontable download
321
326
 
@@ -1,13 +1,13 @@
1
- conson_xp-1.11.0.dist-info/METADATA,sha256=fGKwcGHNxOkx1fqKtt_yiGvb2qdCzbv3mABmqZVQvZ0,9358
2
- conson_xp-1.11.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- conson_xp-1.11.0.dist-info/entry_points.txt,sha256=1OcdIcDM1hz3ljCXgybaPUh1IOFEwkaTgLIW9u9zGeg,50
4
- conson_xp-1.11.0.dist-info/licenses/LICENSE,sha256=rxj6woMM-r3YCyGq_UHFtbh7kHTAJgrccH6O-33IDE4,1419
5
- xp/__init__.py,sha256=XSIJ1JlixN5N_iTzjciH-3DCu1QnEoPIUXf79udFESc,181
1
+ conson_xp-1.15.0.dist-info/METADATA,sha256=1uDwWEJsmWvUk8RjzbLoPj0WrlRujgplsRRb5NHEJdU,9437
2
+ conson_xp-1.15.0.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ conson_xp-1.15.0.dist-info/entry_points.txt,sha256=1OcdIcDM1hz3ljCXgybaPUh1IOFEwkaTgLIW9u9zGeg,50
4
+ conson_xp-1.15.0.dist-info/licenses/LICENSE,sha256=rxj6woMM-r3YCyGq_UHFtbh7kHTAJgrccH6O-33IDE4,1419
5
+ xp/__init__.py,sha256=cQLZ0V5wACMFH4b8H0g8gWRKytLc5RdIi_JA8HVho6Q,181
6
6
  xp/cli/__init__.py,sha256=QjnKB1KaI2aIyKlzrnvCwfbBuUj8HNgwNMvNJVQofbI,81
7
7
  xp/cli/__main__.py,sha256=l2iKwMdat5rTGd3JWs-uGksnYYDDffp_Npz05QdKEeU,117
8
- xp/cli/commands/__init__.py,sha256=02CbZoKmNX-fn5etX4Hdgg2lUt1MsLFPYx2VkXZyFJ8,4394
8
+ xp/cli/commands/__init__.py,sha256=EGDWTEH_pCKIMWelnjhK4_PxBsvIH24rO9fz1nF1pKA,4638
9
9
  xp/cli/commands/conbus/__init__.py,sha256=gE3K5OEoXkkZX8UOc2v3nreQQzwkOQi7n0VZ-Z2juXA,495
10
- xp/cli/commands/conbus/conbus.py,sha256=OTebWu-V-_1tOq2nWExPLtDuAeqy7fB7ltUqzHfgcY8,2705
10
+ xp/cli/commands/conbus/conbus.py,sha256=eqdY8ArapvD08Z4p7Xk7eh4z0dESHuMSw7PKtwTJRYU,3021
11
11
  xp/cli/commands/conbus/conbus_actiontable_commands.py,sha256=cdjLV9cnm7teEOlu5Jf1MS_aL7lNy8KiDIyjCQa5Nzw,7138
12
12
  xp/cli/commands/conbus/conbus_autoreport_commands.py,sha256=oZgyUUFNsb4yf2WO81l2w1PrasNwdC__QwxNkJ2jCaU,3794
13
13
  xp/cli/commands/conbus/conbus_blink_commands.py,sha256=UK-Ey4K0FvaPQ96U0gyMid236RlBmUhPNRes9y0SlkM,4848
@@ -16,7 +16,8 @@ xp/cli/commands/conbus/conbus_custom_commands.py,sha256=lICT93ijMdhVRm8KjNMLo7kQ
16
16
  xp/cli/commands/conbus/conbus_datapoint_commands.py,sha256=r36OuTjREtbGKL-bskAGa0-WLw7x06td6woZn3GYJNA,3630
17
17
  xp/cli/commands/conbus/conbus_discover_commands.py,sha256=Jt-OjARc-QXCr453bhKG0zXRqvOMVKZr328zNxSDulY,1373
18
18
  xp/cli/commands/conbus/conbus_lightlevel_commands.py,sha256=FpCwogdxa7yFUjlrxM7e8Q2Ut32tKAHabngQQChvtJI,6763
19
- xp/cli/commands/conbus/conbus_linknumber_commands.py,sha256=pn491Iy_LcwZ5XLtvNTWu8qG_Vdaaxr7le1tTuVK7Qw,3392
19
+ xp/cli/commands/conbus/conbus_linknumber_commands.py,sha256=KitaGDM5HpwVUz8rLpO8VZUypUTcAg3Bzl0DVm6gnSk,3391
20
+ xp/cli/commands/conbus/conbus_modulenumber_commands.py,sha256=L7-6y3rDllOjQ9g6Bk_RiTKIhAOHVPLdxWif9exkngs,3463
20
21
  xp/cli/commands/conbus/conbus_msactiontable_commands.py,sha256=fb9MQ4O04H0Dinpt7vSF5GtfntTZHelQ5TuUmSBbCTg,2899
21
22
  xp/cli/commands/conbus/conbus_output_commands.py,sha256=zdRVbHzVhMbZpG2x5WXtujc3wKTsoQUV4IgkVIbJbCc,5019
22
23
  xp/cli/commands/conbus/conbus_raw_commands.py,sha256=8BKUarwvHgz-sxML7n99YVsb8B1HJNExjQpRsuY_tQw,1829
@@ -73,11 +74,11 @@ xp/models/conbus/conbus_receive.py,sha256=-1u1qK-texfKCNZV-GYf_9KyLtJdIrx7HuZsKz
73
74
  xp/models/conbus/conbus_writeconfig.py,sha256=z8fdJeFLyGJW7UMHcHxGrHIMS6gG1D3aXeYUkBuwnEg,2136
74
75
  xp/models/homekit/__init__.py,sha256=5HDSOClCu0ArK3IICn3_LDMMLBAzLjBxUUSF73bxSSk,34
75
76
  xp/models/homekit/homekit_accessory.py,sha256=NsHFhskuxIdJpF9-MvXHtjkLYvNHmSGFOy0GmQv3PY4,1038
76
- xp/models/homekit/homekit_config.py,sha256=Y1WwrbISRtJOkKVBnXQULb3vAOzcOdt95hBAI8cM_MU,2771
77
+ xp/models/homekit/homekit_config.py,sha256=Y_k92PsKHFBnn3r1_RSZHJP5uLH27Gw8G7Bj5N8jvUE,2904
77
78
  xp/models/homekit/homekit_conson_config.py,sha256=NML644Ij7abstMbud-TUPcxraGY4vQwKrkJOwftv2pM,2603
78
79
  xp/models/log_entry.py,sha256=kPcYuAirCXugfL3YkOK9cQVlkNWxG_8a4AVuhsykHL0,4355
79
80
  xp/models/protocol/__init__.py,sha256=TJ_CJKchA-xgQiv5vCo_ndBBZjrcaTmjT74bR0T-5Cw,38
80
- xp/models/protocol/conbus_protocol.py,sha256=tSnI5pxBTP_f1DUzEM3XbyjK7vsqwm0gpzHIH1gTg8E,8854
81
+ xp/models/protocol/conbus_protocol.py,sha256=igRgnbfjhnmNZG6kqQw4un433EpKTMXR13MJW151_7U,9041
81
82
  xp/models/response.py,sha256=h6_B1k_v6IrWhgNWBohEGQGRCp5TcVhgQ3RJS8gTkhY,1230
82
83
  xp/models/telegram/__init__.py,sha256=-_exhjlRLbBNuPxHC4tLA2SAgf8M0yHJMeyEoQIk9PI,53
83
84
  xp/models/telegram/action_type.py,sha256=vkw_chTgmsadksGXvZ9D_qYGpjOwCw-OgbEi8Bml17g,783
@@ -120,20 +121,20 @@ xp/services/conbus/conbus_output_service.py,sha256=mHFOAPx2zo0TStZ3pokp6v94AQjIa
120
121
  xp/services/conbus/conbus_raw_service.py,sha256=4yZLLTIAOxpgByUTWZXw1ihGa6Xtl98ckj9T7VfprDI,4335
121
122
  xp/services/conbus/conbus_receive_service.py,sha256=frXrS0OyKKvYYQTWdma21Kd0BKw5aSuHn3ZXTTqOaj0,3953
122
123
  xp/services/conbus/conbus_scan_service.py,sha256=tHJ5qaxcNXxAZb2D2F1v6IrzydfxjJOYllM6Txt1eBE,5176
123
- xp/services/conbus/write_config_service.py,sha256=qe5TwQdVnMCcJ4lCeZLADdUeoDpbEaV3XoZ19a3F_qk,7128
124
+ xp/services/conbus/write_config_service.py,sha256=6feNdixI_Nli4MRLe15nea-7gTEXMUwZIvTqv_1OqHI,7157
124
125
  xp/services/homekit/__init__.py,sha256=xAMKmln_AmEFdOOJGKWYi96seRlKDQpKx3-hm7XbdIo,36
125
126
  xp/services/homekit/homekit_cache_service.py,sha256=NdijyH5_iyhsTHBb-OyT8Y2xnNDj8F5MP8neoVQ26hY,11010
126
- xp/services/homekit/homekit_conbus_service.py,sha256=EYhYqGISPxUB6QrMDLWRPOA4S8f9AgJf0D_BKqXlGLA,3482
127
+ xp/services/homekit/homekit_conbus_service.py,sha256=porvo4nZ4PE0R6bdaKwClDW2kevkW_8DOzw4NOO6DZQ,3348
127
128
  xp/services/homekit/homekit_config_validator.py,sha256=1jCUrfMUqthEoNc7wAk4io1PpbptqgsdnCOCzz62Io8,10732
128
129
  xp/services/homekit/homekit_conson_validator.py,sha256=V_Otxu0q3LK-3GP3-Zw0nZyV_rb9RjHp4tWcvzYJeGs,3787
129
130
  xp/services/homekit/homekit_dimminglight.py,sha256=O5SwnhkrJQHm7BopI9nL9QcfRSokcxn-H4csZMg0B5c,5770
130
131
  xp/services/homekit/homekit_dimminglight_service.py,sha256=lxFE2k8a8V9YQwpWPAAmbUvYD3zDlVa337xzDQl6tjM,5231
131
132
  xp/services/homekit/homekit_hap_service.py,sha256=YrFe10XPBf6EC2SRnWmcCbjdVkrHjxSNPwYDPVvQiDQ,12527
132
133
  xp/services/homekit/homekit_lightbulb.py,sha256=7HGMIPwEcmvSs89ENcDhdb8g0R9WMq7115gYuwcskAs,3661
133
- xp/services/homekit/homekit_lightbulb_service.py,sha256=pyRyxrNQqTW79rmGagItNpz7AMXTbBQL_l1o5VXTRn8,2652
134
+ xp/services/homekit/homekit_lightbulb_service.py,sha256=G_ummBFiBurhQ2ZVwJ9l_aZ2MQgl5Uq-oi3KjIrdb-Y,2752
134
135
  xp/services/homekit/homekit_module_service.py,sha256=7lanEinxAfTdn28ZHV-O5YyTqq_3v8FIyP2FI0jsEQM,1526
135
136
  xp/services/homekit/homekit_outlet.py,sha256=_Glfytfmvydz9TEn69N6bw3Ux0Y-EMw2eJPgeborkoA,5268
136
- xp/services/homekit/homekit_outlet_service.py,sha256=mDvSv9_69Z6jGUBHixmBm7giDCVYtLOWtMZqYjBgUdE,3698
137
+ xp/services/homekit/homekit_outlet_service.py,sha256=y7DbWbbvihWwF1Gyl0l9Hup1JHin6PTlDEHdoIqTfEQ,3798
137
138
  xp/services/homekit/homekit_service.py,sha256=0lW-hg40ETco3gDBEYkR_sX-UIYsLSKCD4NWruLXUM8,14031
138
139
  xp/services/log_file_service.py,sha256=fvPcZQj8XOKUA-4ep5R8n0PelvwvRlTLlVxvIWM5KR4,10506
139
140
  xp/services/module_type_service.py,sha256=xWhr1EAZMykL5uNWHWdpa5T8yNruGKH43XRTOS8GwZg,7477
@@ -155,7 +156,7 @@ xp/services/server/xp33_server_service.py,sha256=X5BJr7RYueHAPNrfW-HnqV7ZN-OAouK
155
156
  xp/services/telegram/__init__.py,sha256=kv0JgMg13Fp18WgGQpalNRAWwiWbrz18X4kZAP9xpSQ,48
156
157
  xp/services/telegram/telegram_blink_service.py,sha256=Xctc9mCSZiiW1YTh8cA-4jlc8fTioS5OxT6ymhSqiYI,4487
157
158
  xp/services/telegram/telegram_checksum_service.py,sha256=rp_C5PlraOOIyqZDp9XjBBNZLUeBLdQNNHVpN6D-1v8,4729
158
- xp/services/telegram/telegram_datapoint_service.py,sha256=A3ERuFSWc22uJUoymH-2dWkt2_AfUvJcLQ1iy8ZbO0s,2399
159
+ xp/services/telegram/telegram_datapoint_service.py,sha256=iZ-zp_EM_1ouyeTbd2erhIY2x-98nEHveWWN_a9NfFU,2750
159
160
  xp/services/telegram/telegram_discover_service.py,sha256=oTpiq-yzP_UmC0xVOMMFeHO-rIlK1pF3aG-Kq4SeiBI,9025
160
161
  xp/services/telegram/telegram_link_number_service.py,sha256=1_c-_QCRPTHYn3BmMElrBJqGG6vnoIst8CB-N42hazk,6862
161
162
  xp/services/telegram/telegram_output_service.py,sha256=UaUv_14fR8o5K2PxQBXrCzx-Hohnk-gzbev_oLw_Clc,10799
@@ -163,8 +164,8 @@ xp/services/telegram/telegram_service.py,sha256=XrP1CPi0ckxoKBaNwLA6lo-TogWxXgmX
163
164
  xp/services/telegram/telegram_version_service.py,sha256=M5HdOTsLdcwo122FP-jW6R740ktLrtKf2TiMDVz23h8,10528
164
165
  xp/utils/__init__.py,sha256=_avMF_UOkfR3tNeDIPqQ5odmbq5raKkaq1rZ9Cn1CJs,332
165
166
  xp/utils/checksum.py,sha256=HDpiQxmdIedbCbZ4o_Box0i_Zig417BtCV_46ZyhiTk,1711
166
- xp/utils/dependencies.py,sha256=xUmk4XWGArR5__kHdEG1Y4K_dHxsP5mkXhwon_SW6Eo,20110
167
+ xp/utils/dependencies.py,sha256=ibTkpQ7nak2ioqlPtb7yCqBJ9tl3NHSxDdODtUItbCg,20281
167
168
  xp/utils/event_helper.py,sha256=W-A_xmoXlpWZBbJH6qdaN50o3-XrwFsDgvAGMJDiAgo,1001
168
169
  xp/utils/serialization.py,sha256=RWHHk86feaB4ZP7rjE4qOWK0900yg2joUBDkP76gfOY,4618
169
170
  xp/utils/time_utils.py,sha256=dEyViDlAG9GWU-J3D_YVa-sGma6yiyyMTgN4h2x3PY4,3781
170
- conson_xp-1.11.0.dist-info/RECORD,,
171
+ conson_xp-1.15.0.dist-info/RECORD,,
xp/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  conson-xp package.
4
4
  """
5
5
 
6
- __version__ = "1.11.0"
6
+ __version__ = "1.15.0"
7
7
  __manufacturer__ = "salchichon"
8
8
  __model__ = "xp.cli"
9
9
  __serial__ = "2025.09.23.000"
@@ -10,6 +10,7 @@ from xp.cli.commands.conbus.conbus import (
10
10
  conbus_datapoint,
11
11
  conbus_lightlevel,
12
12
  conbus_linknumber,
13
+ conbus_modulenumber,
13
14
  conbus_msactiontable,
14
15
  conbus_output,
15
16
  )
@@ -46,6 +47,10 @@ from xp.cli.commands.conbus.conbus_linknumber_commands import (
46
47
  get_linknumber_command,
47
48
  set_linknumber_command,
48
49
  )
50
+ from xp.cli.commands.conbus.conbus_modulenumber_commands import (
51
+ get_modulenumber_command,
52
+ set_modulenumber_command,
53
+ )
49
54
  from xp.cli.commands.conbus.conbus_msactiontable_commands import (
50
55
  conbus_download_msactiontable,
51
56
  )
@@ -87,6 +92,7 @@ __all__ = [
87
92
  "conbus_output",
88
93
  "conbus_datapoint",
89
94
  "conbus_linknumber",
95
+ "conbus_modulenumber",
90
96
  "conbus_autoreport",
91
97
  "conbus_lightlevel",
92
98
  "conbus_msactiontable",
@@ -123,6 +129,8 @@ __all__ = [
123
129
  "receive_telegrams",
124
130
  "set_linknumber_command",
125
131
  "get_linknumber_command",
132
+ "set_modulenumber_command",
133
+ "get_modulenumber_command",
126
134
  "get_autoreport_command",
127
135
  "set_autoreport_command",
128
136
  "xp_lightlevel_set",
@@ -57,6 +57,18 @@ def conbus_linknumber() -> None:
57
57
  pass
58
58
 
59
59
 
60
+ @click.group(
61
+ "modulenumber",
62
+ cls=HelpColorsGroup,
63
+ help_headers_color="yellow",
64
+ help_options_color="green",
65
+ short_help="Module number operations",
66
+ )
67
+ def conbus_modulenumber() -> None:
68
+ """Set or get the module number for specific modules."""
69
+ pass
70
+
71
+
60
72
  @click.group(
61
73
  "autoreport",
62
74
  cls=HelpColorsGroup,
@@ -109,6 +121,7 @@ conbus.add_command(conbus_blink)
109
121
  conbus.add_command(conbus_output)
110
122
  conbus.add_command(conbus_datapoint)
111
123
  conbus.add_command(conbus_linknumber)
124
+ conbus.add_command(conbus_modulenumber)
112
125
  conbus.add_command(conbus_autoreport)
113
126
  conbus.add_command(conbus_lightlevel)
114
127
  conbus.add_command(conbus_msactiontable)
@@ -49,7 +49,7 @@ def set_linknumber_command(
49
49
  ctx.obj.get("container").get_container().resolve(WriteConfigService)
50
50
  )
51
51
 
52
- data_value = f"{link_number: 02d}"
52
+ data_value = f"{link_number:02d}"
53
53
  with service:
54
54
  service.write_config(
55
55
  serial_number=serial_number,
@@ -0,0 +1,104 @@
1
+ """Conbus module number CLI commands."""
2
+
3
+ import json
4
+
5
+ import click
6
+
7
+ from xp.cli.commands.conbus.conbus import conbus_modulenumber
8
+ from xp.cli.utils.decorators import (
9
+ connection_command,
10
+ )
11
+ from xp.cli.utils.serial_number_type import SERIAL
12
+ from xp.models import ConbusDatapointResponse
13
+ from xp.models.conbus.conbus_writeconfig import ConbusWriteConfigResponse
14
+ from xp.models.telegram.datapoint_type import DataPointType
15
+ from xp.services.conbus.conbus_datapoint_service import ConbusDatapointService
16
+ from xp.services.conbus.write_config_service import WriteConfigService
17
+ from xp.services.telegram.telegram_datapoint_service import TelegramDatapointService
18
+
19
+
20
+ @conbus_modulenumber.command("set", short_help="Set module number for a module")
21
+ @click.argument("serial_number", type=SERIAL)
22
+ @click.argument("module_number", type=click.IntRange(0, 99))
23
+ @click.pass_context
24
+ @connection_command()
25
+ def set_modulenumber_command(
26
+ ctx: click.Context, serial_number: str, module_number: int
27
+ ) -> None:
28
+ r"""Set the module number for a specific module.
29
+
30
+ Args:
31
+ ctx: Click context object.
32
+ serial_number: 10-digit module serial number.
33
+ module_number: Module number to set (0-99).
34
+
35
+ Examples:
36
+ \b
37
+ xp conbus modulenumber set 0123450001 25
38
+ """
39
+
40
+ def on_finish(response: "ConbusWriteConfigResponse") -> None:
41
+ """Handle successful completion of light level on command.
42
+
43
+ Args:
44
+ response: Light level response object.
45
+ """
46
+ click.echo(json.dumps(response.to_dict(), indent=2))
47
+
48
+ service: WriteConfigService = (
49
+ ctx.obj.get("container").get_container().resolve(WriteConfigService)
50
+ )
51
+
52
+ data_value = f"{module_number:02d}"
53
+ with service:
54
+ service.write_config(
55
+ serial_number=serial_number,
56
+ datapoint_type=DataPointType.MODULE_NUMBER,
57
+ data_value=data_value,
58
+ finish_callback=on_finish,
59
+ timeout_seconds=0.5,
60
+ )
61
+
62
+
63
+ @conbus_modulenumber.command("get", short_help="Get module number for a module")
64
+ @click.argument("serial_number", type=SERIAL)
65
+ @click.pass_context
66
+ @connection_command()
67
+ def get_modulenumber_command(ctx: click.Context, serial_number: str) -> None:
68
+ r"""Get the current module number for a specific module.
69
+
70
+ Args:
71
+ ctx: Click context object.
72
+ serial_number: 10-digit module serial number.
73
+
74
+ Examples:
75
+ \b
76
+ xp conbus modulenumber get 0123450001
77
+ """
78
+ service: ConbusDatapointService = (
79
+ ctx.obj.get("container").get_container().resolve(ConbusDatapointService)
80
+ )
81
+ telegram_service: TelegramDatapointService = (
82
+ ctx.obj.get("container").get_container().resolve(TelegramDatapointService)
83
+ )
84
+
85
+ def on_finish(service_response: ConbusDatapointResponse) -> None:
86
+ """Handle successful completion of module number get command.
87
+
88
+ Args:
89
+ service_response: Module number response object.
90
+ """
91
+ modulenumber_value = telegram_service.get_modulenumber(
92
+ service_response.data_value
93
+ )
94
+ result = service_response.to_dict()
95
+ result["modulenumber_value"] = modulenumber_value
96
+ click.echo(json.dumps(result, indent=2))
97
+
98
+ with service:
99
+ service.query_datapoint(
100
+ serial_number=serial_number,
101
+ datapoint_type=DataPointType.MODULE_NUMBER,
102
+ finish_callback=on_finish,
103
+ timeout_seconds=0.5,
104
+ )
@@ -55,6 +55,8 @@ class HomekitAccessoryConfig(BaseModel):
55
55
  output_number: Output number for the accessory.
56
56
  description: Description of the accessory.
57
57
  service: Service type for the accessory.
58
+ on_action: on code for the accessory.
59
+ off_action: off code for the accessory.
58
60
  hap_accessory: Optional HAP accessory identifier.
59
61
  """
60
62
 
@@ -64,6 +66,8 @@ class HomekitAccessoryConfig(BaseModel):
64
66
  output_number: int
65
67
  description: str
66
68
  service: str
69
+ on_action: str
70
+ off_action: str
67
71
  hap_accessory: Optional[int] = None
68
72
 
69
73
 
@@ -61,11 +61,15 @@ class SendActionEvent(BaseEvent):
61
61
  serial_number: Serial number of the light bulb set.
62
62
  output_number: Output number of the light bulb set.
63
63
  value: Set light bulb On or Off (True/False).
64
+ on_action: On action E00L00I00.
65
+ off_action: On action E00L00I04.
64
66
  """
65
67
 
66
68
  serial_number: str = Field(description="Serial number of the light bulb set")
67
69
  output_number: int = Field(description="Output number of the light bulb set")
68
70
  value: bool = Field(description="Set light bulb On or Off (True/False)")
71
+ on_action: str = Field(description="on action")
72
+ off_action: str = Field(description="off action")
69
73
 
70
74
 
71
75
  class DatapointEvent(BaseEvent):
@@ -165,6 +165,7 @@ class WriteConfigService(ConbusProtocol):
165
165
  self.write_config_response.data_value = self.data_value
166
166
  if self.write_config_finished_callback:
167
167
  self.write_config_finished_callback(self.write_config_response)
168
+ self._stop_reactor()
168
169
 
169
170
  def write_config(
170
171
  self,
@@ -12,7 +12,6 @@ from xp.models.protocol.conbus_protocol import (
12
12
  SendActionEvent,
13
13
  SendWriteConfigEvent,
14
14
  )
15
- from xp.models.telegram.action_type import ActionType
16
15
  from xp.models.telegram.datapoint_type import DataPointType
17
16
  from xp.models.telegram.system_function import SystemFunction
18
17
  from xp.services.protocol.telegram_protocol import TelegramProtocol
@@ -87,11 +86,8 @@ class HomeKitConbusService:
87
86
  """
88
87
  self.logger.debug(f"send_action_event {event}")
89
88
 
90
- action_value = (
91
- ActionType.ON_RELEASE.value if event.value else ActionType.OFF_PRESS.value
92
- )
93
- input_action = f"{event.output_number:02d}{action_value}"
94
- telegram = (
95
- f"S{event.serial_number}F{SystemFunction.ACTION.value}D{input_action}"
96
- )
97
- self.telegram_protocol.sendFrame(telegram.encode())
89
+ telegram = event.on_action if event.value else event.off_action
90
+ telegram_make = f"{telegram}M"
91
+ telegram_break = f"{telegram}B"
92
+ self.telegram_protocol.sendFrame(telegram_make.encode())
93
+ self.telegram_protocol.sendFrame(telegram_break.encode())
@@ -77,6 +77,8 @@ class HomeKitLightbulbService:
77
77
  serial_number=event.serial_number,
78
78
  output_number=event.output_number,
79
79
  value=event.value,
80
+ on_action=event.accessory.on_action,
81
+ off_action=event.accessory.off_action,
80
82
  )
81
83
 
82
84
  self.logger.debug(f"Dispatching SendActionEvent for {event.serial_number}")
@@ -85,6 +85,8 @@ class HomeKitOutletService:
85
85
  serial_number=event.serial_number,
86
86
  output_number=event.output_number,
87
87
  value=event.value,
88
+ on_action=event.accessory.on_action,
89
+ off_action=event.accessory.off_action,
88
90
  )
89
91
 
90
92
  self.logger.debug(f"Dispatching SendActionEvent for {event.serial_number}")
@@ -68,3 +68,15 @@ class TelegramDatapointService:
68
68
  """
69
69
  link_number_value = int(data_value)
70
70
  return link_number_value
71
+
72
+ def get_modulenumber(self, data_value: str) -> int:
73
+ """Parse and return the module number value.
74
+
75
+ Args:
76
+ data_value: The raw module number data value as a string.
77
+
78
+ Returns:
79
+ The module number as an integer.
80
+ """
81
+ module_number_value = int(data_value)
82
+ return module_number_value
xp/utils/dependencies.py CHANGED
@@ -64,6 +64,7 @@ from xp.services.reverse_proxy_service import ReverseProxyService
64
64
  from xp.services.server.device_service_factory import DeviceServiceFactory
65
65
  from xp.services.server.server_service import ServerService
66
66
  from xp.services.telegram.telegram_blink_service import TelegramBlinkService
67
+ from xp.services.telegram.telegram_datapoint_service import TelegramDatapointService
67
68
  from xp.services.telegram.telegram_discover_service import TelegramDiscoverService
68
69
  from xp.services.telegram.telegram_link_number_service import LinkNumberService
69
70
  from xp.services.telegram.telegram_output_service import TelegramOutputService
@@ -128,6 +129,7 @@ class ServiceContainer:
128
129
  )
129
130
  self.container.register(TelegramDiscoverService, scope=punq.Scope.singleton)
130
131
  self.container.register(TelegramBlinkService, scope=punq.Scope.singleton)
132
+ self.container.register(TelegramDatapointService, scope=punq.Scope.singleton)
131
133
  self.container.register(LinkNumberService, scope=punq.Scope.singleton)
132
134
 
133
135
  # Conbus services layer