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
|
@@ -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.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Conson Configuration Validator for HomeKit.
|
|
2
3
|
|
|
3
4
|
This module validates conson.yml configuration files for HomeKit integration.
|
|
4
5
|
"""
|
|
@@ -15,7 +16,8 @@ class ConsonConfigValidator:
|
|
|
15
16
|
"""Validates conson.yml configuration file for HomeKit integration."""
|
|
16
17
|
|
|
17
18
|
def __init__(self, config: ConsonModuleListConfig):
|
|
18
|
-
"""
|
|
19
|
+
"""
|
|
20
|
+
Initialize the Conson config validator.
|
|
19
21
|
|
|
20
22
|
Args:
|
|
21
23
|
config: Conson module list configuration to validate.
|
|
@@ -23,7 +25,8 @@ class ConsonConfigValidator:
|
|
|
23
25
|
self.config = config
|
|
24
26
|
|
|
25
27
|
def validate_unique_names(self) -> List[str]:
|
|
26
|
-
"""
|
|
28
|
+
"""
|
|
29
|
+
Validate that all module names are unique.
|
|
27
30
|
|
|
28
31
|
Returns:
|
|
29
32
|
List of validation error messages.
|
|
@@ -39,7 +42,8 @@ class ConsonConfigValidator:
|
|
|
39
42
|
return errors
|
|
40
43
|
|
|
41
44
|
def validate_unique_serial_numbers(self) -> List[str]:
|
|
42
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Validate that all serial numbers are unique.
|
|
43
47
|
|
|
44
48
|
Returns:
|
|
45
49
|
List of validation error messages.
|
|
@@ -55,7 +59,8 @@ class ConsonConfigValidator:
|
|
|
55
59
|
return errors
|
|
56
60
|
|
|
57
61
|
def validate_module_type_codes(self) -> List[str]:
|
|
58
|
-
"""
|
|
62
|
+
"""
|
|
63
|
+
Validate module type code ranges.
|
|
59
64
|
|
|
60
65
|
Returns:
|
|
61
66
|
List of validation error messages.
|
|
@@ -69,7 +74,8 @@ class ConsonConfigValidator:
|
|
|
69
74
|
return errors
|
|
70
75
|
|
|
71
76
|
def validate_network_config(self) -> List[str]:
|
|
72
|
-
"""
|
|
77
|
+
"""
|
|
78
|
+
Validate IP/port configuration.
|
|
73
79
|
|
|
74
80
|
Returns:
|
|
75
81
|
List of validation error messages.
|
|
@@ -83,7 +89,8 @@ class ConsonConfigValidator:
|
|
|
83
89
|
return errors
|
|
84
90
|
|
|
85
91
|
def validate_all(self) -> List[str]:
|
|
86
|
-
"""
|
|
92
|
+
"""
|
|
93
|
+
Run all validations and return combined errors.
|
|
87
94
|
|
|
88
95
|
Returns:
|
|
89
96
|
List of all validation error messages.
|
|
@@ -96,7 +103,8 @@ class ConsonConfigValidator:
|
|
|
96
103
|
return all_errors
|
|
97
104
|
|
|
98
105
|
def get_module_by_serial(self, serial_number: str) -> ConsonModuleConfig:
|
|
99
|
-
"""
|
|
106
|
+
"""
|
|
107
|
+
Get module configuration by serial number.
|
|
100
108
|
|
|
101
109
|
Args:
|
|
102
110
|
serial_number: Serial number of the module to find.
|
|
@@ -113,7 +121,8 @@ class ConsonConfigValidator:
|
|
|
113
121
|
raise ValueError(f"Module with serial number {serial_number} not found")
|
|
114
122
|
|
|
115
123
|
def get_all_serial_numbers(self) -> Set[str]:
|
|
116
|
-
"""
|
|
124
|
+
"""
|
|
125
|
+
Get all serial numbers from the configuration.
|
|
117
126
|
|
|
118
127
|
Returns:
|
|
119
128
|
Set of all serial numbers in the configuration.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Dimming Light Accessory.
|
|
2
3
|
|
|
3
4
|
This module provides a dimming light accessory for HomeKit integration.
|
|
4
5
|
"""
|
|
@@ -21,7 +22,8 @@ from xp.models.protocol.conbus_protocol import (
|
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
class DimmingLight(Accessory):
|
|
24
|
-
"""
|
|
25
|
+
"""
|
|
26
|
+
HomeKit dimming light accessory.
|
|
25
27
|
|
|
26
28
|
Attributes:
|
|
27
29
|
category: HomeKit category (CATEGORY_LIGHTBULB).
|
|
@@ -46,7 +48,8 @@ class DimmingLight(Accessory):
|
|
|
46
48
|
accessory: HomekitAccessoryConfig,
|
|
47
49
|
event_bus: EventBus,
|
|
48
50
|
):
|
|
49
|
-
"""
|
|
51
|
+
"""
|
|
52
|
+
Initialize the dimming light accessory.
|
|
50
53
|
|
|
51
54
|
Args:
|
|
52
55
|
driver: HAP accessory driver.
|
|
@@ -102,7 +105,8 @@ class DimmingLight(Accessory):
|
|
|
102
105
|
)
|
|
103
106
|
|
|
104
107
|
def set_on(self, value: bool) -> None:
|
|
105
|
-
"""
|
|
108
|
+
"""
|
|
109
|
+
Set the on/off state of the dimming light.
|
|
106
110
|
|
|
107
111
|
Args:
|
|
108
112
|
value: True to turn on, False to turn off.
|
|
@@ -124,7 +128,8 @@ class DimmingLight(Accessory):
|
|
|
124
128
|
)
|
|
125
129
|
|
|
126
130
|
def get_on(self) -> bool:
|
|
127
|
-
"""
|
|
131
|
+
"""
|
|
132
|
+
Get the on/off state of the dimming light.
|
|
128
133
|
|
|
129
134
|
Returns:
|
|
130
135
|
True if on, False if off.
|
|
@@ -144,7 +149,8 @@ class DimmingLight(Accessory):
|
|
|
144
149
|
return self.is_on
|
|
145
150
|
|
|
146
151
|
def set_brightness(self, value: int) -> None:
|
|
147
|
-
"""
|
|
152
|
+
"""
|
|
153
|
+
Set the brightness level of the dimming light.
|
|
148
154
|
|
|
149
155
|
Args:
|
|
150
156
|
value: Brightness level (0-100).
|
|
@@ -163,7 +169,8 @@ class DimmingLight(Accessory):
|
|
|
163
169
|
)
|
|
164
170
|
|
|
165
171
|
def get_brightness(self) -> int:
|
|
166
|
-
"""
|
|
172
|
+
"""
|
|
173
|
+
Get the brightness level of the dimming light.
|
|
167
174
|
|
|
168
175
|
Returns:
|
|
169
176
|
Current brightness level (0-100).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Dimming Light Service.
|
|
2
3
|
|
|
3
4
|
This module provides service implementation for dimming light accessories.
|
|
4
5
|
"""
|
|
@@ -19,7 +20,8 @@ from xp.models.telegram.datapoint_type import DataPointType
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class HomeKitDimmingLightService:
|
|
22
|
-
"""
|
|
23
|
+
"""
|
|
24
|
+
Dimming light service for HomeKit.
|
|
23
25
|
|
|
24
26
|
Attributes:
|
|
25
27
|
event_bus: Event bus for inter-service communication.
|
|
@@ -29,7 +31,8 @@ class HomeKitDimmingLightService:
|
|
|
29
31
|
event_bus: EventBus
|
|
30
32
|
|
|
31
33
|
def __init__(self, event_bus: EventBus) -> None:
|
|
32
|
-
"""
|
|
34
|
+
"""
|
|
35
|
+
Initialize the dimming light service.
|
|
33
36
|
|
|
34
37
|
Args:
|
|
35
38
|
event_bus: Event bus instance.
|
|
@@ -48,7 +51,8 @@ class HomeKitDimmingLightService:
|
|
|
48
51
|
)
|
|
49
52
|
|
|
50
53
|
def handle_dimminglight_get_on(self, event: DimmingLightGetOnEvent) -> None:
|
|
51
|
-
"""
|
|
54
|
+
"""
|
|
55
|
+
Handle dimming light get on event.
|
|
52
56
|
|
|
53
57
|
Args:
|
|
54
58
|
event: Dimming light get on event.
|
|
@@ -67,7 +71,8 @@ class HomeKitDimmingLightService:
|
|
|
67
71
|
self.logger.debug(f"Dispatched ReadDatapointEvent for {event.serial_number}")
|
|
68
72
|
|
|
69
73
|
def handle_dimminglight_set_on(self, event: DimmingLightSetOnEvent) -> None:
|
|
70
|
-
"""
|
|
74
|
+
"""
|
|
75
|
+
Handle dimming light set on event.
|
|
71
76
|
|
|
72
77
|
Args:
|
|
73
78
|
event: Dimming light set on event.
|
|
@@ -98,7 +103,8 @@ class HomeKitDimmingLightService:
|
|
|
98
103
|
def handle_dimminglight_set_brightness(
|
|
99
104
|
self, event: DimmingLightSetBrightnessEvent
|
|
100
105
|
) -> None:
|
|
101
|
-
"""
|
|
106
|
+
"""
|
|
107
|
+
Handle dimming light set brightness event.
|
|
102
108
|
|
|
103
109
|
Args:
|
|
104
110
|
event: Dimming light set brightness event.
|
|
@@ -126,7 +132,8 @@ class HomeKitDimmingLightService:
|
|
|
126
132
|
def handle_dimminglight_get_brightness(
|
|
127
133
|
self, event: DimmingLightGetBrightnessEvent
|
|
128
134
|
) -> None:
|
|
129
|
-
"""
|
|
135
|
+
"""
|
|
136
|
+
Handle dimming light get brightness event.
|
|
130
137
|
|
|
131
138
|
Args:
|
|
132
139
|
event: Dimming light get brightness event.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit HAP Service for Apple HomeKit integration.
|
|
2
3
|
|
|
3
4
|
This module provides the main HAP (HomeKit Accessory Protocol) service.
|
|
4
5
|
"""
|
|
@@ -35,7 +36,8 @@ from xp.services.homekit.homekit_outlet import Outlet
|
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
class HomekitHapService:
|
|
38
|
-
"""
|
|
39
|
+
"""
|
|
40
|
+
HomeKit HAP service.
|
|
39
41
|
|
|
40
42
|
Manages HAP accessory protocol, handles bridge and accessory setup,
|
|
41
43
|
and processes HomeKit events for device state synchronization.
|
|
@@ -59,7 +61,8 @@ class HomekitHapService:
|
|
|
59
61
|
module_service: HomekitModuleService,
|
|
60
62
|
event_bus: EventBus,
|
|
61
63
|
):
|
|
62
|
-
"""
|
|
64
|
+
"""
|
|
65
|
+
Initialize the HomeKit HAP service.
|
|
63
66
|
|
|
64
67
|
Args:
|
|
65
68
|
homekit_config: HomeKit configuration.
|
|
@@ -122,7 +125,8 @@ class HomekitHapService:
|
|
|
122
125
|
self.logger.error(f"HAP-python driver error: {e}", exc_info=True)
|
|
123
126
|
|
|
124
127
|
def handle_output_state_received(self, event: OutputStateReceivedEvent) -> str:
|
|
125
|
-
"""
|
|
128
|
+
"""
|
|
129
|
+
Handle output state received event.
|
|
126
130
|
|
|
127
131
|
Args:
|
|
128
132
|
event: Output state received event.
|
|
@@ -152,7 +156,8 @@ class HomekitHapService:
|
|
|
152
156
|
return event.data_value
|
|
153
157
|
|
|
154
158
|
def handle_light_level_received(self, event: LightLevelReceivedEvent) -> str:
|
|
155
|
-
"""
|
|
159
|
+
"""
|
|
160
|
+
Handle light level received event.
|
|
156
161
|
|
|
157
162
|
Args:
|
|
158
163
|
event: Light level received event.
|
|
@@ -206,7 +211,8 @@ class HomekitHapService:
|
|
|
206
211
|
self.driver.add_accessory(accessory=bridge)
|
|
207
212
|
|
|
208
213
|
def add_room(self, bridge: Bridge, room: RoomConfig) -> None:
|
|
209
|
-
"""
|
|
214
|
+
"""
|
|
215
|
+
Add a room with its accessories to the bridge.
|
|
210
216
|
|
|
211
217
|
Args:
|
|
212
218
|
bridge: HAP bridge instance.
|
|
@@ -239,7 +245,8 @@ class HomekitHapService:
|
|
|
239
245
|
def get_accessory(
|
|
240
246
|
self, homekit_accessory: HomekitAccessoryConfig
|
|
241
247
|
) -> Union[LightBulb, Outlet, DimmingLight, None]:
|
|
242
|
-
"""
|
|
248
|
+
"""
|
|
249
|
+
Get an accessory instance from configuration.
|
|
243
250
|
|
|
244
251
|
Args:
|
|
245
252
|
homekit_accessory: HomeKit accessory configuration.
|
|
@@ -282,7 +289,8 @@ class HomekitHapService:
|
|
|
282
289
|
return None
|
|
283
290
|
|
|
284
291
|
def get_accessory_by_name(self, name: str) -> Optional[HomekitAccessoryConfig]:
|
|
285
|
-
"""
|
|
292
|
+
"""
|
|
293
|
+
Get an accessory configuration by name.
|
|
286
294
|
|
|
287
295
|
Args:
|
|
288
296
|
name: Name of the accessory to find.
|
|
@@ -295,7 +303,8 @@ class HomekitHapService:
|
|
|
295
303
|
)
|
|
296
304
|
|
|
297
305
|
def handle_module_state_changed(self, event: ModuleStateChangedEvent) -> None:
|
|
298
|
-
"""
|
|
306
|
+
"""
|
|
307
|
+
Handle module state change by refreshing affected accessories.
|
|
299
308
|
|
|
300
309
|
Args:
|
|
301
310
|
event: Module state changed event.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Light Bulb Accessory.
|
|
2
3
|
|
|
3
4
|
This module provides a light bulb accessory for HomeKit integration.
|
|
4
5
|
"""
|
|
@@ -19,7 +20,8 @@ from xp.models.protocol.conbus_protocol import (
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class LightBulb(Accessory):
|
|
22
|
-
"""
|
|
23
|
+
"""
|
|
24
|
+
HomeKit light bulb accessory.
|
|
23
25
|
|
|
24
26
|
Attributes:
|
|
25
27
|
category: HomeKit category (CATEGORY_LIGHTBULB).
|
|
@@ -42,7 +44,8 @@ class LightBulb(Accessory):
|
|
|
42
44
|
accessory: HomekitAccessoryConfig,
|
|
43
45
|
event_bus: EventBus,
|
|
44
46
|
):
|
|
45
|
-
"""
|
|
47
|
+
"""
|
|
48
|
+
Initialize the light bulb accessory.
|
|
46
49
|
|
|
47
50
|
Args:
|
|
48
51
|
driver: HAP accessory driver.
|
|
@@ -80,7 +83,8 @@ class LightBulb(Accessory):
|
|
|
80
83
|
)
|
|
81
84
|
|
|
82
85
|
def set_on(self, value: bool) -> None:
|
|
83
|
-
"""
|
|
86
|
+
"""
|
|
87
|
+
Set the on/off state of the light bulb.
|
|
84
88
|
|
|
85
89
|
Args:
|
|
86
90
|
value: True to turn on, False to turn off.
|
|
@@ -100,7 +104,8 @@ class LightBulb(Accessory):
|
|
|
100
104
|
)
|
|
101
105
|
|
|
102
106
|
def get_on(self) -> bool:
|
|
103
|
-
"""
|
|
107
|
+
"""
|
|
108
|
+
Get the on/off state of the light bulb.
|
|
104
109
|
|
|
105
110
|
Returns:
|
|
106
111
|
True if on, False if off.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Light Bulb Service.
|
|
2
3
|
|
|
3
4
|
This module provides service implementation for light bulb accessories.
|
|
4
5
|
"""
|
|
@@ -17,7 +18,8 @@ from xp.models.telegram.datapoint_type import DataPointType
|
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class HomeKitLightbulbService:
|
|
20
|
-
"""
|
|
21
|
+
"""
|
|
22
|
+
Lightbulb service for HomeKit.
|
|
21
23
|
|
|
22
24
|
Attributes:
|
|
23
25
|
event_bus: Event bus for inter-service communication.
|
|
@@ -27,7 +29,8 @@ class HomeKitLightbulbService:
|
|
|
27
29
|
event_bus: EventBus
|
|
28
30
|
|
|
29
31
|
def __init__(self, event_bus: EventBus):
|
|
30
|
-
"""
|
|
32
|
+
"""
|
|
33
|
+
Initialize the lightbulb service.
|
|
31
34
|
|
|
32
35
|
Args:
|
|
33
36
|
event_bus: Event bus instance.
|
|
@@ -40,7 +43,8 @@ class HomeKitLightbulbService:
|
|
|
40
43
|
self.event_bus.on(LightBulbSetOnEvent, self.handle_lightbulb_set_on)
|
|
41
44
|
|
|
42
45
|
def handle_lightbulb_get_on(self, event: LightBulbGetOnEvent) -> None:
|
|
43
|
-
"""
|
|
46
|
+
"""
|
|
47
|
+
Handle lightbulb get on event.
|
|
44
48
|
|
|
45
49
|
Args:
|
|
46
50
|
event: Lightbulb get on event.
|
|
@@ -60,7 +64,8 @@ class HomeKitLightbulbService:
|
|
|
60
64
|
self.logger.debug(f"Dispatched ReadDatapointEvent for {event.serial_number}")
|
|
61
65
|
|
|
62
66
|
def handle_lightbulb_set_on(self, event: LightBulbSetOnEvent) -> None:
|
|
63
|
-
"""
|
|
67
|
+
"""
|
|
68
|
+
Handle lightbulb set on event.
|
|
64
69
|
|
|
65
70
|
Args:
|
|
66
71
|
event: Lightbulb set on event.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Module Service.
|
|
2
3
|
|
|
3
4
|
This module provides service implementation for HomeKit module management.
|
|
4
5
|
"""
|
|
@@ -13,7 +14,8 @@ from xp.models.config.conson_module_config import (
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class HomekitModuleService:
|
|
16
|
-
"""
|
|
17
|
+
"""
|
|
18
|
+
Service for managing HomeKit module configurations.
|
|
17
19
|
|
|
18
20
|
Attributes:
|
|
19
21
|
logger: Logger instance.
|
|
@@ -24,7 +26,8 @@ class HomekitModuleService:
|
|
|
24
26
|
self,
|
|
25
27
|
conson_modules_config: ConsonModuleListConfig,
|
|
26
28
|
):
|
|
27
|
-
"""
|
|
29
|
+
"""
|
|
30
|
+
Initialize the HomeKit module service.
|
|
28
31
|
|
|
29
32
|
Args:
|
|
30
33
|
conson_modules_config: Conson module list configuration.
|
|
@@ -34,7 +37,8 @@ class HomekitModuleService:
|
|
|
34
37
|
self.conson_modules_config = conson_modules_config
|
|
35
38
|
|
|
36
39
|
def get_module_by_serial(self, serial_number: str) -> Optional[ConsonModuleConfig]:
|
|
37
|
-
"""
|
|
40
|
+
"""
|
|
41
|
+
Get a module by its serial number.
|
|
38
42
|
|
|
39
43
|
Args:
|
|
40
44
|
serial_number: Serial number of the module to find.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Outlet Accessory.
|
|
2
3
|
|
|
3
4
|
This module provides an outlet accessory for HomeKit integration.
|
|
4
5
|
"""
|
|
@@ -21,7 +22,8 @@ from xp.models.protocol.conbus_protocol import (
|
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
class Outlet(Accessory):
|
|
24
|
-
"""
|
|
25
|
+
"""
|
|
26
|
+
HomeKit outlet accessory.
|
|
25
27
|
|
|
26
28
|
Attributes:
|
|
27
29
|
category: HomeKit category (CATEGORY_OUTLET).
|
|
@@ -46,7 +48,8 @@ class Outlet(Accessory):
|
|
|
46
48
|
accessory: HomekitAccessoryConfig,
|
|
47
49
|
event_bus: EventBus,
|
|
48
50
|
):
|
|
49
|
-
"""
|
|
51
|
+
"""
|
|
52
|
+
Initialize the outlet accessory.
|
|
50
53
|
|
|
51
54
|
Args:
|
|
52
55
|
driver: HAP accessory driver.
|
|
@@ -88,7 +91,8 @@ class Outlet(Accessory):
|
|
|
88
91
|
)
|
|
89
92
|
|
|
90
93
|
def set_outlet_in_use(self, value: bool) -> None:
|
|
91
|
-
"""
|
|
94
|
+
"""
|
|
95
|
+
Set the in-use state of the outlet.
|
|
92
96
|
|
|
93
97
|
Args:
|
|
94
98
|
value: True if in use, False otherwise.
|
|
@@ -108,7 +112,8 @@ class Outlet(Accessory):
|
|
|
108
112
|
self.logger.debug(f"set_outlet_in_use {value} end")
|
|
109
113
|
|
|
110
114
|
def get_outlet_in_use(self) -> bool:
|
|
111
|
-
"""
|
|
115
|
+
"""
|
|
116
|
+
Get the in-use state of the outlet.
|
|
112
117
|
|
|
113
118
|
Returns:
|
|
114
119
|
True if in use, False otherwise.
|
|
@@ -128,7 +133,8 @@ class Outlet(Accessory):
|
|
|
128
133
|
return self.is_in_use
|
|
129
134
|
|
|
130
135
|
def set_on(self, value: bool) -> None:
|
|
131
|
-
"""
|
|
136
|
+
"""
|
|
137
|
+
Set the on/off state of the outlet.
|
|
132
138
|
|
|
133
139
|
Args:
|
|
134
140
|
value: True to turn on, False to turn off.
|
|
@@ -148,7 +154,8 @@ class Outlet(Accessory):
|
|
|
148
154
|
)
|
|
149
155
|
|
|
150
156
|
def get_on(self) -> bool:
|
|
151
|
-
"""
|
|
157
|
+
"""
|
|
158
|
+
Get the on/off state of the outlet.
|
|
152
159
|
|
|
153
160
|
Returns:
|
|
154
161
|
True if on, False if off.
|