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 Raw Service for sending raw telegram sequences.
|
|
2
3
|
|
|
3
4
|
This service handles sending raw telegram strings without prior validation.
|
|
4
5
|
"""
|
|
@@ -35,7 +36,8 @@ class ConbusRawService:
|
|
|
35
36
|
self,
|
|
36
37
|
conbus_protocol: ConbusEventProtocol,
|
|
37
38
|
) -> None:
|
|
38
|
-
"""
|
|
39
|
+
"""
|
|
40
|
+
Initialize the Conbus raw service.
|
|
39
41
|
|
|
40
42
|
Args:
|
|
41
43
|
conbus_protocol: ConbusEventProtocol instance.
|
|
@@ -62,7 +64,8 @@ class ConbusRawService:
|
|
|
62
64
|
self.conbus_protocol.send_raw_telegram(self.raw_input)
|
|
63
65
|
|
|
64
66
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
65
|
-
"""
|
|
67
|
+
"""
|
|
68
|
+
Handle telegram sent event.
|
|
66
69
|
|
|
67
70
|
Args:
|
|
68
71
|
telegram_sent: The telegram that was sent.
|
|
@@ -73,7 +76,8 @@ class ConbusRawService:
|
|
|
73
76
|
self.service_response.received_telegrams = []
|
|
74
77
|
|
|
75
78
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
76
|
-
"""
|
|
79
|
+
"""
|
|
80
|
+
Handle telegram received event.
|
|
77
81
|
|
|
78
82
|
Args:
|
|
79
83
|
telegram_received: The telegram received event.
|
|
@@ -92,7 +96,8 @@ class ConbusRawService:
|
|
|
92
96
|
self.on_finish.emit(self.service_response)
|
|
93
97
|
|
|
94
98
|
def failed(self, message: str) -> None:
|
|
95
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Handle failed connection event.
|
|
96
101
|
|
|
97
102
|
Args:
|
|
98
103
|
message: Failure message.
|
|
@@ -108,7 +113,8 @@ class ConbusRawService:
|
|
|
108
113
|
raw_input: str,
|
|
109
114
|
timeout_seconds: Optional[float] = None,
|
|
110
115
|
) -> None:
|
|
111
|
-
"""
|
|
116
|
+
"""
|
|
117
|
+
Send a raw telegram string to the Conbus server.
|
|
112
118
|
|
|
113
119
|
Args:
|
|
114
120
|
raw_input: Raw telegram string to send.
|
|
@@ -120,7 +126,8 @@ class ConbusRawService:
|
|
|
120
126
|
self.raw_input = raw_input
|
|
121
127
|
|
|
122
128
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
123
|
-
"""
|
|
129
|
+
"""
|
|
130
|
+
Set operation timeout.
|
|
124
131
|
|
|
125
132
|
Args:
|
|
126
133
|
timeout_seconds: Timeout in seconds.
|
|
@@ -136,7 +143,8 @@ class ConbusRawService:
|
|
|
136
143
|
self.conbus_protocol.stop_reactor()
|
|
137
144
|
|
|
138
145
|
def __enter__(self) -> "ConbusRawService":
|
|
139
|
-
"""
|
|
146
|
+
"""
|
|
147
|
+
Enter context manager.
|
|
140
148
|
|
|
141
149
|
Returns:
|
|
142
150
|
Self for context manager protocol.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Receive Service for receiving telegrams from Conbus servers.
|
|
2
3
|
|
|
3
|
-
This service uses ConbusEventProtocol to provide receive-only functionality,
|
|
4
|
-
|
|
4
|
+
This service uses ConbusEventProtocol to provide receive-only functionality, allowing
|
|
5
|
+
clients to receive waiting event telegrams using empty telegram sends.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
import asyncio
|
|
@@ -33,7 +34,8 @@ class ConbusReceiveService:
|
|
|
33
34
|
on_finish: Signal = Signal(ConbusReceiveResponse)
|
|
34
35
|
|
|
35
36
|
def __init__(self, conbus_protocol: ConbusEventProtocol) -> None:
|
|
36
|
-
"""
|
|
37
|
+
"""
|
|
38
|
+
Initialize the Conbus receive service.
|
|
37
39
|
|
|
38
40
|
Args:
|
|
39
41
|
conbus_protocol: ConbusEventProtocol instance.
|
|
@@ -57,7 +59,8 @@ class ConbusReceiveService:
|
|
|
57
59
|
self.logger.debug("Connection established, waiting for telegrams.")
|
|
58
60
|
|
|
59
61
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
60
|
-
"""
|
|
62
|
+
"""
|
|
63
|
+
Handle telegram sent event.
|
|
61
64
|
|
|
62
65
|
Args:
|
|
63
66
|
telegram_sent: The telegram that was sent.
|
|
@@ -65,7 +68,8 @@ class ConbusReceiveService:
|
|
|
65
68
|
pass
|
|
66
69
|
|
|
67
70
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
68
|
-
"""
|
|
71
|
+
"""
|
|
72
|
+
Handle telegram received event.
|
|
69
73
|
|
|
70
74
|
Args:
|
|
71
75
|
telegram_received: The telegram received event.
|
|
@@ -85,7 +89,8 @@ class ConbusReceiveService:
|
|
|
85
89
|
self.on_finish.emit(self.receive_response)
|
|
86
90
|
|
|
87
91
|
def failed(self, message: str) -> None:
|
|
88
|
-
"""
|
|
92
|
+
"""
|
|
93
|
+
Handle failed connection event.
|
|
89
94
|
|
|
90
95
|
Args:
|
|
91
96
|
message: Failure message.
|
|
@@ -96,7 +101,8 @@ class ConbusReceiveService:
|
|
|
96
101
|
self.on_finish.emit(self.receive_response)
|
|
97
102
|
|
|
98
103
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
99
|
-
"""
|
|
104
|
+
"""
|
|
105
|
+
Setup callbacks and timeout for receiving telegrams.
|
|
100
106
|
|
|
101
107
|
Args:
|
|
102
108
|
timeout_seconds: Optional timeout in seconds.
|
|
@@ -108,7 +114,8 @@ class ConbusReceiveService:
|
|
|
108
114
|
self,
|
|
109
115
|
event_loop: asyncio.AbstractEventLoop,
|
|
110
116
|
) -> None:
|
|
111
|
-
"""
|
|
117
|
+
"""
|
|
118
|
+
Setup callbacks and timeout for receiving telegrams.
|
|
112
119
|
|
|
113
120
|
Args:
|
|
114
121
|
event_loop: Optional event loop to use for async operations.
|
|
@@ -125,7 +132,8 @@ class ConbusReceiveService:
|
|
|
125
132
|
self.conbus_protocol.stop_reactor()
|
|
126
133
|
|
|
127
134
|
def __enter__(self) -> "ConbusReceiveService":
|
|
128
|
-
"""
|
|
135
|
+
"""
|
|
136
|
+
Enter context manager.
|
|
129
137
|
|
|
130
138
|
Returns:
|
|
131
139
|
Self for context manager protocol.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Scan Service for TCP communication with Conbus servers.
|
|
2
3
|
|
|
3
|
-
This service implements a TCP client that scans Conbus servers and sends
|
|
4
|
-
|
|
4
|
+
This service implements a TCP client that scans Conbus servers and sends telegrams to
|
|
5
|
+
scan modules for all datapoints by function code.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
import logging
|
|
@@ -35,7 +36,8 @@ class ConbusScanService:
|
|
|
35
36
|
self,
|
|
36
37
|
conbus_protocol: ConbusEventProtocol,
|
|
37
38
|
) -> None:
|
|
38
|
-
"""
|
|
39
|
+
"""
|
|
40
|
+
Initialize the Conbus scan service.
|
|
39
41
|
|
|
40
42
|
Args:
|
|
41
43
|
conbus_protocol: ConbusEventProtocol instance.
|
|
@@ -66,7 +68,8 @@ class ConbusScanService:
|
|
|
66
68
|
self.scan_next_datacode()
|
|
67
69
|
|
|
68
70
|
def scan_next_datacode(self) -> bool:
|
|
69
|
-
"""
|
|
71
|
+
"""
|
|
72
|
+
Scan the next data code.
|
|
70
73
|
|
|
71
74
|
Returns:
|
|
72
75
|
True if scanning should continue, False if complete.
|
|
@@ -83,7 +86,8 @@ class ConbusScanService:
|
|
|
83
86
|
return True
|
|
84
87
|
|
|
85
88
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
86
|
-
"""
|
|
89
|
+
"""
|
|
90
|
+
Handle telegram sent event.
|
|
87
91
|
|
|
88
92
|
Args:
|
|
89
93
|
telegram_sent: The telegram that was sent.
|
|
@@ -92,7 +96,8 @@ class ConbusScanService:
|
|
|
92
96
|
self.service_response.sent_telegrams.append(telegram_sent)
|
|
93
97
|
|
|
94
98
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
95
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Handle telegram received event.
|
|
96
101
|
|
|
97
102
|
Args:
|
|
98
103
|
telegram_received: The telegram received event.
|
|
@@ -111,7 +116,8 @@ class ConbusScanService:
|
|
|
111
116
|
self.scan_next_datacode()
|
|
112
117
|
|
|
113
118
|
def failed(self, message: str) -> None:
|
|
114
|
-
"""
|
|
119
|
+
"""
|
|
120
|
+
Handle failed connection event.
|
|
115
121
|
|
|
116
122
|
Args:
|
|
117
123
|
message: Failure message.
|
|
@@ -128,7 +134,8 @@ class ConbusScanService:
|
|
|
128
134
|
function_code: str,
|
|
129
135
|
timeout_seconds: float = 0.25,
|
|
130
136
|
) -> None:
|
|
131
|
-
"""
|
|
137
|
+
"""
|
|
138
|
+
Scan a module for all datapoints by function code.
|
|
132
139
|
|
|
133
140
|
Args:
|
|
134
141
|
serial_number: 10-digit module serial number.
|
|
@@ -143,7 +150,8 @@ class ConbusScanService:
|
|
|
143
150
|
self.function_code = function_code
|
|
144
151
|
|
|
145
152
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
146
|
-
"""
|
|
153
|
+
"""
|
|
154
|
+
Set operation timeout.
|
|
147
155
|
|
|
148
156
|
Args:
|
|
149
157
|
timeout_seconds: Timeout in seconds.
|
|
@@ -29,7 +29,8 @@ class MsActionTableUploadError(Exception):
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class MsActionTableUploadService:
|
|
32
|
-
"""
|
|
32
|
+
"""
|
|
33
|
+
TCP client service for uploading MS action tables to Conbus modules.
|
|
33
34
|
|
|
34
35
|
Manages TCP socket connections, handles telegram generation and transmission,
|
|
35
36
|
and processes server responses for MS action table uploads.
|
|
@@ -53,7 +54,8 @@ class MsActionTableUploadService:
|
|
|
53
54
|
telegram_service: TelegramService,
|
|
54
55
|
conson_config: ConsonModuleListConfig,
|
|
55
56
|
) -> None:
|
|
56
|
-
"""
|
|
57
|
+
"""
|
|
58
|
+
Initialize the MS action table upload service.
|
|
57
59
|
|
|
58
60
|
Args:
|
|
59
61
|
conbus_protocol: ConbusEventProtocol for communication.
|
|
@@ -104,7 +106,8 @@ class MsActionTableUploadService:
|
|
|
104
106
|
)
|
|
105
107
|
|
|
106
108
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
107
|
-
"""
|
|
109
|
+
"""
|
|
110
|
+
Handle telegram sent event.
|
|
108
111
|
|
|
109
112
|
Args:
|
|
110
113
|
telegram_sent: The telegram that was sent.
|
|
@@ -112,7 +115,8 @@ class MsActionTableUploadService:
|
|
|
112
115
|
self.logger.debug(f"Telegram sent: {telegram_sent}")
|
|
113
116
|
|
|
114
117
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
115
|
-
"""
|
|
118
|
+
"""
|
|
119
|
+
Handle telegram received event.
|
|
116
120
|
|
|
117
121
|
Args:
|
|
118
122
|
telegram_received: The telegram received event.
|
|
@@ -133,7 +137,8 @@ class MsActionTableUploadService:
|
|
|
133
137
|
self._handle_upload_response(reply_telegram)
|
|
134
138
|
|
|
135
139
|
def _handle_upload_response(self, reply_telegram: Any) -> None:
|
|
136
|
-
"""
|
|
140
|
+
"""
|
|
141
|
+
Handle telegram responses during upload.
|
|
137
142
|
|
|
138
143
|
Args:
|
|
139
144
|
reply_telegram: Parsed reply telegram.
|
|
@@ -174,7 +179,8 @@ class MsActionTableUploadService:
|
|
|
174
179
|
self.failed("Upload timeout")
|
|
175
180
|
|
|
176
181
|
def failed(self, message: str) -> None:
|
|
177
|
-
"""
|
|
182
|
+
"""
|
|
183
|
+
Handle failed connection event.
|
|
178
184
|
|
|
179
185
|
Args:
|
|
180
186
|
message: Failure message.
|
|
@@ -188,7 +194,8 @@ class MsActionTableUploadService:
|
|
|
188
194
|
xpmoduletype: str,
|
|
189
195
|
timeout_seconds: Optional[float] = None,
|
|
190
196
|
) -> None:
|
|
191
|
-
"""
|
|
197
|
+
"""
|
|
198
|
+
Upload MS action table to module.
|
|
192
199
|
|
|
193
200
|
Uploads the MS action table configuration to the specified module.
|
|
194
201
|
|
|
@@ -273,14 +280,15 @@ class MsActionTableUploadService:
|
|
|
273
280
|
return
|
|
274
281
|
|
|
275
282
|
# Serialize to telegram data (68 characters: AAAA + 64 data chars)
|
|
276
|
-
self.upload_data = self.serializer.
|
|
283
|
+
self.upload_data = self.serializer.to_encoded_string(msactiontable) # type: ignore[arg-type]
|
|
277
284
|
|
|
278
285
|
self.logger.debug(
|
|
279
286
|
f"Upload data encoded: {len(self.upload_data)} chars (single chunk)"
|
|
280
287
|
)
|
|
281
288
|
|
|
282
289
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
283
|
-
"""
|
|
290
|
+
"""
|
|
291
|
+
Set operation timeout.
|
|
284
292
|
|
|
285
293
|
Args:
|
|
286
294
|
timeout_seconds: Timeout in seconds.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conbus Link Number Service for setting module link numbers.
|
|
2
3
|
|
|
3
4
|
This service handles setting link numbers for modules through Conbus telegrams.
|
|
4
5
|
"""
|
|
@@ -19,7 +20,8 @@ from xp.services.telegram.telegram_service import TelegramService
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class WriteConfigService:
|
|
22
|
-
"""
|
|
23
|
+
"""
|
|
24
|
+
Service for writing module settings via Conbus telegrams.
|
|
23
25
|
|
|
24
26
|
Handles setting assignment by sending F04DXX telegrams and processing
|
|
25
27
|
ACK/NAK responses from modules.
|
|
@@ -37,7 +39,8 @@ class WriteConfigService:
|
|
|
37
39
|
conbus_protocol: ConbusEventProtocol,
|
|
38
40
|
telegram_service: TelegramService,
|
|
39
41
|
) -> None:
|
|
40
|
-
"""
|
|
42
|
+
"""
|
|
43
|
+
Initialize the Conbus link number set service.
|
|
41
44
|
|
|
42
45
|
Args:
|
|
43
46
|
conbus_protocol: Protocol for Conbus communication.
|
|
@@ -94,7 +97,8 @@ class WriteConfigService:
|
|
|
94
97
|
)
|
|
95
98
|
|
|
96
99
|
def telegram_sent(self, telegram_sent: str) -> None:
|
|
97
|
-
"""
|
|
100
|
+
"""
|
|
101
|
+
Handle telegram sent event.
|
|
98
102
|
|
|
99
103
|
Args:
|
|
100
104
|
telegram_sent: The telegram that was sent.
|
|
@@ -102,7 +106,8 @@ class WriteConfigService:
|
|
|
102
106
|
self.write_config_response.sent_telegram = telegram_sent
|
|
103
107
|
|
|
104
108
|
def telegram_received(self, telegram_received: TelegramReceivedEvent) -> None:
|
|
105
|
-
"""
|
|
109
|
+
"""
|
|
110
|
+
Handle telegram received event.
|
|
106
111
|
|
|
107
112
|
Args:
|
|
108
113
|
telegram_received: The telegram received event.
|
|
@@ -146,7 +151,8 @@ class WriteConfigService:
|
|
|
146
151
|
self.finished(succeed_or_failed=False, message="Timeout")
|
|
147
152
|
|
|
148
153
|
def failed(self, message: str) -> None:
|
|
149
|
-
"""
|
|
154
|
+
"""
|
|
155
|
+
Handle telegram failed event.
|
|
150
156
|
|
|
151
157
|
Args:
|
|
152
158
|
message: The error message.
|
|
@@ -160,7 +166,8 @@ class WriteConfigService:
|
|
|
160
166
|
message: Optional[str] = None,
|
|
161
167
|
system_function: Optional[SystemFunction] = None,
|
|
162
168
|
) -> None:
|
|
163
|
-
"""
|
|
169
|
+
"""
|
|
170
|
+
Handle successful link number set operation.
|
|
164
171
|
|
|
165
172
|
Args:
|
|
166
173
|
succeed_or_failed: succeed true, failed false.
|
|
@@ -186,7 +193,8 @@ class WriteConfigService:
|
|
|
186
193
|
data_value: str,
|
|
187
194
|
timeout_seconds: Optional[float] = None,
|
|
188
195
|
) -> None:
|
|
189
|
-
"""
|
|
196
|
+
"""
|
|
197
|
+
Write config to a specific module.
|
|
190
198
|
|
|
191
199
|
Args:
|
|
192
200
|
serial_number: 10-digit module serial number.
|
|
@@ -202,7 +210,8 @@ class WriteConfigService:
|
|
|
202
210
|
self.data_value = data_value
|
|
203
211
|
|
|
204
212
|
def set_timeout(self, timeout_seconds: float) -> None:
|
|
205
|
-
"""
|
|
213
|
+
"""
|
|
214
|
+
Set operation timeout.
|
|
206
215
|
|
|
207
216
|
Args:
|
|
208
217
|
timeout_seconds: Timeout in seconds.
|
|
@@ -22,7 +22,8 @@ CACHE_FILE = CACHE_DIR / "homekit_cache.json"
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class CacheEntry(TypedDict):
|
|
25
|
-
"""
|
|
25
|
+
"""
|
|
26
|
+
Cache entry type definition.
|
|
26
27
|
|
|
27
28
|
Attributes:
|
|
28
29
|
event: The cached event (OutputStateReceivedEvent or LightLevelReceivedEvent).
|
|
@@ -44,7 +45,8 @@ class HomeKitCacheService:
|
|
|
44
45
|
"""
|
|
45
46
|
|
|
46
47
|
def __init__(self, event_bus: EventBus, enable_persistence: bool = True):
|
|
47
|
-
"""
|
|
48
|
+
"""
|
|
49
|
+
Initialize the HomeKit cache service.
|
|
48
50
|
|
|
49
51
|
Args:
|
|
50
52
|
event_bus: Event bus for inter-service communication.
|
|
@@ -203,7 +205,8 @@ class HomeKitCacheService:
|
|
|
203
205
|
return None
|
|
204
206
|
|
|
205
207
|
def handle_read_datapoint_event(self, event: ReadDatapointEvent) -> None:
|
|
206
|
-
"""
|
|
208
|
+
"""
|
|
209
|
+
Handle ReadDatapointEvent by checking cache or refresh flag.
|
|
207
210
|
|
|
208
211
|
On refresh_cache=True: invalidate cache and force protocol query
|
|
209
212
|
On cache hit: dispatch cached response event
|
|
@@ -263,7 +266,8 @@ class HomeKitCacheService:
|
|
|
263
266
|
def handle_output_state_received_event(
|
|
264
267
|
self, event: OutputStateReceivedEvent
|
|
265
268
|
) -> None:
|
|
266
|
-
"""
|
|
269
|
+
"""
|
|
270
|
+
Cache OutputStateReceivedEvent for future queries.
|
|
267
271
|
|
|
268
272
|
Args:
|
|
269
273
|
event: Output state received event to cache.
|
|
@@ -277,7 +281,8 @@ class HomeKitCacheService:
|
|
|
277
281
|
self._cache_event(event)
|
|
278
282
|
|
|
279
283
|
def handle_light_level_received_event(self, event: LightLevelReceivedEvent) -> None:
|
|
280
|
-
"""
|
|
284
|
+
"""
|
|
285
|
+
Cache LightLevelReceivedEvent for future queries.
|
|
281
286
|
|
|
282
287
|
Args:
|
|
283
288
|
event: Light level received event to cache.
|
|
@@ -297,7 +302,8 @@ class HomeKitCacheService:
|
|
|
297
302
|
self._save_cache()
|
|
298
303
|
|
|
299
304
|
def get_cache_stats(self) -> dict[str, int]:
|
|
300
|
-
"""
|
|
305
|
+
"""
|
|
306
|
+
Get cache statistics.
|
|
301
307
|
|
|
302
308
|
Returns:
|
|
303
309
|
Dictionary with cache statistics including total_entries.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Conbus Service for protocol communication.
|
|
2
3
|
|
|
3
4
|
This module bridges HomeKit events with the Conbus protocol for device control.
|
|
4
5
|
"""
|
|
@@ -18,7 +19,8 @@ from xp.services.protocol.telegram_protocol import TelegramProtocol
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class HomeKitConbusService:
|
|
21
|
-
"""
|
|
22
|
+
"""
|
|
23
|
+
Service for bridging HomeKit events with Conbus protocol.
|
|
22
24
|
|
|
23
25
|
Attributes:
|
|
24
26
|
event_bus: Event bus for inter-service communication.
|
|
@@ -29,7 +31,8 @@ class HomeKitConbusService:
|
|
|
29
31
|
event_bus: EventBus
|
|
30
32
|
|
|
31
33
|
def __init__(self, event_bus: EventBus, telegram_protocol: TelegramProtocol):
|
|
32
|
-
"""
|
|
34
|
+
"""
|
|
35
|
+
Initialize the HomeKit Conbus service.
|
|
33
36
|
|
|
34
37
|
Args:
|
|
35
38
|
event_bus: Event bus instance.
|
|
@@ -49,7 +52,8 @@ class HomeKitConbusService:
|
|
|
49
52
|
def handle_read_datapoint_request(
|
|
50
53
|
self, event: ReadDatapointFromProtocolEvent
|
|
51
54
|
) -> None:
|
|
52
|
-
"""
|
|
55
|
+
"""
|
|
56
|
+
Handle request to read datapoint from protocol.
|
|
53
57
|
|
|
54
58
|
Args:
|
|
55
59
|
event: Read datapoint event with serial number and datapoint type.
|
|
@@ -62,7 +66,8 @@ class HomeKitConbusService:
|
|
|
62
66
|
self.telegram_protocol.sendFrame(telegram.encode())
|
|
63
67
|
|
|
64
68
|
def handle_send_write_config_event(self, event: SendWriteConfigEvent) -> None:
|
|
65
|
-
"""
|
|
69
|
+
"""
|
|
70
|
+
Handle send write config event.
|
|
66
71
|
|
|
67
72
|
Args:
|
|
68
73
|
event: Write config event with configuration data.
|
|
@@ -79,7 +84,8 @@ class HomeKitConbusService:
|
|
|
79
84
|
self.telegram_protocol.sendFrame(telegram.encode())
|
|
80
85
|
|
|
81
86
|
def handle_send_action_event(self, event: SendActionEvent) -> None:
|
|
82
|
-
"""
|
|
87
|
+
"""
|
|
88
|
+
Handle send action event.
|
|
83
89
|
|
|
84
90
|
Args:
|
|
85
91
|
event: Send action event with action data.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Configuration Validator.
|
|
2
3
|
|
|
3
4
|
This module validates HomeKit configuration files for correctness and consistency.
|
|
4
5
|
"""
|
|
@@ -14,7 +15,8 @@ class HomekitConfigValidator:
|
|
|
14
15
|
"""Validates homekit.yml configuration file for HomeKit integration."""
|
|
15
16
|
|
|
16
17
|
def __init__(self, config: HomekitConfig):
|
|
17
|
-
"""
|
|
18
|
+
"""
|
|
19
|
+
Initialize the HomeKit config validator.
|
|
18
20
|
|
|
19
21
|
Args:
|
|
20
22
|
config: HomeKit configuration to validate.
|
|
@@ -22,7 +24,8 @@ class HomekitConfigValidator:
|
|
|
22
24
|
self.config = config
|
|
23
25
|
|
|
24
26
|
def validate_unique_accessory_names(self) -> List[str]:
|
|
25
|
-
"""
|
|
27
|
+
"""
|
|
28
|
+
Validate that all accessory names are unique.
|
|
26
29
|
|
|
27
30
|
Returns:
|
|
28
31
|
List of validation error messages.
|
|
@@ -38,7 +41,8 @@ class HomekitConfigValidator:
|
|
|
38
41
|
return errors
|
|
39
42
|
|
|
40
43
|
def validate_service_types(self) -> List[str]:
|
|
41
|
-
"""
|
|
44
|
+
"""
|
|
45
|
+
Validate that service types are valid.
|
|
42
46
|
|
|
43
47
|
Returns:
|
|
44
48
|
List of validation error messages.
|
|
@@ -58,7 +62,8 @@ class HomekitConfigValidator:
|
|
|
58
62
|
return errors
|
|
59
63
|
|
|
60
64
|
def validate_output_numbers(self) -> List[str]:
|
|
61
|
-
"""
|
|
65
|
+
"""
|
|
66
|
+
Validate that output numbers are positive integers.
|
|
62
67
|
|
|
63
68
|
Returns:
|
|
64
69
|
List of validation error messages.
|
|
@@ -72,7 +77,8 @@ class HomekitConfigValidator:
|
|
|
72
77
|
return errors
|
|
73
78
|
|
|
74
79
|
def validate_unique_room_names(self) -> List[str]:
|
|
75
|
-
"""
|
|
80
|
+
"""
|
|
81
|
+
Validate that all room names are unique.
|
|
76
82
|
|
|
77
83
|
Returns:
|
|
78
84
|
List of validation error messages.
|
|
@@ -88,7 +94,8 @@ class HomekitConfigValidator:
|
|
|
88
94
|
return errors
|
|
89
95
|
|
|
90
96
|
def validate_room_accessory_references(self) -> List[str]:
|
|
91
|
-
"""
|
|
97
|
+
"""
|
|
98
|
+
Validate that all room accessories exist in accessories section.
|
|
92
99
|
|
|
93
100
|
Returns:
|
|
94
101
|
List of validation error messages.
|
|
@@ -106,7 +113,8 @@ class HomekitConfigValidator:
|
|
|
106
113
|
return errors
|
|
107
114
|
|
|
108
115
|
def validate_no_orphaned_accessories(self) -> List[str]:
|
|
109
|
-
"""
|
|
116
|
+
"""
|
|
117
|
+
Validate that all accessories are assigned to at least one room.
|
|
110
118
|
|
|
111
119
|
Returns:
|
|
112
120
|
List of validation error messages.
|
|
@@ -124,7 +132,8 @@ class HomekitConfigValidator:
|
|
|
124
132
|
return errors
|
|
125
133
|
|
|
126
134
|
def validate_no_duplicate_accessory_assignments(self) -> List[str]:
|
|
127
|
-
"""
|
|
135
|
+
"""
|
|
136
|
+
Validate that accessories are not assigned to multiple rooms.
|
|
128
137
|
|
|
129
138
|
Returns:
|
|
130
139
|
List of validation error messages.
|
|
@@ -143,7 +152,8 @@ class HomekitConfigValidator:
|
|
|
143
152
|
return errors
|
|
144
153
|
|
|
145
154
|
def validate_all(self) -> List[str]:
|
|
146
|
-
"""
|
|
155
|
+
"""
|
|
156
|
+
Run all validations and return combined errors.
|
|
147
157
|
|
|
148
158
|
Returns:
|
|
149
159
|
List of all validation error messages.
|
|
@@ -167,7 +177,8 @@ class CrossReferenceValidator:
|
|
|
167
177
|
conson_validator: ConsonConfigValidator,
|
|
168
178
|
homekit_validator: HomekitConfigValidator,
|
|
169
179
|
):
|
|
170
|
-
"""
|
|
180
|
+
"""
|
|
181
|
+
Initialize the cross-reference validator.
|
|
171
182
|
|
|
172
183
|
Args:
|
|
173
184
|
conson_validator: Conson configuration validator.
|
|
@@ -177,7 +188,8 @@ class CrossReferenceValidator:
|
|
|
177
188
|
self.homekit_validator = homekit_validator
|
|
178
189
|
|
|
179
190
|
def validate_serial_number_references(self) -> List[str]:
|
|
180
|
-
"""
|
|
191
|
+
"""
|
|
192
|
+
Validate that all accessory serial numbers exist in conson configuration.
|
|
181
193
|
|
|
182
194
|
Returns:
|
|
183
195
|
List of validation error messages.
|
|
@@ -192,7 +204,8 @@ class CrossReferenceValidator:
|
|
|
192
204
|
return errors
|
|
193
205
|
|
|
194
206
|
def validate_output_capabilities(self) -> List[str]:
|
|
195
|
-
"""
|
|
207
|
+
"""
|
|
208
|
+
Validate that output numbers are within module capabilities.
|
|
196
209
|
|
|
197
210
|
Returns:
|
|
198
211
|
List of validation error messages.
|
|
@@ -232,7 +245,8 @@ class CrossReferenceValidator:
|
|
|
232
245
|
return errors
|
|
233
246
|
|
|
234
247
|
def validate_all(self) -> List[str]:
|
|
235
|
-
"""
|
|
248
|
+
"""
|
|
249
|
+
Run all cross-reference validations and return combined errors.
|
|
236
250
|
|
|
237
251
|
Returns:
|
|
238
252
|
List of all cross-reference validation error messages.
|
|
@@ -247,7 +261,8 @@ class ConfigValidationService:
|
|
|
247
261
|
"""Main service for validating HomeKit configuration coherence."""
|
|
248
262
|
|
|
249
263
|
def __init__(self, conson_config_path: str, homekit_config_path: str):
|
|
250
|
-
"""
|
|
264
|
+
"""
|
|
265
|
+
Initialize the config validation service.
|
|
251
266
|
|
|
252
267
|
Args:
|
|
253
268
|
conson_config_path: Path to conson.yml configuration file.
|
|
@@ -266,7 +281,8 @@ class ConfigValidationService:
|
|
|
266
281
|
)
|
|
267
282
|
|
|
268
283
|
def validate_all(self) -> dict:
|
|
269
|
-
"""
|
|
284
|
+
"""
|
|
285
|
+
Run all validations and return organized results.
|
|
270
286
|
|
|
271
287
|
Returns:
|
|
272
288
|
Dictionary containing validation results and error counts.
|
|
@@ -287,7 +303,8 @@ class ConfigValidationService:
|
|
|
287
303
|
}
|
|
288
304
|
|
|
289
305
|
def print_config_summary(self) -> str:
|
|
290
|
-
"""
|
|
306
|
+
"""
|
|
307
|
+
Generate a summary of the configuration.
|
|
291
308
|
|
|
292
309
|
Returns:
|
|
293
310
|
String containing configuration summary.
|