conson-xp 1.46.0__py3-none-any.whl → 1.47.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {conson_xp-1.46.0.dist-info → conson_xp-1.47.0.dist-info}/METADATA +1 -1
- conson_xp-1.47.0.dist-info/RECORD +210 -0
- xp/__init__.py +3 -2
- xp/cli/commands/conbus/conbus.py +1 -1
- xp/cli/commands/conbus/conbus_actiontable_commands.py +33 -15
- xp/cli/commands/conbus/conbus_autoreport_commands.py +8 -4
- xp/cli/commands/conbus/conbus_blink_commands.py +20 -10
- xp/cli/commands/conbus/conbus_config_commands.py +2 -1
- xp/cli/commands/conbus/conbus_custom_commands.py +4 -2
- xp/cli/commands/conbus/conbus_datapoint_commands.py +10 -5
- xp/cli/commands/conbus/conbus_discover_commands.py +8 -4
- xp/cli/commands/conbus/conbus_event_commands.py +8 -4
- xp/cli/commands/conbus/conbus_export_commands.py +8 -4
- xp/cli/commands/conbus/conbus_lightlevel_commands.py +16 -8
- xp/cli/commands/conbus/conbus_linknumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_modulenumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_msactiontable_commands.py +78 -40
- xp/cli/commands/conbus/conbus_output_commands.py +16 -8
- xp/cli/commands/conbus/conbus_raw_commands.py +6 -3
- xp/cli/commands/conbus/conbus_receive_commands.py +6 -3
- xp/cli/commands/conbus/conbus_scan_commands.py +6 -3
- xp/cli/commands/file_commands.py +6 -3
- xp/cli/commands/homekit/homekit.py +4 -2
- xp/cli/commands/homekit/homekit_start_commands.py +2 -1
- xp/cli/commands/module_commands.py +8 -4
- xp/cli/commands/reverse_proxy_commands.py +8 -4
- xp/cli/commands/server/server_commands.py +6 -3
- xp/cli/commands/telegram/telegram_blink_commands.py +4 -2
- xp/cli/commands/telegram/telegram_checksum_commands.py +4 -2
- xp/cli/commands/telegram/telegram_discover_commands.py +2 -1
- xp/cli/commands/telegram/telegram_linknumber_commands.py +4 -2
- xp/cli/commands/telegram/telegram_parse_commands.py +4 -2
- xp/cli/commands/telegram/telegram_version_commands.py +2 -1
- xp/cli/commands/term/term_commands.py +4 -2
- xp/cli/main.py +2 -1
- xp/cli/utils/click_tree.py +6 -3
- xp/cli/utils/datapoint_type_choice.py +4 -2
- xp/cli/utils/decorators.py +42 -21
- xp/cli/utils/error_handlers.py +16 -8
- xp/cli/utils/formatters.py +22 -11
- xp/cli/utils/module_type_choice.py +4 -2
- xp/cli/utils/serial_number_type.py +4 -2
- xp/cli/utils/system_function_choice.py +4 -2
- xp/cli/utils/xp_module_type.py +4 -2
- xp/models/actiontable/actiontable.py +8 -8
- xp/models/actiontable/actiontable_type.py +20 -0
- xp/models/actiontable/msactiontable_xp20.py +8 -4
- xp/models/actiontable/msactiontable_xp24.py +12 -6
- xp/models/actiontable/msactiontable_xp33.py +20 -10
- xp/models/conbus/conbus.py +8 -4
- xp/models/conbus/conbus_autoreport.py +4 -2
- xp/models/conbus/conbus_blink.py +4 -2
- xp/models/conbus/conbus_client_config.py +6 -3
- xp/models/conbus/conbus_connection_status.py +4 -2
- xp/models/conbus/conbus_custom.py +4 -2
- xp/models/conbus/conbus_datapoint.py +4 -2
- xp/models/conbus/conbus_discover.py +6 -3
- xp/models/conbus/conbus_event_list.py +4 -2
- xp/models/conbus/conbus_event_raw.py +4 -2
- xp/models/conbus/conbus_export.py +2 -1
- xp/models/conbus/conbus_lightlevel.py +4 -2
- xp/models/conbus/conbus_linknumber.py +4 -2
- xp/models/conbus/conbus_logger_config.py +8 -4
- xp/models/conbus/conbus_output.py +4 -2
- xp/models/conbus/conbus_raw.py +4 -2
- xp/models/conbus/conbus_receive.py +4 -2
- xp/models/conbus/conbus_writeconfig.py +4 -2
- xp/models/config/conson_module_config.py +8 -4
- xp/models/homekit/homekit_accessory.py +4 -2
- xp/models/homekit/homekit_config.py +12 -6
- xp/models/log_entry.py +16 -8
- xp/models/protocol/conbus_protocol.py +36 -18
- xp/models/response.py +12 -8
- xp/models/telegram/action_type.py +4 -2
- xp/models/telegram/datapoint_type.py +4 -2
- xp/models/telegram/event_telegram.py +14 -7
- xp/models/telegram/event_type.py +2 -1
- xp/models/telegram/input_action_type.py +2 -1
- xp/models/telegram/input_type.py +2 -1
- xp/models/telegram/module_type.py +24 -12
- xp/models/telegram/module_type_code.py +2 -1
- xp/models/telegram/output_telegram.py +16 -10
- xp/models/telegram/reply_telegram.py +24 -13
- xp/models/telegram/system_function.py +6 -3
- xp/models/telegram/system_telegram.py +10 -6
- xp/models/telegram/telegram.py +2 -1
- xp/models/telegram/telegram_type.py +2 -1
- xp/models/telegram/timeparam_type.py +2 -1
- xp/models/term/connection_state.py +4 -2
- xp/models/term/module_state.py +2 -1
- xp/models/term/protocol_keys_config.py +6 -3
- xp/models/term/status_message.py +2 -1
- xp/models/term/telegram_display.py +2 -1
- xp/models/write_config_type.py +4 -2
- xp/services/actiontable/actiontable_serializer.py +34 -41
- xp/services/{conbus/actiontable/actiontable_download_state_machine.py → actiontable/download_state_machine.py} +13 -8
- xp/services/actiontable/msactiontable_xp20_serializer.py +77 -49
- xp/services/actiontable/msactiontable_xp24_serializer.py +78 -53
- xp/services/actiontable/msactiontable_xp33_serializer.py +39 -9
- xp/services/actiontable/serializer_protocol.py +76 -0
- xp/services/conbus/actiontable/actiontable_download_service.py +63 -29
- xp/services/conbus/actiontable/actiontable_list_service.py +17 -4
- xp/services/conbus/actiontable/actiontable_show_service.py +10 -6
- xp/services/conbus/actiontable/actiontable_upload_service.py +17 -9
- xp/services/conbus/conbus_blink_all_service.py +16 -8
- xp/services/conbus/conbus_blink_service.py +14 -7
- xp/services/conbus/conbus_custom_service.py +16 -8
- xp/services/conbus/conbus_datapoint_queryall_service.py +18 -9
- xp/services/conbus/conbus_datapoint_service.py +18 -9
- xp/services/conbus/conbus_discover_service.py +24 -13
- xp/services/conbus/conbus_event_list_service.py +11 -7
- xp/services/conbus/conbus_event_raw_service.py +18 -10
- xp/services/conbus/conbus_export_service.py +28 -14
- xp/services/conbus/conbus_output_service.py +18 -10
- xp/services/conbus/conbus_raw_service.py +16 -8
- xp/services/conbus/conbus_receive_service.py +18 -10
- xp/services/conbus/conbus_scan_service.py +18 -10
- xp/services/conbus/msactiontable/msactiontable_upload_service.py +17 -9
- xp/services/conbus/write_config_service.py +18 -9
- xp/services/homekit/homekit_cache_service.py +12 -6
- xp/services/homekit/homekit_conbus_service.py +12 -6
- xp/services/homekit/homekit_config_validator.py +34 -17
- xp/services/homekit/homekit_conson_validator.py +18 -9
- xp/services/homekit/homekit_dimminglight.py +14 -7
- xp/services/homekit/homekit_dimminglight_service.py +14 -7
- xp/services/homekit/homekit_hap_service.py +18 -9
- xp/services/homekit/homekit_lightbulb.py +10 -5
- xp/services/homekit/homekit_lightbulb_service.py +10 -5
- xp/services/homekit/homekit_module_service.py +8 -4
- xp/services/homekit/homekit_outlet.py +14 -7
- xp/services/homekit/homekit_outlet_service.py +12 -6
- xp/services/homekit/homekit_service.py +24 -12
- xp/services/log_file_service.py +16 -8
- xp/services/module_type_service.py +10 -5
- xp/services/protocol/conbus_event_protocol.py +46 -24
- xp/services/protocol/conbus_protocol.py +36 -19
- xp/services/protocol/protocol_factory.py +12 -6
- xp/services/protocol/telegram_protocol.py +12 -6
- xp/services/reverse_proxy_service.py +26 -14
- xp/services/server/base_server_service.py +42 -23
- xp/services/server/client_buffer_manager.py +12 -7
- xp/services/server/cp20_server_service.py +10 -7
- xp/services/server/device_service_factory.py +12 -8
- xp/services/server/server_service.py +18 -11
- xp/services/server/xp130_server_service.py +11 -8
- xp/services/server/xp20_server_service.py +16 -10
- xp/services/server/xp230_server_service.py +10 -7
- xp/services/server/xp24_server_service.py +22 -13
- xp/services/server/xp33_server_service.py +44 -25
- xp/services/telegram/telegram_blink_service.py +14 -8
- xp/services/telegram/telegram_checksum_service.py +12 -7
- xp/services/telegram/telegram_datapoint_service.py +14 -9
- xp/services/telegram/telegram_discover_service.py +28 -15
- xp/services/telegram/telegram_link_number_service.py +18 -10
- xp/services/telegram/telegram_output_service.py +24 -12
- xp/services/telegram/telegram_service.py +22 -11
- xp/services/telegram/telegram_version_service.py +14 -8
- xp/services/term/protocol_monitor_service.py +30 -16
- xp/services/term/state_monitor_service.py +39 -21
- xp/term/protocol.py +12 -6
- xp/term/state.py +12 -7
- xp/term/widgets/help_menu.py +6 -3
- xp/term/widgets/modules_list.py +20 -10
- xp/term/widgets/protocol_log.py +12 -6
- xp/term/widgets/status_footer.py +10 -5
- xp/utils/checksum.py +6 -3
- xp/utils/dependencies.py +25 -30
- xp/utils/event_helper.py +6 -4
- xp/utils/logging.py +6 -3
- xp/utils/serialization.py +30 -16
- xp/utils/state_machine.py +16 -9
- xp/utils/time_utils.py +6 -3
- conson_xp-1.46.0.dist-info/RECORD +0 -211
- xp/services/conbus/msactiontable/msactiontable_download_service.py +0 -275
- xp/services/conbus/msactiontable/msactiontable_list_service.py +0 -100
- xp/services/conbus/msactiontable/msactiontable_show_service.py +0 -89
- {conson_xp-1.46.0.dist-info → conson_xp-1.47.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.46.0.dist-info → conson_xp-1.47.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.46.0.dist-info → conson_xp-1.47.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus DataPoint Query All Service.
|
|
2
3
|
|
|
3
4
|
This module provides service for querying all datapoint types from a module.
|
|
4
5
|
"""
|
|
@@ -20,7 +21,8 @@ from xp.services.protocol.conbus_event_protocol import ConbusEventProtocol
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class ConbusDatapointQueryAllService:
|
|
23
|
-
"""
|
|
24
|
+
"""
|
|
25
|
+
Utility service for querying all datapoints from a module.
|
|
24
26
|
|
|
25
27
|
This service orchestrates multiple ConbusDatapointService calls to query
|
|
26
28
|
all available datapoint types sequentially.
|
|
@@ -40,7 +42,8 @@ class ConbusDatapointQueryAllService:
|
|
|
40
42
|
conbus_protocol: ConbusEventProtocol,
|
|
41
43
|
telegram_service: TelegramService,
|
|
42
44
|
) -> None:
|
|
43
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Initialize the query all service.
|
|
44
47
|
|
|
45
48
|
Args:
|
|
46
49
|
conbus_protocol: ConbusEventProtocol for protocol communication.
|
|
@@ -73,7 +76,8 @@ class ConbusDatapointQueryAllService:
|
|
|
73
76
|
self.next_datapoint()
|
|
74
77
|
|
|
75
78
|
def next_datapoint(self) -> bool:
|
|
76
|
-
"""
|
|
79
|
+
"""
|
|
80
|
+
Query the next datapoint type.
|
|
77
81
|
|
|
78
82
|
Returns:
|
|
79
83
|
True if there are more datapoints to query, False otherwise.
|
|
@@ -111,7 +115,8 @@ class ConbusDatapointQueryAllService:
|
|
|
111
115
|
self.on_finish.emit(self.service_response)
|
|
112
116
|
|
|
113
117
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
114
|
-
"""
|
|
118
|
+
"""
|
|
119
|
+
Handle telegram sent event.
|
|
115
120
|
|
|
116
121
|
Args:
|
|
117
122
|
telegram_sent: The telegram that was sent.
|
|
@@ -119,7 +124,8 @@ class ConbusDatapointQueryAllService:
|
|
|
119
124
|
self.service_response.sent_telegram = telegram_sent
|
|
120
125
|
|
|
121
126
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
122
|
-
"""
|
|
127
|
+
"""
|
|
128
|
+
Handle telegram received event.
|
|
123
129
|
|
|
124
130
|
Args:
|
|
125
131
|
telegram_received: The telegram received event.
|
|
@@ -152,7 +158,8 @@ class ConbusDatapointQueryAllService:
|
|
|
152
158
|
self.on_progress.emit(datapoint_telegram)
|
|
153
159
|
|
|
154
160
|
def failed(self, message: str) -> None:
|
|
155
|
-
"""
|
|
161
|
+
"""
|
|
162
|
+
Handle failed connection event.
|
|
156
163
|
|
|
157
164
|
Args:
|
|
158
165
|
message: Failure message.
|
|
@@ -170,7 +177,8 @@ class ConbusDatapointQueryAllService:
|
|
|
170
177
|
serial_number: str,
|
|
171
178
|
timeout_seconds: Optional[float] = None,
|
|
172
179
|
) -> None:
|
|
173
|
-
"""
|
|
180
|
+
"""
|
|
181
|
+
Query all datapoints from a module.
|
|
174
182
|
|
|
175
183
|
Args:
|
|
176
184
|
serial_number: 10-digit module serial number.
|
|
@@ -182,7 +190,8 @@ class ConbusDatapointQueryAllService:
|
|
|
182
190
|
self.serial_number = serial_number
|
|
183
191
|
|
|
184
192
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
185
|
-
"""
|
|
193
|
+
"""
|
|
194
|
+
Set operation timeout.
|
|
186
195
|
|
|
187
196
|
Args:
|
|
188
197
|
timeout_seconds: Timeout in seconds.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Datapoint Service for querying module datapoints.
|
|
2
3
|
|
|
3
4
|
This service handles datapoint query operations for modules through Conbus telegrams.
|
|
4
5
|
"""
|
|
@@ -20,7 +21,8 @@ from xp.services.telegram.telegram_service import TelegramService
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class ConbusDatapointService:
|
|
23
|
-
"""
|
|
24
|
+
"""
|
|
25
|
+
Service for querying datapoints from Conbus modules.
|
|
24
26
|
|
|
25
27
|
Uses ConbusEventProtocol to provide datapoint query functionality
|
|
26
28
|
for reading sensor data and module information.
|
|
@@ -38,7 +40,8 @@ class ConbusDatapointService:
|
|
|
38
40
|
conbus_protocol: ConbusEventProtocol,
|
|
39
41
|
telegram_service: TelegramService,
|
|
40
42
|
) -> None:
|
|
41
|
-
"""
|
|
43
|
+
"""
|
|
44
|
+
Initialize the Conbus datapoint service.
|
|
42
45
|
|
|
43
46
|
Args:
|
|
44
47
|
conbus_protocol: Protocol instance for Conbus communication.
|
|
@@ -81,7 +84,8 @@ class ConbusDatapointService:
|
|
|
81
84
|
)
|
|
82
85
|
|
|
83
86
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
84
|
-
"""
|
|
87
|
+
"""
|
|
88
|
+
Handle telegram sent event.
|
|
85
89
|
|
|
86
90
|
Args:
|
|
87
91
|
telegram_sent: The telegram that was sent.
|
|
@@ -89,7 +93,8 @@ class ConbusDatapointService:
|
|
|
89
93
|
self.service_response.sent_telegram = telegram_sent
|
|
90
94
|
|
|
91
95
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
92
|
-
"""
|
|
96
|
+
"""
|
|
97
|
+
Handle telegram received event.
|
|
93
98
|
|
|
94
99
|
Args:
|
|
95
100
|
telegram_received: The telegram received event.
|
|
@@ -124,7 +129,8 @@ class ConbusDatapointService:
|
|
|
124
129
|
self.succeed(datapoint_telegram)
|
|
125
130
|
|
|
126
131
|
def succeed(self, datapoint_telegram: ReplyTelegram) -> None:
|
|
127
|
-
"""
|
|
132
|
+
"""
|
|
133
|
+
Handle successful datapoint query.
|
|
128
134
|
|
|
129
135
|
Args:
|
|
130
136
|
datapoint_telegram: The parsed datapoint telegram.
|
|
@@ -147,7 +153,8 @@ class ConbusDatapointService:
|
|
|
147
153
|
self.failed("Timeout")
|
|
148
154
|
|
|
149
155
|
def failed(self, message: str) -> None:
|
|
150
|
-
"""
|
|
156
|
+
"""
|
|
157
|
+
Handle failed connection event.
|
|
151
158
|
|
|
152
159
|
Args:
|
|
153
160
|
message: Failure message.
|
|
@@ -167,7 +174,8 @@ class ConbusDatapointService:
|
|
|
167
174
|
datapoint_type: DataPointType,
|
|
168
175
|
timeout_seconds: float = 1.0,
|
|
169
176
|
) -> None:
|
|
170
|
-
"""
|
|
177
|
+
"""
|
|
178
|
+
Query a specific datapoint from a module.
|
|
171
179
|
|
|
172
180
|
Args:
|
|
173
181
|
serial_number: 10-digit module serial number.
|
|
@@ -181,7 +189,8 @@ class ConbusDatapointService:
|
|
|
181
189
|
self.datapoint_type = datapoint_type
|
|
182
190
|
|
|
183
191
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
184
|
-
"""
|
|
192
|
+
"""
|
|
193
|
+
Set operation timeout.
|
|
185
194
|
|
|
186
195
|
Args:
|
|
187
196
|
timeout_seconds: Timeout in seconds.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Discover Service for TCP communication with Conbus servers.
|
|
2
3
|
|
|
3
|
-
This service implements a TCP client that connects to Conbus servers and sends
|
|
4
|
-
|
|
4
|
+
This service implements a TCP client that connects to Conbus servers and sends discover
|
|
5
|
+
telegrams to find modules on the network.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
import asyncio
|
|
@@ -40,7 +41,8 @@ class ConbusDiscoverService:
|
|
|
40
41
|
on_device_discovered: Signal = Signal(ConbusDiscoverResponse)
|
|
41
42
|
|
|
42
43
|
def __init__(self, conbus_protocol: ConbusEventProtocol) -> None:
|
|
43
|
-
"""
|
|
44
|
+
"""
|
|
45
|
+
Initialize the Conbus discover service.
|
|
44
46
|
|
|
45
47
|
Args:
|
|
46
48
|
conbus_protocol: ConbusProtocol.
|
|
@@ -68,7 +70,8 @@ class ConbusDiscoverService:
|
|
|
68
70
|
)
|
|
69
71
|
|
|
70
72
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
71
|
-
"""
|
|
73
|
+
"""
|
|
74
|
+
Handle telegram sent event.
|
|
72
75
|
|
|
73
76
|
Args:
|
|
74
77
|
telegram_sent: The telegram that was sent.
|
|
@@ -77,7 +80,8 @@ class ConbusDiscoverService:
|
|
|
77
80
|
self.discovered_device_result.sent_telegram = telegram_sent
|
|
78
81
|
|
|
79
82
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
80
|
-
"""
|
|
83
|
+
"""
|
|
84
|
+
Handle telegram received event.
|
|
81
85
|
|
|
82
86
|
Args:
|
|
83
87
|
telegram_received: The telegram received event.
|
|
@@ -121,7 +125,8 @@ class ConbusDiscoverService:
|
|
|
121
125
|
self.logger.debug("Not a discover or module type response")
|
|
122
126
|
|
|
123
127
|
def handle_discovered_device(self, serial_number: str) -> None:
|
|
124
|
-
"""
|
|
128
|
+
"""
|
|
129
|
+
Handle discovered device event.
|
|
125
130
|
|
|
126
131
|
Args:
|
|
127
132
|
serial_number: Serial number of the discovered device.
|
|
@@ -153,7 +158,8 @@ class ConbusDiscoverService:
|
|
|
153
158
|
def handle_module_type_code_response(
|
|
154
159
|
self, serial_number: str, module_type_code: str
|
|
155
160
|
) -> None:
|
|
156
|
-
"""
|
|
161
|
+
"""
|
|
162
|
+
Handle module type code response and update discovered device.
|
|
157
163
|
|
|
158
164
|
Args:
|
|
159
165
|
serial_number: Serial number of the device.
|
|
@@ -214,7 +220,8 @@ class ConbusDiscoverService:
|
|
|
214
220
|
self.succeed()
|
|
215
221
|
|
|
216
222
|
def handle_module_type_response(self, serial_number: str, module_type: str) -> None:
|
|
217
|
-
"""
|
|
223
|
+
"""
|
|
224
|
+
Handle module type response and update discovered device.
|
|
218
225
|
|
|
219
226
|
Args:
|
|
220
227
|
serial_number: Serial number of the device.
|
|
@@ -249,7 +256,8 @@ class ConbusDiscoverService:
|
|
|
249
256
|
self.on_finish.emit(self.discovered_device_result)
|
|
250
257
|
|
|
251
258
|
def failed(self, message: str) -> None:
|
|
252
|
-
"""
|
|
259
|
+
"""
|
|
260
|
+
Handle failed connection event.
|
|
253
261
|
|
|
254
262
|
Args:
|
|
255
263
|
message: Failure message.
|
|
@@ -267,7 +275,8 @@ class ConbusDiscoverService:
|
|
|
267
275
|
self.on_finish.emit(self.discovered_device_result)
|
|
268
276
|
|
|
269
277
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
270
|
-
"""
|
|
278
|
+
"""
|
|
279
|
+
Setup callbacks and timeout for receiving telegrams.
|
|
271
280
|
|
|
272
281
|
Args:
|
|
273
282
|
timeout_seconds: Optional timeout in seconds.
|
|
@@ -279,7 +288,8 @@ class ConbusDiscoverService:
|
|
|
279
288
|
self,
|
|
280
289
|
event_loop: asyncio.AbstractEventLoop,
|
|
281
290
|
) -> None:
|
|
282
|
-
"""
|
|
291
|
+
"""
|
|
292
|
+
Setup callbacks and timeout for receiving telegrams.
|
|
283
293
|
|
|
284
294
|
Args:
|
|
285
295
|
event_loop: Optional event loop to use for async operations.
|
|
@@ -296,7 +306,8 @@ class ConbusDiscoverService:
|
|
|
296
306
|
self.conbus_protocol.stop_reactor()
|
|
297
307
|
|
|
298
308
|
def __enter__(self) -> "ConbusDiscoverService":
|
|
299
|
-
"""
|
|
309
|
+
"""
|
|
310
|
+
Enter context manager.
|
|
300
311
|
|
|
301
312
|
Returns:
|
|
302
313
|
Self for context manager protocol.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Event List Service for listing configured event telegrams.
|
|
2
3
|
|
|
3
|
-
This service parses action tables from conson.yml and groups events
|
|
4
|
-
|
|
4
|
+
This service parses action tables from conson.yml and groups events by button
|
|
5
|
+
configuration to show which modules are assigned to each event.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
import logging
|
|
@@ -14,7 +15,8 @@ from xp.services.actiontable.actiontable_serializer import ActionTableSerializer
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class ConbusEventListService:
|
|
17
|
-
"""
|
|
18
|
+
"""
|
|
19
|
+
Service for listing configured event telegrams from action tables.
|
|
18
20
|
|
|
19
21
|
Parses action tables from conson.yml configuration and groups modules
|
|
20
22
|
by their event keys to identify common button configurations.
|
|
@@ -25,7 +27,8 @@ class ConbusEventListService:
|
|
|
25
27
|
"""
|
|
26
28
|
|
|
27
29
|
def __init__(self, conson_config: ConsonModuleListConfig) -> None:
|
|
28
|
-
"""
|
|
30
|
+
"""
|
|
31
|
+
Initialize the Conbus event list service.
|
|
29
32
|
|
|
30
33
|
Args:
|
|
31
34
|
conson_config: ConsonModuleListConfig instance with module action tables.
|
|
@@ -34,7 +37,8 @@ class ConbusEventListService:
|
|
|
34
37
|
self.logger = logging.getLogger(__name__)
|
|
35
38
|
|
|
36
39
|
def list_events(self) -> ConbusEventListResponse:
|
|
37
|
-
"""
|
|
40
|
+
"""
|
|
41
|
+
List all configured events from module action tables.
|
|
38
42
|
|
|
39
43
|
Parses action tables, extracts event information (module_type, link, input),
|
|
40
44
|
groups modules by event key, and sorts by usage count.
|
|
@@ -56,7 +60,7 @@ class ConbusEventListService:
|
|
|
56
60
|
for action in module.action_table:
|
|
57
61
|
try:
|
|
58
62
|
# Use existing ActionTableSerializer to parse action
|
|
59
|
-
entry = ActionTableSerializer.
|
|
63
|
+
entry = ActionTableSerializer._parse_action_string(action)
|
|
60
64
|
|
|
61
65
|
# Extract event data from parsed entry
|
|
62
66
|
module_type_name = entry.module_type.name
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Event Raw Service for sending raw event telegrams.
|
|
2
3
|
|
|
3
|
-
This service implements a TCP client that connects to Conbus servers and sends
|
|
4
|
-
|
|
4
|
+
This service implements a TCP client that connects to Conbus servers and sends raw event
|
|
5
|
+
telegrams to simulate button presses on Conbus modules.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
import logging
|
|
@@ -15,7 +16,8 @@ from xp.services.protocol.conbus_event_protocol import ConbusEventProtocol
|
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class ConbusEventRawService:
|
|
18
|
-
"""
|
|
19
|
+
"""
|
|
20
|
+
Service for sending raw event telegrams to Conbus servers.
|
|
19
21
|
|
|
20
22
|
Uses ConbusEventProtocol to send MAKE/BREAK event sequences to
|
|
21
23
|
simulate button presses on Conbus modules.
|
|
@@ -27,7 +29,8 @@ class ConbusEventRawService:
|
|
|
27
29
|
conbus_protocol: ConbusEventProtocol
|
|
28
30
|
|
|
29
31
|
def __init__(self, conbus_protocol: ConbusEventProtocol) -> None:
|
|
30
|
-
"""
|
|
32
|
+
"""
|
|
33
|
+
Initialize the Conbus event raw service.
|
|
31
34
|
|
|
32
35
|
Args:
|
|
33
36
|
conbus_protocol: ConbusEventProtocol instance.
|
|
@@ -79,7 +82,8 @@ class ConbusEventRawService:
|
|
|
79
82
|
self.conbus_protocol.call_later(0.0, self.conbus_protocol.start_queue_manager)
|
|
80
83
|
|
|
81
84
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
82
|
-
"""
|
|
85
|
+
"""
|
|
86
|
+
Handle telegram sent event.
|
|
83
87
|
|
|
84
88
|
Args:
|
|
85
89
|
telegram_sent: The telegram that was sent.
|
|
@@ -90,7 +94,8 @@ class ConbusEventRawService:
|
|
|
90
94
|
self.event_result.sent_telegrams.append(telegram_sent)
|
|
91
95
|
|
|
92
96
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
93
|
-
"""
|
|
97
|
+
"""
|
|
98
|
+
Handle telegram received event.
|
|
94
99
|
|
|
95
100
|
Args:
|
|
96
101
|
telegram_received: The telegram received event.
|
|
@@ -105,7 +110,8 @@ class ConbusEventRawService:
|
|
|
105
110
|
self.progress_callback(telegram_received.frame)
|
|
106
111
|
|
|
107
112
|
def timeout(self) -> None:
|
|
108
|
-
"""
|
|
113
|
+
"""
|
|
114
|
+
Handle timeout event.
|
|
109
115
|
|
|
110
116
|
Timeout is the normal/expected way to finish this service.
|
|
111
117
|
"""
|
|
@@ -119,7 +125,8 @@ class ConbusEventRawService:
|
|
|
119
125
|
self.stop_reactor()
|
|
120
126
|
|
|
121
127
|
def failed(self, message: str) -> None:
|
|
122
|
-
"""
|
|
128
|
+
"""
|
|
129
|
+
Handle failed connection event.
|
|
123
130
|
|
|
124
131
|
Args:
|
|
125
132
|
message: Failure message.
|
|
@@ -155,7 +162,8 @@ class ConbusEventRawService:
|
|
|
155
162
|
finish_callback: Callable[[ConbusEventRawResponse], None],
|
|
156
163
|
timeout_seconds: int = 5,
|
|
157
164
|
) -> None:
|
|
158
|
-
"""
|
|
165
|
+
"""
|
|
166
|
+
Run reactor in dedicated thread with its own event loop.
|
|
159
167
|
|
|
160
168
|
Args:
|
|
161
169
|
module_type_code: Module type code (numeric, e.g., 2 for CP20, 33 for XP33).
|
|
@@ -23,7 +23,8 @@ from xp.services.telegram.telegram_service import TelegramService
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class ConbusExportService:
|
|
26
|
-
"""
|
|
26
|
+
"""
|
|
27
|
+
Service for exporting Conbus device configurations.
|
|
27
28
|
|
|
28
29
|
Discovers all devices on the Conbus network and queries their configuration
|
|
29
30
|
datapoints to generate a structured export file compatible with conson.yml format.
|
|
@@ -57,7 +58,8 @@ class ConbusExportService:
|
|
|
57
58
|
]
|
|
58
59
|
|
|
59
60
|
def __init__(self, conbus_protocol: ConbusEventProtocol) -> None:
|
|
60
|
-
"""
|
|
61
|
+
"""
|
|
62
|
+
Initialize the Conbus export service.
|
|
61
63
|
|
|
62
64
|
Args:
|
|
63
65
|
conbus_protocol: Protocol for Conbus communication.
|
|
@@ -93,7 +95,8 @@ class ConbusExportService:
|
|
|
93
95
|
)
|
|
94
96
|
|
|
95
97
|
def telegram_sent(self, telegram: str) -> None:
|
|
96
|
-
"""
|
|
98
|
+
"""
|
|
99
|
+
Handle telegram sent event.
|
|
97
100
|
|
|
98
101
|
Args:
|
|
99
102
|
telegram: Telegram that was sent.
|
|
@@ -101,7 +104,8 @@ class ConbusExportService:
|
|
|
101
104
|
self.export_result.sent_telegrams.append(telegram)
|
|
102
105
|
|
|
103
106
|
def telegram_received(self, event: TelegramReceivedEvent) -> None:
|
|
104
|
-
"""
|
|
107
|
+
"""
|
|
108
|
+
Handle telegram received event.
|
|
105
109
|
|
|
106
110
|
Args:
|
|
107
111
|
event: Telegram received event.
|
|
@@ -133,7 +137,8 @@ class ConbusExportService:
|
|
|
133
137
|
)
|
|
134
138
|
|
|
135
139
|
def _handle_discovery_response(self, serial_number: str) -> None:
|
|
136
|
-
"""
|
|
140
|
+
"""
|
|
141
|
+
Handle discovery response and query all datapoints.
|
|
137
142
|
|
|
138
143
|
Args:
|
|
139
144
|
serial_number: Serial number of discovered device.
|
|
@@ -175,7 +180,8 @@ class ConbusExportService:
|
|
|
175
180
|
def _handle_datapoint_response(
|
|
176
181
|
self, serial_number: str, datapoint_code: str, value: str
|
|
177
182
|
) -> None:
|
|
178
|
-
"""
|
|
183
|
+
"""
|
|
184
|
+
Handle datapoint response and store value.
|
|
179
185
|
|
|
180
186
|
Args:
|
|
181
187
|
serial_number: Serial number of device.
|
|
@@ -201,7 +207,8 @@ class ConbusExportService:
|
|
|
201
207
|
def _store_datapoint_value(
|
|
202
208
|
self, serial_number: str, datapoint: DataPointType, value: str
|
|
203
209
|
) -> None:
|
|
204
|
-
"""
|
|
210
|
+
"""
|
|
211
|
+
Store datapoint value in device config.
|
|
205
212
|
|
|
206
213
|
Args:
|
|
207
214
|
serial_number: Serial number of device.
|
|
@@ -231,7 +238,8 @@ class ConbusExportService:
|
|
|
231
238
|
self.logger.warning(f"Invalid value '{value}' for {datapoint.name}: {e}")
|
|
232
239
|
|
|
233
240
|
def _is_device_complete(self, serial_number: str) -> bool:
|
|
234
|
-
"""
|
|
241
|
+
"""
|
|
242
|
+
Check if a device has all required datapoints.
|
|
235
243
|
|
|
236
244
|
Args:
|
|
237
245
|
serial_number: Serial number of device.
|
|
@@ -253,7 +261,8 @@ class ConbusExportService:
|
|
|
253
261
|
)
|
|
254
262
|
|
|
255
263
|
def _check_device_complete(self, serial_number: str) -> None:
|
|
256
|
-
"""
|
|
264
|
+
"""
|
|
265
|
+
Check if device has all datapoints and emit completion signal.
|
|
257
266
|
|
|
258
267
|
Args:
|
|
259
268
|
serial_number: Serial number of device.
|
|
@@ -313,7 +322,8 @@ class ConbusExportService:
|
|
|
313
322
|
self.on_finish.emit(self.export_result)
|
|
314
323
|
|
|
315
324
|
def _write_export_file(self, path: str) -> None:
|
|
316
|
-
"""
|
|
325
|
+
"""
|
|
326
|
+
Write export to YAML file.
|
|
317
327
|
|
|
318
328
|
Args:
|
|
319
329
|
path: Output file path.
|
|
@@ -385,7 +395,8 @@ class ConbusExportService:
|
|
|
385
395
|
self._finalize_export()
|
|
386
396
|
|
|
387
397
|
def failed(self, message: str) -> None:
|
|
388
|
-
"""
|
|
398
|
+
"""
|
|
399
|
+
Handle connection failure event.
|
|
389
400
|
|
|
390
401
|
Args:
|
|
391
402
|
message: Failure message.
|
|
@@ -398,7 +409,8 @@ class ConbusExportService:
|
|
|
398
409
|
self.on_finish.emit(self.export_result)
|
|
399
410
|
|
|
400
411
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
401
|
-
"""
|
|
412
|
+
"""
|
|
413
|
+
Set timeout for export operation.
|
|
402
414
|
|
|
403
415
|
Args:
|
|
404
416
|
timeout_seconds: Timeout in seconds.
|
|
@@ -407,7 +419,8 @@ class ConbusExportService:
|
|
|
407
419
|
self.conbus_protocol.timeout_seconds = timeout_seconds
|
|
408
420
|
|
|
409
421
|
def set_event_loop(self, event_loop: asyncio.AbstractEventLoop) -> None:
|
|
410
|
-
"""
|
|
422
|
+
"""
|
|
423
|
+
Set event loop for async operations.
|
|
411
424
|
|
|
412
425
|
Args:
|
|
413
426
|
event_loop: Event loop to use.
|
|
@@ -424,7 +437,8 @@ class ConbusExportService:
|
|
|
424
437
|
self.conbus_protocol.stop_reactor()
|
|
425
438
|
|
|
426
439
|
def __enter__(self) -> "ConbusExportService":
|
|
427
|
-
"""
|
|
440
|
+
"""
|
|
441
|
+
Enter context manager.
|
|
428
442
|
|
|
429
443
|
Returns:
|
|
430
444
|
Self for context manager protocol.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Output Service for sending action telegrams to Conbus modules.
|
|
2
3
|
|
|
3
|
-
This service handles sending action telegrams (ON/OFF) to module outputs
|
|
4
|
-
|
|
4
|
+
This service handles sending action telegrams (ON/OFF) to module outputs and processing
|
|
5
|
+
ACK/NAK responses.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
import logging
|
|
@@ -49,7 +50,8 @@ class ConbusOutputService:
|
|
|
49
50
|
conbus_protocol: ConbusEventProtocol,
|
|
50
51
|
telegram_output_service: TelegramOutputService,
|
|
51
52
|
):
|
|
52
|
-
"""
|
|
53
|
+
"""
|
|
54
|
+
Initialize the Conbus output service.
|
|
53
55
|
|
|
54
56
|
Args:
|
|
55
57
|
conbus_protocol: ConbusEventProtocol for communication.
|
|
@@ -105,7 +107,8 @@ class ConbusOutputService:
|
|
|
105
107
|
)
|
|
106
108
|
|
|
107
109
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
108
|
-
"""
|
|
110
|
+
"""
|
|
111
|
+
Handle telegram sent event.
|
|
109
112
|
|
|
110
113
|
Args:
|
|
111
114
|
telegram_sent: The telegram that was sent.
|
|
@@ -113,7 +116,8 @@ class ConbusOutputService:
|
|
|
113
116
|
self.service_response.sent_telegram = telegram_sent
|
|
114
117
|
|
|
115
118
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
116
|
-
"""
|
|
119
|
+
"""
|
|
120
|
+
Handle telegram received event.
|
|
117
121
|
|
|
118
122
|
Args:
|
|
119
123
|
telegram_received: The telegram received event.
|
|
@@ -149,7 +153,8 @@ class ConbusOutputService:
|
|
|
149
153
|
)
|
|
150
154
|
|
|
151
155
|
def succeed(self, output_telegram: OutputTelegram) -> None:
|
|
152
|
-
"""
|
|
156
|
+
"""
|
|
157
|
+
Handle successful output action.
|
|
153
158
|
|
|
154
159
|
Args:
|
|
155
160
|
output_telegram: The output telegram received as response.
|
|
@@ -169,7 +174,8 @@ class ConbusOutputService:
|
|
|
169
174
|
self.failed("Timeout")
|
|
170
175
|
|
|
171
176
|
def failed(self, message: str) -> None:
|
|
172
|
-
"""
|
|
177
|
+
"""
|
|
178
|
+
Handle failed connection event.
|
|
173
179
|
|
|
174
180
|
Args:
|
|
175
181
|
message: Failure message.
|
|
@@ -190,7 +196,8 @@ class ConbusOutputService:
|
|
|
190
196
|
action_type: ActionType,
|
|
191
197
|
timeout_seconds: Optional[float] = None,
|
|
192
198
|
) -> None:
|
|
193
|
-
"""
|
|
199
|
+
"""
|
|
200
|
+
Send an action telegram to a module output.
|
|
194
201
|
|
|
195
202
|
Args:
|
|
196
203
|
serial_number: 10-digit module serial number.
|
|
@@ -206,7 +213,8 @@ class ConbusOutputService:
|
|
|
206
213
|
self.action_type = action_type
|
|
207
214
|
|
|
208
215
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
209
|
-
"""
|
|
216
|
+
"""
|
|
217
|
+
Set operation timeout.
|
|
210
218
|
|
|
211
219
|
Args:
|
|
212
220
|
timeout_seconds: Timeout in seconds.
|