conson-xp 1.45.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.45.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/actiontable/download_state_machine.py +281 -0
- 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 +134 -280
- 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 +140 -21
- 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 +26 -31
- 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.45.0.dist-info/RECORD +0 -210
- 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.45.0.dist-info → conson_xp-1.47.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/licenses/LICENSE +0 -0
xp/cli/utils/formatters.py
CHANGED
|
@@ -8,7 +8,8 @@ class OutputFormatter:
|
|
|
8
8
|
"""Handles standardized output formatting for CLI commands."""
|
|
9
9
|
|
|
10
10
|
def __init__(self, json_output: bool = False):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Initialize the output formatter.
|
|
12
13
|
|
|
13
14
|
Args:
|
|
14
15
|
json_output: Whether to format output as JSON (default: False).
|
|
@@ -16,7 +17,8 @@ class OutputFormatter:
|
|
|
16
17
|
self.json_output = json_output
|
|
17
18
|
|
|
18
19
|
def success_response(self, data: Dict[str, Any]) -> str:
|
|
19
|
-
"""
|
|
20
|
+
"""
|
|
21
|
+
Format a successful response.
|
|
20
22
|
|
|
21
23
|
Args:
|
|
22
24
|
data: Response data to format.
|
|
@@ -31,7 +33,8 @@ class OutputFormatter:
|
|
|
31
33
|
def error_response(
|
|
32
34
|
self, error: str, extra_data: Optional[Dict[str, Any]] = None
|
|
33
35
|
) -> str:
|
|
34
|
-
"""
|
|
36
|
+
"""
|
|
37
|
+
Format an error response.
|
|
35
38
|
|
|
36
39
|
Args:
|
|
37
40
|
error: Error message.
|
|
@@ -49,7 +52,8 @@ class OutputFormatter:
|
|
|
49
52
|
return f"Error: {error}"
|
|
50
53
|
|
|
51
54
|
def validation_response(self, is_valid: bool, data: Dict[str, Any]) -> str:
|
|
52
|
-
"""
|
|
55
|
+
"""
|
|
56
|
+
Format a validation response.
|
|
53
57
|
|
|
54
58
|
Args:
|
|
55
59
|
is_valid: Whether validation passed.
|
|
@@ -66,7 +70,8 @@ class OutputFormatter:
|
|
|
66
70
|
return f"Status: {status}"
|
|
67
71
|
|
|
68
72
|
def checksum_status(self, is_valid: bool) -> str:
|
|
69
|
-
"""
|
|
73
|
+
"""
|
|
74
|
+
Format checksum validation status.
|
|
70
75
|
|
|
71
76
|
Args:
|
|
72
77
|
is_valid: Whether checksum is valid.
|
|
@@ -81,7 +86,8 @@ class OutputFormatter:
|
|
|
81
86
|
|
|
82
87
|
@staticmethod
|
|
83
88
|
def _format_text_response(data: Dict[str, Any]) -> str:
|
|
84
|
-
"""
|
|
89
|
+
"""
|
|
90
|
+
Format data for human-readable text output.
|
|
85
91
|
|
|
86
92
|
Args:
|
|
87
93
|
data: Data dictionary to format.
|
|
@@ -119,7 +125,8 @@ class TelegramFormatter(OutputFormatter):
|
|
|
119
125
|
def format_telegram_summary(
|
|
120
126
|
self, telegram_data: Dict[str, Any], service_formatter_method: Any = None
|
|
121
127
|
) -> str:
|
|
122
|
-
"""
|
|
128
|
+
"""
|
|
129
|
+
Format telegram summary using service method when available.
|
|
123
130
|
|
|
124
131
|
Args:
|
|
125
132
|
telegram_data: Telegram data to format.
|
|
@@ -148,7 +155,8 @@ class TelegramFormatter(OutputFormatter):
|
|
|
148
155
|
def format_validation_result(
|
|
149
156
|
self, parsed_telegram: Any, checksum_valid: Optional[bool], service_summary: str
|
|
150
157
|
) -> str:
|
|
151
|
-
"""
|
|
158
|
+
"""
|
|
159
|
+
Format telegram validation results.
|
|
152
160
|
|
|
153
161
|
Args:
|
|
154
162
|
parsed_telegram: Parsed telegram object.
|
|
@@ -177,7 +185,8 @@ class ListFormatter(OutputFormatter):
|
|
|
177
185
|
def format_list_response(
|
|
178
186
|
self, items: list, title: str, item_formatter: Any = None
|
|
179
187
|
) -> str:
|
|
180
|
-
"""
|
|
188
|
+
"""
|
|
189
|
+
Format a list of items with optional custom formatter.
|
|
181
190
|
|
|
182
191
|
Args:
|
|
183
192
|
items: List of items to format.
|
|
@@ -212,7 +221,8 @@ class ListFormatter(OutputFormatter):
|
|
|
212
221
|
return "\n".join(lines)
|
|
213
222
|
|
|
214
223
|
def format_search_results(self, matches: list, query: str) -> str:
|
|
215
|
-
"""
|
|
224
|
+
"""
|
|
225
|
+
Format search results.
|
|
216
226
|
|
|
217
227
|
Args:
|
|
218
228
|
matches: List of matching items.
|
|
@@ -257,7 +267,8 @@ class StatisticsFormatter(OutputFormatter):
|
|
|
257
267
|
def format_file_statistics(
|
|
258
268
|
self, file_path: str, stats: Dict[str, Any], entry_count: int
|
|
259
269
|
) -> str:
|
|
260
|
-
"""
|
|
270
|
+
"""
|
|
271
|
+
Format file analysis statistics.
|
|
261
272
|
|
|
262
273
|
Args:
|
|
263
274
|
file_path: Path to the analyzed file.
|
|
@@ -8,7 +8,8 @@ from xp.models.telegram.module_type_code import ModuleTypeCode
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ModuleTypeChoice(click.ParamType):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Click parameter type for validating ModuleTypeCode enum values.
|
|
12
13
|
|
|
13
14
|
Attributes:
|
|
14
15
|
name: The parameter type name.
|
|
@@ -24,7 +25,8 @@ class ModuleTypeChoice(click.ParamType):
|
|
|
24
25
|
def convert(
|
|
25
26
|
self, value: Any, param: Optional[click.Parameter], ctx: Optional[click.Context]
|
|
26
27
|
) -> int:
|
|
27
|
-
"""
|
|
28
|
+
"""
|
|
29
|
+
Convert and validate input to ModuleTypeCode value.
|
|
28
30
|
|
|
29
31
|
Args:
|
|
30
32
|
value: The input value to convert.
|
|
@@ -6,7 +6,8 @@ import click
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class SerialNumberParamType(click.ParamType):
|
|
9
|
-
"""
|
|
9
|
+
"""
|
|
10
|
+
Click parameter type for validating and formatting serial numbers.
|
|
10
11
|
|
|
11
12
|
Attributes:
|
|
12
13
|
name: The parameter type name.
|
|
@@ -17,7 +18,8 @@ class SerialNumberParamType(click.ParamType):
|
|
|
17
18
|
def convert(
|
|
18
19
|
self, value: Any, param: Optional[click.Parameter], ctx: Optional[click.Context]
|
|
19
20
|
) -> Optional[str]:
|
|
20
|
-
"""
|
|
21
|
+
"""
|
|
22
|
+
Convert and validate serial number input.
|
|
21
23
|
|
|
22
24
|
Args:
|
|
23
25
|
value: The input value to convert.
|
|
@@ -9,7 +9,8 @@ from xp.models.telegram.system_function import SystemFunction
|
|
|
9
9
|
|
|
10
10
|
# noinspection DuplicatedCode
|
|
11
11
|
class SystemFunctionChoice(click.ParamType):
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
Click parameter type for validating SystemFunction enum values.
|
|
13
14
|
|
|
14
15
|
Attributes:
|
|
15
16
|
name: The parameter type name.
|
|
@@ -25,7 +26,8 @@ class SystemFunctionChoice(click.ParamType):
|
|
|
25
26
|
def convert(
|
|
26
27
|
self, value: Any, param: Optional[click.Parameter], ctx: Optional[click.Context]
|
|
27
28
|
) -> Any:
|
|
28
|
-
"""
|
|
29
|
+
"""
|
|
30
|
+
Convert and validate input to SystemFunction enum.
|
|
29
31
|
|
|
30
32
|
Args:
|
|
31
33
|
value: The input value to convert.
|
xp/cli/utils/xp_module_type.py
CHANGED
|
@@ -6,7 +6,8 @@ import click
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class XpModuleTypeChoice(click.ParamType):
|
|
9
|
-
"""
|
|
9
|
+
"""
|
|
10
|
+
Click parameter type for validating XP module types.
|
|
10
11
|
|
|
11
12
|
Attributes:
|
|
12
13
|
name: The parameter type name.
|
|
@@ -22,7 +23,8 @@ class XpModuleTypeChoice(click.ParamType):
|
|
|
22
23
|
def convert(
|
|
23
24
|
self, value: Any, param: Optional[click.Parameter], ctx: Optional[click.Context]
|
|
24
25
|
) -> Any:
|
|
25
|
-
"""
|
|
26
|
+
"""
|
|
27
|
+
Convert and validate XP module type input.
|
|
26
28
|
|
|
27
29
|
Args:
|
|
28
30
|
value: The input value to convert.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""XP20 Action Table models for input actions and settings."""
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
5
|
from xp.models import ModuleTypeCode
|
|
6
6
|
from xp.models.telegram.input_action_type import InputActionType
|
|
@@ -9,9 +9,9 @@ from xp.models.telegram.timeparam_type import TimeParam
|
|
|
9
9
|
|
|
10
10
|
# CP20 0 0 > 1 OFF;
|
|
11
11
|
# CP20 0 0 > 1 ~ON;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
class ActionTableEntry(BaseModel):
|
|
13
|
+
"""
|
|
14
|
+
Entry in an action table mapping input events to output actions.
|
|
15
15
|
|
|
16
16
|
Attributes:
|
|
17
17
|
module_type: Type code of the module.
|
|
@@ -32,12 +32,12 @@ class ActionTableEntry:
|
|
|
32
32
|
inverted: bool = False
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
class ActionTable(BaseModel):
|
|
36
|
+
"""
|
|
37
|
+
Action Table for managing action on events.
|
|
38
38
|
|
|
39
39
|
Attributes:
|
|
40
40
|
entries: List of action table entries.
|
|
41
41
|
"""
|
|
42
42
|
|
|
43
|
-
entries: list[ActionTableEntry] =
|
|
43
|
+
entries: list[ActionTableEntry] = Field(default_factory=list)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""ActionTable type enumeration."""
|
|
2
|
+
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ActionTableType(str, Enum):
|
|
7
|
+
"""
|
|
8
|
+
ActionTable types for download/upload operations.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
ACTIONTABLE: Standard action table.
|
|
12
|
+
MSACTIONTABLE_XP20: Master station action table (XP20 format).
|
|
13
|
+
MSACTIONTABLE_XP24: Master station action table (XP24 format).
|
|
14
|
+
MSACTIONTABLE_XP33: Master station action table (XP33 format).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
ACTIONTABLE = "actiontable"
|
|
18
|
+
MSACTIONTABLE_XP20 = "msactiontable_xp20"
|
|
19
|
+
MSACTIONTABLE_XP24 = "msactiontable_xp24"
|
|
20
|
+
MSACTIONTABLE_XP33 = "msactiontable_xp33"
|
|
@@ -4,7 +4,8 @@ from pydantic import BaseModel, Field
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class InputChannel(BaseModel):
|
|
7
|
-
"""
|
|
7
|
+
"""
|
|
8
|
+
Configuration for a single input channel in XP20 action table.
|
|
8
9
|
|
|
9
10
|
Attributes:
|
|
10
11
|
invert: Input inversion flag
|
|
@@ -24,7 +25,8 @@ class InputChannel(BaseModel):
|
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class Xp20MsActionTable(BaseModel):
|
|
27
|
-
"""
|
|
28
|
+
"""
|
|
29
|
+
XP20 Action Table for managing 8 input channels.
|
|
28
30
|
|
|
29
31
|
Contains configuration for 8 input channels (input1 through input8),
|
|
30
32
|
each with flags for inversion, short/long press detection, group functions,
|
|
@@ -51,7 +53,8 @@ class Xp20MsActionTable(BaseModel):
|
|
|
51
53
|
input8: InputChannel = Field(default_factory=InputChannel)
|
|
52
54
|
|
|
53
55
|
def to_short_format(self) -> list[str]:
|
|
54
|
-
"""
|
|
56
|
+
"""
|
|
57
|
+
Convert action table to short format string.
|
|
55
58
|
|
|
56
59
|
Returns:
|
|
57
60
|
Short format string with each channel on a separate line.
|
|
@@ -79,7 +82,8 @@ class Xp20MsActionTable(BaseModel):
|
|
|
79
82
|
|
|
80
83
|
@classmethod
|
|
81
84
|
def from_short_format(cls, short_str: list[str]) -> "Xp20MsActionTable":
|
|
82
|
-
"""
|
|
85
|
+
"""
|
|
86
|
+
Parse short format string into action table.
|
|
83
87
|
|
|
84
88
|
Args:
|
|
85
89
|
short_str: Short format string with 8 channel lines.
|
|
@@ -9,7 +9,8 @@ from xp.models.telegram.timeparam_type import TimeParam
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class InputAction(BaseModel):
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
Represents an input action with type and parameter.
|
|
13
14
|
|
|
14
15
|
Attributes:
|
|
15
16
|
model_config: Pydantic configuration to preserve enum objects.
|
|
@@ -27,7 +28,8 @@ class InputAction(BaseModel):
|
|
|
27
28
|
def validate_action_type(
|
|
28
29
|
cls, v: Union[str, int, InputActionType]
|
|
29
30
|
) -> InputActionType:
|
|
30
|
-
"""
|
|
31
|
+
"""
|
|
32
|
+
Convert string or int to InputActionType enum.
|
|
31
33
|
|
|
32
34
|
Args:
|
|
33
35
|
v: Input value (can be string name, int value, or enum).
|
|
@@ -55,7 +57,8 @@ class InputAction(BaseModel):
|
|
|
55
57
|
@field_validator("param", mode="before")
|
|
56
58
|
@classmethod
|
|
57
59
|
def validate_time_param(cls, v: Union[str, int, TimeParam]) -> TimeParam:
|
|
58
|
-
"""
|
|
60
|
+
"""
|
|
61
|
+
Convert string or int to TimeParam enum.
|
|
59
62
|
|
|
60
63
|
Args:
|
|
61
64
|
v: Input value (can be string name, int value, or enum).
|
|
@@ -82,7 +85,8 @@ class InputAction(BaseModel):
|
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
class Xp24MsActionTable(BaseModel):
|
|
85
|
-
"""
|
|
88
|
+
"""
|
|
89
|
+
XP24 Action Table for managing input actions and settings.
|
|
86
90
|
|
|
87
91
|
Each input has an action type (TOGGLE, ON, LEVELSET, etc.)
|
|
88
92
|
with an optional parameter string.
|
|
@@ -159,7 +163,8 @@ class Xp24MsActionTable(BaseModel):
|
|
|
159
163
|
mutual_deadtime: int = MS300 # Master timing (MS300=12 or MS500=20)
|
|
160
164
|
|
|
161
165
|
def to_short_format(self) -> list[str]:
|
|
162
|
-
"""
|
|
166
|
+
"""
|
|
167
|
+
Convert action table to short format string.
|
|
163
168
|
|
|
164
169
|
Returns:
|
|
165
170
|
Short format string with settings (e.g., "XP24 T:1 T:2 T:0 T:0 | M12:0 M34:0 C12:0 C34:0 DT:12").
|
|
@@ -194,7 +199,8 @@ class Xp24MsActionTable(BaseModel):
|
|
|
194
199
|
|
|
195
200
|
@classmethod
|
|
196
201
|
def from_short_format(cls, short_str: list[str]) -> "Xp24MsActionTable":
|
|
197
|
-
"""
|
|
202
|
+
"""
|
|
203
|
+
Parse short format string into action table.
|
|
198
204
|
|
|
199
205
|
Args:
|
|
200
206
|
short_str: Short format string.
|
|
@@ -8,7 +8,8 @@ from xp.models.telegram.timeparam_type import TimeParam
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Xp33Output(BaseModel):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Represents an XP33 output configuration.
|
|
12
13
|
|
|
13
14
|
Attributes:
|
|
14
15
|
min_level: Minimum output level (0-100).
|
|
@@ -26,7 +27,8 @@ class Xp33Output(BaseModel):
|
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
class Xp33Scene(BaseModel):
|
|
29
|
-
"""
|
|
30
|
+
"""
|
|
31
|
+
Represents a scene configuration.
|
|
30
32
|
|
|
31
33
|
Attributes:
|
|
32
34
|
output1_level: Output level for output 1 (0-100).
|
|
@@ -43,7 +45,8 @@ class Xp33Scene(BaseModel):
|
|
|
43
45
|
@field_validator("time", mode="before")
|
|
44
46
|
@classmethod
|
|
45
47
|
def validate_time_param(cls, v: Union[str, int, TimeParam]) -> TimeParam:
|
|
46
|
-
"""
|
|
48
|
+
"""
|
|
49
|
+
Convert string or int to TimeParam enum.
|
|
47
50
|
|
|
48
51
|
Args:
|
|
49
52
|
v: Input value (can be string name, int value, or enum).
|
|
@@ -70,7 +73,8 @@ class Xp33Scene(BaseModel):
|
|
|
70
73
|
|
|
71
74
|
|
|
72
75
|
class Xp33MsActionTable(BaseModel):
|
|
73
|
-
"""
|
|
76
|
+
"""
|
|
77
|
+
XP33 Action Table for managing outputs and scenes.
|
|
74
78
|
|
|
75
79
|
Attributes:
|
|
76
80
|
output1: Configuration for output 1.
|
|
@@ -92,7 +96,8 @@ class Xp33MsActionTable(BaseModel):
|
|
|
92
96
|
scene4: Xp33Scene = Field(default_factory=Xp33Scene)
|
|
93
97
|
|
|
94
98
|
def to_short_format(self) -> list[str]:
|
|
95
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Convert action table to short format string.
|
|
96
101
|
|
|
97
102
|
Returns:
|
|
98
103
|
Short format string (multi-line format with OUT and SCENE lines).
|
|
@@ -122,7 +127,8 @@ class Xp33MsActionTable(BaseModel):
|
|
|
122
127
|
|
|
123
128
|
@classmethod
|
|
124
129
|
def from_short_format(cls, short_str: list[str]) -> "Xp33MsActionTable":
|
|
125
|
-
"""
|
|
130
|
+
"""
|
|
131
|
+
Parse short format string into action table.
|
|
126
132
|
|
|
127
133
|
Args:
|
|
128
134
|
short_str: Short format string (list of lines).
|
|
@@ -205,7 +211,8 @@ class Xp33MsActionTable(BaseModel):
|
|
|
205
211
|
|
|
206
212
|
@staticmethod
|
|
207
213
|
def _format_output(output: Xp33Output) -> str:
|
|
208
|
-
"""
|
|
214
|
+
"""
|
|
215
|
+
Format output configuration to short string.
|
|
209
216
|
|
|
210
217
|
Args:
|
|
211
218
|
output: Xp33Output instance.
|
|
@@ -223,7 +230,8 @@ class Xp33MsActionTable(BaseModel):
|
|
|
223
230
|
|
|
224
231
|
@staticmethod
|
|
225
232
|
def _parse_output(output_str: str) -> Xp33Output:
|
|
226
|
-
"""
|
|
233
|
+
"""
|
|
234
|
+
Parse output configuration from short string.
|
|
227
235
|
|
|
228
236
|
Args:
|
|
229
237
|
output_str: Short string like "MIN:10 MAX:90 SO:1 SF:0 LE:1".
|
|
@@ -277,7 +285,8 @@ class Xp33MsActionTable(BaseModel):
|
|
|
277
285
|
|
|
278
286
|
@staticmethod
|
|
279
287
|
def _format_scene(scene: Xp33Scene) -> str:
|
|
280
|
-
"""
|
|
288
|
+
"""
|
|
289
|
+
Format scene configuration to short string.
|
|
281
290
|
|
|
282
291
|
Args:
|
|
283
292
|
scene: Xp33Scene instance.
|
|
@@ -295,7 +304,8 @@ class Xp33MsActionTable(BaseModel):
|
|
|
295
304
|
|
|
296
305
|
@staticmethod
|
|
297
306
|
def _parse_scene(scene_str: str) -> Xp33Scene:
|
|
298
|
-
"""
|
|
307
|
+
"""
|
|
308
|
+
Parse scene configuration from short string.
|
|
299
309
|
|
|
300
310
|
Args:
|
|
301
311
|
scene_str: Short string like "OUT1:50 OUT2:60 OUT3:70 T:T5SEC".
|
xp/models/conbus/conbus.py
CHANGED
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusRequest:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a Conbus send request.
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
serial_number: Serial number of the target device.
|
|
@@ -29,7 +30,8 @@ class ConbusRequest:
|
|
|
29
30
|
self.timestamp = datetime.now()
|
|
30
31
|
|
|
31
32
|
def to_dict(self) -> Dict[str, Any]:
|
|
32
|
-
"""
|
|
33
|
+
"""
|
|
34
|
+
Convert to dictionary for JSON serialization.
|
|
33
35
|
|
|
34
36
|
Returns:
|
|
35
37
|
Dictionary representation of the request.
|
|
@@ -44,7 +46,8 @@ class ConbusRequest:
|
|
|
44
46
|
|
|
45
47
|
@dataclass
|
|
46
48
|
class ConbusResponse:
|
|
47
|
-
"""
|
|
49
|
+
"""
|
|
50
|
+
Represents a response from Conbus send operation.
|
|
48
51
|
|
|
49
52
|
Attributes:
|
|
50
53
|
success: Whether the operation was successful.
|
|
@@ -71,7 +74,8 @@ class ConbusResponse:
|
|
|
71
74
|
self.received_telegrams = []
|
|
72
75
|
|
|
73
76
|
def to_dict(self) -> Dict[str, Any]:
|
|
74
|
-
"""
|
|
77
|
+
"""
|
|
78
|
+
Convert to dictionary for JSON serialization.
|
|
75
79
|
|
|
76
80
|
Returns:
|
|
77
81
|
Dictionary representation of the response.
|
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusAutoreportResponse:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a response from Conbus auto report operations (get/set).
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
success: Whether the operation was successful.
|
|
@@ -37,7 +38,8 @@ class ConbusAutoreportResponse:
|
|
|
37
38
|
self.received_telegrams = []
|
|
38
39
|
|
|
39
40
|
def to_dict(self) -> Dict[str, Any]:
|
|
40
|
-
"""
|
|
41
|
+
"""
|
|
42
|
+
Convert to dictionary for JSON serialization.
|
|
41
43
|
|
|
42
44
|
Returns:
|
|
43
45
|
Dictionary representation of the response.
|
xp/models/conbus/conbus_blink.py
CHANGED
|
@@ -12,7 +12,8 @@ from xp.models.telegram.system_telegram import SystemTelegram
|
|
|
12
12
|
|
|
13
13
|
@dataclass
|
|
14
14
|
class ConbusBlinkResponse:
|
|
15
|
-
"""
|
|
15
|
+
"""
|
|
16
|
+
Represents a response from Conbus send operation.
|
|
16
17
|
|
|
17
18
|
Attributes:
|
|
18
19
|
success: Whether the operation was successful.
|
|
@@ -46,7 +47,8 @@ class ConbusBlinkResponse:
|
|
|
46
47
|
self.received_telegrams = []
|
|
47
48
|
|
|
48
49
|
def to_dict(self) -> Dict[str, Any]:
|
|
49
|
-
"""
|
|
50
|
+
"""
|
|
51
|
+
Convert to dictionary for JSON serialization.
|
|
50
52
|
|
|
51
53
|
Returns:
|
|
52
54
|
Dictionary representation of the response.
|
|
@@ -8,7 +8,8 @@ from pydantic import BaseModel, Field
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ClientConfig(BaseModel):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Client connection configuration.
|
|
12
13
|
|
|
13
14
|
Attributes:
|
|
14
15
|
ip: IP address of the Conbus server.
|
|
@@ -22,7 +23,8 @@ class ClientConfig(BaseModel):
|
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class ConbusClientConfig(BaseModel):
|
|
25
|
-
"""
|
|
26
|
+
"""
|
|
27
|
+
Configuration for Conbus client connection.
|
|
26
28
|
|
|
27
29
|
Attributes:
|
|
28
30
|
conbus: Client configuration settings.
|
|
@@ -32,7 +34,8 @@ class ConbusClientConfig(BaseModel):
|
|
|
32
34
|
|
|
33
35
|
@classmethod
|
|
34
36
|
def from_yaml(cls, file_path: str) -> "ConbusClientConfig":
|
|
35
|
-
"""
|
|
37
|
+
"""
|
|
38
|
+
Load configuration from YAML file.
|
|
36
39
|
|
|
37
40
|
Args:
|
|
38
41
|
file_path: Path to the YAML configuration file.
|
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusConnectionStatus:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents the current connection status.
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
connected: Whether currently connected.
|
|
@@ -24,7 +25,8 @@ class ConbusConnectionStatus:
|
|
|
24
25
|
error: Optional[str] = None
|
|
25
26
|
|
|
26
27
|
def to_dict(self) -> Dict[str, Any]:
|
|
27
|
-
"""
|
|
28
|
+
"""
|
|
29
|
+
Convert to dictionary for JSON serialization.
|
|
28
30
|
|
|
29
31
|
Returns:
|
|
30
32
|
Dictionary representation of the connection status.
|
|
@@ -9,7 +9,8 @@ from xp.models.telegram.reply_telegram import ReplyTelegram
|
|
|
9
9
|
|
|
10
10
|
@dataclass
|
|
11
11
|
class ConbusCustomResponse:
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
Represents a response from Conbus send operation.
|
|
13
14
|
|
|
14
15
|
Attributes:
|
|
15
16
|
success: Whether the operation was successful.
|
|
@@ -41,7 +42,8 @@ class ConbusCustomResponse:
|
|
|
41
42
|
self.received_telegrams = []
|
|
42
43
|
|
|
43
44
|
def to_dict(self) -> Dict[str, Any]:
|
|
44
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Convert to dictionary for JSON serialization.
|
|
45
47
|
|
|
46
48
|
Returns:
|
|
47
49
|
Dictionary representation of the response.
|
|
@@ -11,7 +11,8 @@ from xp.models.telegram.system_function import SystemFunction
|
|
|
11
11
|
|
|
12
12
|
@dataclass
|
|
13
13
|
class ConbusDatapointResponse:
|
|
14
|
-
"""
|
|
14
|
+
"""
|
|
15
|
+
Represents a response from Conbus send operation.
|
|
15
16
|
|
|
16
17
|
Attributes:
|
|
17
18
|
success: Whether the operation was successful.
|
|
@@ -49,7 +50,8 @@ class ConbusDatapointResponse:
|
|
|
49
50
|
self.datapoints = []
|
|
50
51
|
|
|
51
52
|
def to_dict(self) -> Dict[str, Any]:
|
|
52
|
-
"""
|
|
53
|
+
"""
|
|
54
|
+
Convert to dictionary for JSON serialization.
|
|
53
55
|
|
|
54
56
|
Returns:
|
|
55
57
|
Dictionary representation of the response.
|
|
@@ -6,7 +6,8 @@ from typing import Any, Dict, Optional, TypedDict
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class DiscoveredDevice(TypedDict):
|
|
9
|
-
"""
|
|
9
|
+
"""
|
|
10
|
+
Discovered device information.
|
|
10
11
|
|
|
11
12
|
Attributes:
|
|
12
13
|
serial_number: Serial number of the device.
|
|
@@ -23,7 +24,8 @@ class DiscoveredDevice(TypedDict):
|
|
|
23
24
|
|
|
24
25
|
@dataclass
|
|
25
26
|
class ConbusDiscoverResponse:
|
|
26
|
-
"""
|
|
27
|
+
"""
|
|
28
|
+
Represents a response from Conbus send operation.
|
|
27
29
|
|
|
28
30
|
Attributes:
|
|
29
31
|
success: Whether the operation was successful.
|
|
@@ -49,7 +51,8 @@ class ConbusDiscoverResponse:
|
|
|
49
51
|
self.received_telegrams = []
|
|
50
52
|
|
|
51
53
|
def to_dict(self) -> Dict[str, Any]:
|
|
52
|
-
"""
|
|
54
|
+
"""
|
|
55
|
+
Convert to dictionary for JSON serialization.
|
|
53
56
|
|
|
54
57
|
Returns:
|
|
55
58
|
Dictionary representation of the response.
|
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusEventListResponse:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a response from Conbus event list operation.
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
events: Dict mapping event keys to list of module names.
|
|
@@ -23,7 +24,8 @@ class ConbusEventListResponse:
|
|
|
23
24
|
self.timestamp = datetime.now()
|
|
24
25
|
|
|
25
26
|
def to_dict(self) -> Dict[str, Any]:
|
|
26
|
-
"""
|
|
27
|
+
"""
|
|
28
|
+
Convert to dictionary for JSON serialization.
|
|
27
29
|
|
|
28
30
|
Returns:
|
|
29
31
|
Dictionary representation of the response.
|