conson-xp 1.46.0__py3-none-any.whl → 1.48.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.48.0.dist-info}/METADATA +1 -1
- conson_xp-1.48.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 -19
- 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 +73 -50
- xp/services/actiontable/msactiontable_xp24_serializer.py +73 -54
- xp/services/actiontable/msactiontable_xp33_serializer.py +44 -20
- xp/services/actiontable/serializer_protocol.py +76 -0
- xp/services/conbus/actiontable/actiontable_download_service.py +68 -31
- 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 +18 -10
- 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 +51 -26
- 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.48.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.46.0.dist-info → conson_xp-1.48.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.46.0.dist-info → conson_xp-1.48.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -13,7 +13,8 @@ from xp.models.telegram.telegram_type import TelegramType
|
|
|
13
13
|
|
|
14
14
|
@dataclass
|
|
15
15
|
class EventTelegram(Telegram):
|
|
16
|
-
r"""
|
|
16
|
+
r"""
|
|
17
|
+
Represent a parsed event telegram from the console bus.
|
|
17
18
|
|
|
18
19
|
Format: <[EO]{module_type}L{link_number}I{input_number}{event_type}{checksum}>
|
|
19
20
|
|
|
@@ -46,7 +47,8 @@ class EventTelegram(Telegram):
|
|
|
46
47
|
|
|
47
48
|
@property
|
|
48
49
|
def module_info(self) -> Optional[ModuleType]:
|
|
49
|
-
"""
|
|
50
|
+
"""
|
|
51
|
+
Get module type information for this telegram.
|
|
50
52
|
|
|
51
53
|
Returns:
|
|
52
54
|
ModuleType instance if found, None otherwise.
|
|
@@ -55,7 +57,8 @@ class EventTelegram(Telegram):
|
|
|
55
57
|
|
|
56
58
|
@property
|
|
57
59
|
def input_type(self) -> InputType:
|
|
58
|
-
"""
|
|
60
|
+
"""
|
|
61
|
+
Determines the input type based on input number.
|
|
59
62
|
|
|
60
63
|
Returns:
|
|
61
64
|
InputType enum value.
|
|
@@ -71,7 +74,8 @@ class EventTelegram(Telegram):
|
|
|
71
74
|
|
|
72
75
|
@property
|
|
73
76
|
def is_button_press(self) -> bool:
|
|
74
|
-
"""
|
|
77
|
+
"""
|
|
78
|
+
True if this is a button press event.
|
|
75
79
|
|
|
76
80
|
Returns:
|
|
77
81
|
True if event is a button press, False otherwise.
|
|
@@ -80,7 +84,8 @@ class EventTelegram(Telegram):
|
|
|
80
84
|
|
|
81
85
|
@property
|
|
82
86
|
def is_button_release(self) -> bool:
|
|
83
|
-
"""
|
|
87
|
+
"""
|
|
88
|
+
True if this is a button release event.
|
|
84
89
|
|
|
85
90
|
Returns:
|
|
86
91
|
True if event is a button release, False otherwise.
|
|
@@ -88,7 +93,8 @@ class EventTelegram(Telegram):
|
|
|
88
93
|
return self.event_type == EventType.BUTTON_RELEASE
|
|
89
94
|
|
|
90
95
|
def to_dict(self) -> dict[str, Any]:
|
|
91
|
-
"""
|
|
96
|
+
"""
|
|
97
|
+
Convert to dictionary for JSON serialization.
|
|
92
98
|
|
|
93
99
|
Returns:
|
|
94
100
|
Dictionary representation of the event telegram.
|
|
@@ -122,7 +128,8 @@ class EventTelegram(Telegram):
|
|
|
122
128
|
return result
|
|
123
129
|
|
|
124
130
|
def __str__(self) -> str:
|
|
125
|
-
"""
|
|
131
|
+
"""
|
|
132
|
+
Human-readable string representation.
|
|
126
133
|
|
|
127
134
|
Returns:
|
|
128
135
|
Formatted string representation.
|
xp/models/telegram/event_type.py
CHANGED
xp/models/telegram/input_type.py
CHANGED
|
@@ -8,7 +8,8 @@ from xp.models.telegram.module_type_code import MODULE_TYPE_REGISTRY
|
|
|
8
8
|
|
|
9
9
|
@dataclass
|
|
10
10
|
class ModuleType:
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Represents a module type in the XP system.
|
|
12
13
|
|
|
13
14
|
Contains the module code, name, and description.
|
|
14
15
|
|
|
@@ -30,7 +31,8 @@ class ModuleType:
|
|
|
30
31
|
|
|
31
32
|
@classmethod
|
|
32
33
|
def from_code(cls, code: int) -> Optional["ModuleType"]:
|
|
33
|
-
"""
|
|
34
|
+
"""
|
|
35
|
+
Create ModuleType from a numeric code.
|
|
34
36
|
|
|
35
37
|
Args:
|
|
36
38
|
code: The numeric module type code.
|
|
@@ -45,7 +47,8 @@ class ModuleType:
|
|
|
45
47
|
|
|
46
48
|
@classmethod
|
|
47
49
|
def from_name(cls, name: str) -> Optional["ModuleType"]:
|
|
48
|
-
"""
|
|
50
|
+
"""
|
|
51
|
+
Create ModuleType from a module name.
|
|
49
52
|
|
|
50
53
|
Args:
|
|
51
54
|
name: The module name (case-insensitive).
|
|
@@ -61,7 +64,8 @@ class ModuleType:
|
|
|
61
64
|
|
|
62
65
|
@property
|
|
63
66
|
def is_reserved(self) -> bool:
|
|
64
|
-
"""
|
|
67
|
+
"""
|
|
68
|
+
Check if this module type is reserved.
|
|
65
69
|
|
|
66
70
|
Returns:
|
|
67
71
|
True if module type is reserved, False otherwise.
|
|
@@ -70,7 +74,8 @@ class ModuleType:
|
|
|
70
74
|
|
|
71
75
|
@property
|
|
72
76
|
def is_push_button_panel(self) -> bool:
|
|
73
|
-
"""
|
|
77
|
+
"""
|
|
78
|
+
Check if this module type is a push button panel.
|
|
74
79
|
|
|
75
80
|
Returns:
|
|
76
81
|
True if module is a push button panel, False otherwise.
|
|
@@ -87,7 +92,8 @@ class ModuleType:
|
|
|
87
92
|
|
|
88
93
|
@property
|
|
89
94
|
def is_ir_capable(self) -> bool:
|
|
90
|
-
"""
|
|
95
|
+
"""
|
|
96
|
+
Check if this module type has IR capabilities.
|
|
91
97
|
|
|
92
98
|
Returns:
|
|
93
99
|
True if module has IR capabilities, False otherwise.
|
|
@@ -106,7 +112,8 @@ class ModuleType:
|
|
|
106
112
|
|
|
107
113
|
@property
|
|
108
114
|
def category(self) -> str:
|
|
109
|
-
"""
|
|
115
|
+
"""
|
|
116
|
+
Get the module category based on its type.
|
|
110
117
|
|
|
111
118
|
Returns:
|
|
112
119
|
Module category string.
|
|
@@ -122,7 +129,8 @@ class ModuleType:
|
|
|
122
129
|
return "Unknown"
|
|
123
130
|
|
|
124
131
|
def to_dict(self) -> Dict:
|
|
125
|
-
"""
|
|
132
|
+
"""
|
|
133
|
+
Convert to dictionary for JSON serialization.
|
|
126
134
|
|
|
127
135
|
Returns:
|
|
128
136
|
Dictionary representation of the module type.
|
|
@@ -138,7 +146,8 @@ class ModuleType:
|
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
def __str__(self) -> str:
|
|
141
|
-
"""
|
|
149
|
+
"""
|
|
150
|
+
Return human-readable string representation.
|
|
142
151
|
|
|
143
152
|
Returns:
|
|
144
153
|
Formatted string representation.
|
|
@@ -147,7 +156,8 @@ class ModuleType:
|
|
|
147
156
|
|
|
148
157
|
|
|
149
158
|
def get_all_module_types() -> List[ModuleType]:
|
|
150
|
-
"""
|
|
159
|
+
"""
|
|
160
|
+
Get all available module types.
|
|
151
161
|
|
|
152
162
|
Returns:
|
|
153
163
|
List of all ModuleType instances.
|
|
@@ -162,7 +172,8 @@ def get_all_module_types() -> List[ModuleType]:
|
|
|
162
172
|
|
|
163
173
|
|
|
164
174
|
def get_module_types_by_category() -> Dict[str, List[ModuleType]]:
|
|
165
|
-
"""
|
|
175
|
+
"""
|
|
176
|
+
Get module types grouped by category.
|
|
166
177
|
|
|
167
178
|
Returns:
|
|
168
179
|
Dictionary mapping category names to lists of ModuleType instances.
|
|
@@ -177,7 +188,8 @@ def get_module_types_by_category() -> Dict[str, List[ModuleType]]:
|
|
|
177
188
|
|
|
178
189
|
|
|
179
190
|
def is_valid_module_code(code: int) -> bool:
|
|
180
|
-
"""
|
|
191
|
+
"""
|
|
192
|
+
Check if a module code is valid.
|
|
181
193
|
|
|
182
194
|
Args:
|
|
183
195
|
code: Module code to validate.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
XP output telegram model for console bus communication.
|
|
2
3
|
|
|
3
|
-
XP output telegrams are used for controlling relay inputs on XP modules.
|
|
4
|
-
|
|
5
|
-
Each
|
|
6
|
-
|
|
4
|
+
XP output telegrams are used for controlling relay inputs on XP modules. Each XP24
|
|
5
|
+
module has 4 inputs (0-3) that can be pressed or released. Each XP33 module has 3 inputs
|
|
6
|
+
(0-2) that can be pressed or released. Each XP31 module has 1 inputs (0-0) that can be
|
|
7
|
+
pressed or released.
|
|
7
8
|
"""
|
|
8
9
|
|
|
9
10
|
from dataclasses import dataclass
|
|
@@ -17,7 +18,8 @@ from xp.models.telegram.telegram import Telegram
|
|
|
17
18
|
|
|
18
19
|
@dataclass
|
|
19
20
|
class OutputTelegram(Telegram):
|
|
20
|
-
"""
|
|
21
|
+
"""
|
|
22
|
+
Represent a parsed XP output telegram from the console bus.
|
|
21
23
|
|
|
22
24
|
Format: <S{serial_number}F27D{input:02d}{action}{checksum}>
|
|
23
25
|
Examples: <S0012345008F27D00AAFN>
|
|
@@ -45,7 +47,8 @@ class OutputTelegram(Telegram):
|
|
|
45
47
|
|
|
46
48
|
@property
|
|
47
49
|
def action_description(self) -> str:
|
|
48
|
-
"""
|
|
50
|
+
"""
|
|
51
|
+
Get human-readable action description.
|
|
49
52
|
|
|
50
53
|
Returns:
|
|
51
54
|
Human-readable description of the action.
|
|
@@ -62,7 +65,8 @@ class OutputTelegram(Telegram):
|
|
|
62
65
|
|
|
63
66
|
@property
|
|
64
67
|
def input_description(self) -> str:
|
|
65
|
-
"""
|
|
68
|
+
"""
|
|
69
|
+
Get human-readable input description.
|
|
66
70
|
|
|
67
71
|
Returns:
|
|
68
72
|
Description of the input/output number.
|
|
@@ -70,7 +74,8 @@ class OutputTelegram(Telegram):
|
|
|
70
74
|
return f"Input {self.output_number}"
|
|
71
75
|
|
|
72
76
|
def to_dict(self) -> dict:
|
|
73
|
-
"""
|
|
77
|
+
"""
|
|
78
|
+
Convert to dictionary for JSON serialization.
|
|
74
79
|
|
|
75
80
|
Returns:
|
|
76
81
|
Dictionary representation of the output telegram.
|
|
@@ -91,7 +96,8 @@ class OutputTelegram(Telegram):
|
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
def __str__(self) -> str:
|
|
94
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Return human-readable string representation.
|
|
95
101
|
|
|
96
102
|
Returns:
|
|
97
103
|
Formatted string representation.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Reply telegram model for console bus communication.
|
|
2
3
|
|
|
3
|
-
Reply telegrams are responses to system telegrams, containing the requested data
|
|
4
|
-
|
|
4
|
+
Reply telegrams are responses to system telegrams, containing the requested data like
|
|
5
|
+
temperature readings, status information, etc.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
from dataclasses import dataclass
|
|
@@ -16,7 +17,8 @@ from xp.models.telegram.telegram_type import TelegramType
|
|
|
16
17
|
|
|
17
18
|
@dataclass
|
|
18
19
|
class ReplyTelegram(Telegram):
|
|
19
|
-
"""
|
|
20
|
+
"""
|
|
21
|
+
Represents a parsed reply telegram from the console bus.
|
|
20
22
|
|
|
21
23
|
Format: <R{serial_number}F{function_code}D{data}{checksum}>
|
|
22
24
|
Format: <R{serial_number}F{function_code}D{datapoint_type}{data_value}{checksum}>
|
|
@@ -54,7 +56,8 @@ class ReplyTelegram(Telegram):
|
|
|
54
56
|
|
|
55
57
|
@property
|
|
56
58
|
def parse_datapoint_value(self) -> dict[str, Any]:
|
|
57
|
-
"""
|
|
59
|
+
"""
|
|
60
|
+
Parse the data value based on data point type.
|
|
58
61
|
|
|
59
62
|
Returns:
|
|
60
63
|
Dictionary containing parsed value and metadata.
|
|
@@ -74,7 +77,8 @@ class ReplyTelegram(Telegram):
|
|
|
74
77
|
return {"raw_value": self.data_value, "parsed": False}
|
|
75
78
|
|
|
76
79
|
def _parse_temperature_value(self) -> dict:
|
|
77
|
-
"""
|
|
80
|
+
"""
|
|
81
|
+
Parse temperature value like '+26,0§C'.
|
|
78
82
|
|
|
79
83
|
Returns:
|
|
80
84
|
Dictionary containing parsed temperature value and metadata.
|
|
@@ -101,7 +105,8 @@ class ReplyTelegram(Telegram):
|
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
def _parse_humidity_value(self) -> dict:
|
|
104
|
-
"""
|
|
108
|
+
"""
|
|
109
|
+
Parse humidity value like '+65,5§H'.
|
|
105
110
|
|
|
106
111
|
Returns:
|
|
107
112
|
Dictionary containing parsed humidity value and metadata.
|
|
@@ -128,7 +133,8 @@ class ReplyTelegram(Telegram):
|
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
def _parse_voltage_value(self) -> dict:
|
|
131
|
-
"""
|
|
136
|
+
"""
|
|
137
|
+
Parse voltage value like '+12,5§V'.
|
|
132
138
|
|
|
133
139
|
Returns:
|
|
134
140
|
Dictionary containing parsed voltage value and metadata.
|
|
@@ -155,7 +161,8 @@ class ReplyTelegram(Telegram):
|
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
def _parse_current_value(self) -> dict:
|
|
158
|
-
"""
|
|
164
|
+
"""
|
|
165
|
+
Parse current value like '+0,25§A'.
|
|
159
166
|
|
|
160
167
|
Returns:
|
|
161
168
|
Dictionary containing parsed current value and metadata.
|
|
@@ -182,7 +189,8 @@ class ReplyTelegram(Telegram):
|
|
|
182
189
|
}
|
|
183
190
|
|
|
184
191
|
def _parse_module_type_value(self) -> dict:
|
|
185
|
-
"""
|
|
192
|
+
"""
|
|
193
|
+
Parse status value.
|
|
186
194
|
|
|
187
195
|
Returns:
|
|
188
196
|
Dictionary containing parsed module type value.
|
|
@@ -195,7 +203,8 @@ class ReplyTelegram(Telegram):
|
|
|
195
203
|
}
|
|
196
204
|
|
|
197
205
|
def _parse_sw_version_value(self) -> dict:
|
|
198
|
-
"""
|
|
206
|
+
"""
|
|
207
|
+
Parse version value like 'XP230_V1.00.04'.
|
|
199
208
|
|
|
200
209
|
Returns:
|
|
201
210
|
Dictionary containing parsed version information.
|
|
@@ -235,7 +244,8 @@ class ReplyTelegram(Telegram):
|
|
|
235
244
|
}
|
|
236
245
|
|
|
237
246
|
def to_dict(self) -> dict[str, Any]:
|
|
238
|
-
"""
|
|
247
|
+
"""
|
|
248
|
+
Convert to dictionary for JSON serialization.
|
|
239
249
|
|
|
240
250
|
Returns:
|
|
241
251
|
Dictionary representation of the reply telegram.
|
|
@@ -275,7 +285,8 @@ class ReplyTelegram(Telegram):
|
|
|
275
285
|
}
|
|
276
286
|
|
|
277
287
|
def __str__(self) -> str:
|
|
278
|
-
"""
|
|
288
|
+
"""
|
|
289
|
+
Human-readable string representation.
|
|
279
290
|
|
|
280
291
|
Returns:
|
|
281
292
|
Formatted string representation.
|
|
@@ -5,7 +5,8 @@ from typing import Optional
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class SystemFunction(str, Enum):
|
|
8
|
-
"""
|
|
8
|
+
"""
|
|
9
|
+
System function codes for system telegrams.
|
|
9
10
|
|
|
10
11
|
Attributes:
|
|
11
12
|
NONE: Undefined function.
|
|
@@ -76,7 +77,8 @@ class SystemFunction(str, Enum):
|
|
|
76
77
|
ACTION = "27" # F27D Action function
|
|
77
78
|
|
|
78
79
|
def get_description(self) -> str:
|
|
79
|
-
"""
|
|
80
|
+
"""
|
|
81
|
+
Get the description of the SystemFunction.
|
|
80
82
|
|
|
81
83
|
Returns:
|
|
82
84
|
Human-readable description of the function.
|
|
@@ -102,7 +104,8 @@ class SystemFunction(str, Enum):
|
|
|
102
104
|
|
|
103
105
|
@classmethod
|
|
104
106
|
def from_code(cls, code: str) -> Optional["SystemFunction"]:
|
|
105
|
-
"""
|
|
107
|
+
"""
|
|
108
|
+
Get SystemFunction from code string.
|
|
106
109
|
|
|
107
110
|
Args:
|
|
108
111
|
code: Function code string.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
System telegram model for console bus communication.
|
|
2
3
|
|
|
3
|
-
System telegrams are used for system-related information like updating firmware
|
|
4
|
-
|
|
4
|
+
System telegrams are used for system-related information like updating firmware and
|
|
5
|
+
reading temperature from modules.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
from dataclasses import dataclass
|
|
@@ -16,7 +17,8 @@ from xp.models.telegram.telegram_type import TelegramType
|
|
|
16
17
|
|
|
17
18
|
@dataclass
|
|
18
19
|
class SystemTelegram(Telegram):
|
|
19
|
-
"""
|
|
20
|
+
"""
|
|
21
|
+
Represents a parsed system telegram from the console bus.
|
|
20
22
|
|
|
21
23
|
Format: <S{serial_number}F{function_code}D{datapoint_type}{checksum}>
|
|
22
24
|
Examples: <S0020012521F02D18FN>
|
|
@@ -40,7 +42,8 @@ class SystemTelegram(Telegram):
|
|
|
40
42
|
self.telegram_type = TelegramType.SYSTEM
|
|
41
43
|
|
|
42
44
|
def to_dict(self) -> dict[str, Any]:
|
|
43
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Convert to dictionary for JSON serialization.
|
|
44
47
|
|
|
45
48
|
Returns:
|
|
46
49
|
Dictionary representation of the system telegram.
|
|
@@ -77,7 +80,8 @@ class SystemTelegram(Telegram):
|
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
def __str__(self) -> str:
|
|
80
|
-
"""
|
|
83
|
+
"""
|
|
84
|
+
Human-readable string representation.
|
|
81
85
|
|
|
82
86
|
Returns:
|
|
83
87
|
Formatted string representation.
|
xp/models/telegram/telegram.py
CHANGED
|
@@ -9,7 +9,8 @@ from xp.models.telegram.telegram_type import TelegramType
|
|
|
9
9
|
|
|
10
10
|
@dataclass
|
|
11
11
|
class Telegram:
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
Represents an abstract telegram from the console bus.
|
|
13
14
|
|
|
14
15
|
Can be an EventTelegram, SystemTelegram or ReplyTelegram.
|
|
15
16
|
|
|
@@ -6,7 +6,8 @@ from xp.utils.state_machine import StateMachine
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class ConnectionState(str, Enum):
|
|
9
|
-
"""
|
|
9
|
+
"""
|
|
10
|
+
Connection state enumeration.
|
|
10
11
|
|
|
11
12
|
Attributes:
|
|
12
13
|
DISCONNECTING: Disconnecting to server.
|
|
@@ -24,7 +25,8 @@ class ConnectionState(str, Enum):
|
|
|
24
25
|
|
|
25
26
|
@staticmethod
|
|
26
27
|
def create_state_machine() -> StateMachine:
|
|
27
|
-
"""
|
|
28
|
+
"""
|
|
29
|
+
Create and configure state machine for connection management.
|
|
28
30
|
|
|
29
31
|
Returns:
|
|
30
32
|
Configured StateMachine with connection state transitions.
|
xp/models/term/module_state.py
CHANGED
|
@@ -8,7 +8,8 @@ from pydantic import BaseModel, Field
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ProtocolKeyConfig(BaseModel):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Configuration for a single protocol key.
|
|
12
13
|
|
|
13
14
|
Attributes:
|
|
14
15
|
name: Human-readable command name.
|
|
@@ -20,7 +21,8 @@ class ProtocolKeyConfig(BaseModel):
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class ProtocolKeysConfig(BaseModel):
|
|
23
|
-
"""
|
|
24
|
+
"""
|
|
25
|
+
Protocol keys configuration.
|
|
24
26
|
|
|
25
27
|
Attributes:
|
|
26
28
|
protocol: Dictionary mapping key to protocol configuration.
|
|
@@ -32,7 +34,8 @@ class ProtocolKeysConfig(BaseModel):
|
|
|
32
34
|
|
|
33
35
|
@classmethod
|
|
34
36
|
def from_yaml(cls, config_path: Path) -> "ProtocolKeysConfig":
|
|
35
|
-
"""
|
|
37
|
+
"""
|
|
38
|
+
Load protocol keys from YAML file.
|
|
36
39
|
|
|
37
40
|
Args:
|
|
38
41
|
config_path: Path to YAML configuration file.
|
xp/models/term/status_message.py
CHANGED
|
@@ -6,7 +6,8 @@ from typing import Literal, Optional
|
|
|
6
6
|
|
|
7
7
|
@dataclass
|
|
8
8
|
class TelegramDisplayEvent:
|
|
9
|
-
"""
|
|
9
|
+
"""
|
|
10
|
+
Event containing telegram data for display in TUI.
|
|
10
11
|
|
|
11
12
|
Attributes:
|
|
12
13
|
direction: Direction of telegram ("RX" for received, "TX" for transmitted).
|
xp/models/write_config_type.py
CHANGED
|
@@ -5,7 +5,8 @@ from typing import Optional
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class WriteConfigType(str, Enum):
|
|
8
|
-
"""
|
|
8
|
+
"""
|
|
9
|
+
Write Config types for system telegrams.
|
|
9
10
|
|
|
10
11
|
Attributes:
|
|
11
12
|
LINK_NUMBER: Link number configuration (code 04).
|
|
@@ -19,7 +20,8 @@ class WriteConfigType(str, Enum):
|
|
|
19
20
|
|
|
20
21
|
@classmethod
|
|
21
22
|
def from_code(cls, code: str) -> Optional["WriteConfigType"]:
|
|
22
|
-
"""
|
|
23
|
+
"""
|
|
24
|
+
Get WriteConfigType from code string.
|
|
23
25
|
|
|
24
26
|
Args:
|
|
25
27
|
code: Configuration type code string.
|