conson-xp 0.9.2__tar.gz
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-0.9.2/LICENSE +29 -0
- conson_xp-0.9.2/PKG-INFO +419 -0
- conson_xp-0.9.2/README.md +370 -0
- conson_xp-0.9.2/pyproject.toml +171 -0
- conson_xp-0.9.2/src/xp/__init__.py +7 -0
- conson_xp-0.9.2/src/xp/api/__init__.py +1 -0
- conson_xp-0.9.2/src/xp/api/main.py +118 -0
- conson_xp-0.9.2/src/xp/api/models/__init__.py +1 -0
- conson_xp-0.9.2/src/xp/api/models/api.py +18 -0
- conson_xp-0.9.2/src/xp/api/models/discover.py +16 -0
- conson_xp-0.9.2/src/xp/api/routers/__init__.py +15 -0
- conson_xp-0.9.2/src/xp/api/routers/conbus.py +5 -0
- conson_xp-0.9.2/src/xp/api/routers/conbus_blink.py +86 -0
- conson_xp-0.9.2/src/xp/api/routers/conbus_custom.py +54 -0
- conson_xp-0.9.2/src/xp/api/routers/conbus_datapoint.py +56 -0
- conson_xp-0.9.2/src/xp/api/routers/conbus_discover.py +46 -0
- conson_xp-0.9.2/src/xp/api/routers/conbus_output.py +119 -0
- conson_xp-0.9.2/src/xp/api/routers/errors.py +35 -0
- conson_xp-0.9.2/src/xp/cli/__init__.py +5 -0
- conson_xp-0.9.2/src/xp/cli/__main__.py +6 -0
- conson_xp-0.9.2/src/xp/cli/commands/__init__.py +31 -0
- conson_xp-0.9.2/src/xp/cli/commands/api.py +14 -0
- conson_xp-0.9.2/src/xp/cli/commands/api_start_commands.py +111 -0
- conson_xp-0.9.2/src/xp/cli/commands/cache_commands.py +207 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus.py +29 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_blink_commands.py +112 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_config_commands.py +31 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_custom_commands.py +51 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_datapoint_commands.py +58 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_discover_commands.py +37 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_output_commands.py +103 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_raw_commands.py +50 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_receive_commands.py +47 -0
- conson_xp-0.9.2/src/xp/cli/commands/conbus_scan_commands.py +124 -0
- conson_xp-0.9.2/src/xp/cli/commands/file_commands.py +172 -0
- conson_xp-0.9.2/src/xp/cli/commands/homekit.py +80 -0
- conson_xp-0.9.2/src/xp/cli/commands/homekit_start_commands.py +40 -0
- conson_xp-0.9.2/src/xp/cli/commands/module_commands.py +164 -0
- conson_xp-0.9.2/src/xp/cli/commands/reverse_proxy_commands.py +164 -0
- conson_xp-0.9.2/src/xp/cli/commands/server_commands.py +130 -0
- conson_xp-0.9.2/src/xp/cli/commands/telegram.py +37 -0
- conson_xp-0.9.2/src/xp/cli/commands/telegram_blink_commands.py +72 -0
- conson_xp-0.9.2/src/xp/cli/commands/telegram_checksum_commands.py +96 -0
- conson_xp-0.9.2/src/xp/cli/commands/telegram_discover_commands.py +40 -0
- conson_xp-0.9.2/src/xp/cli/commands/telegram_linknumber_commands.py +76 -0
- conson_xp-0.9.2/src/xp/cli/commands/telegram_parse_commands.py +74 -0
- conson_xp-0.9.2/src/xp/cli/commands/telegram_version_commands.py +43 -0
- conson_xp-0.9.2/src/xp/cli/main.py +48 -0
- conson_xp-0.9.2/src/xp/cli/utils/__init__.py +2 -0
- conson_xp-0.9.2/src/xp/cli/utils/click_tree.py +32 -0
- conson_xp-0.9.2/src/xp/cli/utils/datapoint_type_choice.py +29 -0
- conson_xp-0.9.2/src/xp/cli/utils/decorators.py +185 -0
- conson_xp-0.9.2/src/xp/cli/utils/error_handlers.py +166 -0
- conson_xp-0.9.2/src/xp/cli/utils/formatters.py +225 -0
- conson_xp-0.9.2/src/xp/cli/utils/serial_number_type.py +28 -0
- conson_xp-0.9.2/src/xp/cli/utils/system_function_choice.py +29 -0
- conson_xp-0.9.2/src/xp/connection/__init__.py +13 -0
- conson_xp-0.9.2/src/xp/connection/exceptions.py +24 -0
- conson_xp-0.9.2/src/xp/models/__init__.py +31 -0
- conson_xp-0.9.2/src/xp/models/action_type.py +17 -0
- conson_xp-0.9.2/src/xp/models/cache.py +106 -0
- conson_xp-0.9.2/src/xp/models/conbus.py +55 -0
- conson_xp-0.9.2/src/xp/models/conbus_blink.py +40 -0
- conson_xp-0.9.2/src/xp/models/conbus_client_config.py +14 -0
- conson_xp-0.9.2/src/xp/models/conbus_connection_status.py +26 -0
- conson_xp-0.9.2/src/xp/models/conbus_custom.py +39 -0
- conson_xp-0.9.2/src/xp/models/conbus_datapoint.py +42 -0
- conson_xp-0.9.2/src/xp/models/conbus_discover.py +31 -0
- conson_xp-0.9.2/src/xp/models/conbus_output.py +40 -0
- conson_xp-0.9.2/src/xp/models/conbus_raw.py +30 -0
- conson_xp-0.9.2/src/xp/models/conbus_receive.py +28 -0
- conson_xp-0.9.2/src/xp/models/datapoint_type.py +51 -0
- conson_xp-0.9.2/src/xp/models/event_telegram.py +101 -0
- conson_xp-0.9.2/src/xp/models/event_type.py +8 -0
- conson_xp-0.9.2/src/xp/models/homekit_accessory.py +20 -0
- conson_xp-0.9.2/src/xp/models/homekit_config.py +37 -0
- conson_xp-0.9.2/src/xp/models/homekit_conson_config.py +27 -0
- conson_xp-0.9.2/src/xp/models/homekit_lightbulb.py +68 -0
- conson_xp-0.9.2/src/xp/models/homekit_outlet.py +91 -0
- conson_xp-0.9.2/src/xp/models/input_type.py +9 -0
- conson_xp-0.9.2/src/xp/models/log_entry.py +93 -0
- conson_xp-0.9.2/src/xp/models/module_type.py +133 -0
- conson_xp-0.9.2/src/xp/models/module_type_code.py +163 -0
- conson_xp-0.9.2/src/xp/models/output_telegram.py +73 -0
- conson_xp-0.9.2/src/xp/models/reply_telegram.py +226 -0
- conson_xp-0.9.2/src/xp/models/response.py +42 -0
- conson_xp-0.9.2/src/xp/models/system_function.py +39 -0
- conson_xp-0.9.2/src/xp/models/system_telegram.py +58 -0
- conson_xp-0.9.2/src/xp/models/telegram.py +16 -0
- conson_xp-0.9.2/src/xp/models/write_config_type.py +18 -0
- conson_xp-0.9.2/src/xp/services/__init__.py +20 -0
- conson_xp-0.9.2/src/xp/services/base_server_service.py +201 -0
- conson_xp-0.9.2/src/xp/services/conbus_blink_service.py +139 -0
- conson_xp-0.9.2/src/xp/services/conbus_connection_pool.py +178 -0
- conson_xp-0.9.2/src/xp/services/conbus_custom_service.py +68 -0
- conson_xp-0.9.2/src/xp/services/conbus_datapoint_service.py +72 -0
- conson_xp-0.9.2/src/xp/services/conbus_discover_service.py +82 -0
- conson_xp-0.9.2/src/xp/services/conbus_output_service.py +112 -0
- conson_xp-0.9.2/src/xp/services/conbus_raw_service.py +72 -0
- conson_xp-0.9.2/src/xp/services/conbus_receive_service.py +69 -0
- conson_xp-0.9.2/src/xp/services/conbus_scan_service.py +105 -0
- conson_xp-0.9.2/src/xp/services/conbus_service.py +306 -0
- conson_xp-0.9.2/src/xp/services/cp20_server_service.py +47 -0
- conson_xp-0.9.2/src/xp/services/homekit_cache_service.py +234 -0
- conson_xp-0.9.2/src/xp/services/homekit_config_validator.py +211 -0
- conson_xp-0.9.2/src/xp/services/homekit_conson_config_service.py +73 -0
- conson_xp-0.9.2/src/xp/services/homekit_module_service.py +112 -0
- conson_xp-0.9.2/src/xp/services/homekit_service.py +114 -0
- conson_xp-0.9.2/src/xp/services/log_file_service.py +313 -0
- conson_xp-0.9.2/src/xp/services/module_type_service.py +237 -0
- conson_xp-0.9.2/src/xp/services/reverse_proxy_service.py +379 -0
- conson_xp-0.9.2/src/xp/services/server_service.py +289 -0
- conson_xp-0.9.2/src/xp/services/telegram_blink_service.py +150 -0
- conson_xp-0.9.2/src/xp/services/telegram_checksum_service.py +171 -0
- conson_xp-0.9.2/src/xp/services/telegram_discover_service.py +248 -0
- conson_xp-0.9.2/src/xp/services/telegram_link_number_service.py +233 -0
- conson_xp-0.9.2/src/xp/services/telegram_output_service.py +319 -0
- conson_xp-0.9.2/src/xp/services/telegram_service.py +373 -0
- conson_xp-0.9.2/src/xp/services/telegram_version_service.py +302 -0
- conson_xp-0.9.2/src/xp/services/xp130_server_service.py +94 -0
- conson_xp-0.9.2/src/xp/services/xp20_server_service.py +84 -0
- conson_xp-0.9.2/src/xp/services/xp230_server_service.py +67 -0
- conson_xp-0.9.2/src/xp/services/xp24_server_service.py +89 -0
- conson_xp-0.9.2/src/xp/services/xp33_server_service.py +155 -0
- conson_xp-0.9.2/src/xp/utils/__init__.py +12 -0
- conson_xp-0.9.2/src/xp/utils/checksum.py +124 -0
- conson_xp-0.9.2/src/xp/utils/event_helper.py +29 -0
- conson_xp-0.9.2/src/xp/utils/time_utils.py +139 -0
- conson_xp-0.9.2/tests/.coverage +0 -0
- conson_xp-0.9.2/tests/__init__.py +0 -0
- conson_xp-0.9.2/tests/integration/.coverage +0 -0
- conson_xp-0.9.2/tests/integration/__init__.py +0 -0
- conson_xp-0.9.2/tests/integration/telegram_test_data.py +150 -0
- conson_xp-0.9.2/tests/integration/test_api/.coverage +0 -0
- conson_xp-0.9.2/tests/integration/test_api/__init__.py +1 -0
- conson_xp-0.9.2/tests/integration/test_blink_integration.py +317 -0
- conson_xp-0.9.2/tests/integration/test_cache_integration.py +313 -0
- conson_xp-0.9.2/tests/integration/test_checksum_integration.py +272 -0
- conson_xp-0.9.2/tests/integration/test_conbus_blink_integration.py +190 -0
- conson_xp-0.9.2/tests/integration/test_conbus_raw_integration.py +164 -0
- conson_xp-0.9.2/tests/integration/test_conbus_receive_integration.py +160 -0
- conson_xp-0.9.2/tests/integration/test_discovery_integration.py +140 -0
- conson_xp-0.9.2/tests/integration/test_event_telegram_integration.py +190 -0
- conson_xp-0.9.2/tests/integration/test_homekit_config_integration.py +297 -0
- conson_xp-0.9.2/tests/integration/test_link_number_integration.py +224 -0
- conson_xp-0.9.2/tests/integration/test_module_integration.py +289 -0
- conson_xp-0.9.2/tests/integration/test_output_integration.py +160 -0
- conson_xp-0.9.2/tests/integration/test_reverse_proxy_integration.py +333 -0
- conson_xp-0.9.2/tests/integration/test_system_reply_telegram_integration.py +502 -0
- conson_xp-0.9.2/tests/integration/test_version_integration.py +230 -0
- conson_xp-0.9.2/tests/unit/__init__.py +0 -0
- conson_xp-0.9.2/tests/unit/test_api/__init__.py +1 -0
- conson_xp-0.9.2/tests/unit/test_cli/__init__.py +0 -0
- conson_xp-0.9.2/tests/unit/test_cli/test_conbus_blink_commands.py +40 -0
- conson_xp-0.9.2/tests/unit/test_cli/test_serial_number_type.py +81 -0
- conson_xp-0.9.2/tests/unit/test_connection/__init__.py +0 -0
- conson_xp-0.9.2/tests/unit/test_encoding/__init__.py +1 -0
- conson_xp-0.9.2/tests/unit/test_encoding/test_latin1_edge_cases.py +217 -0
- conson_xp-0.9.2/tests/unit/test_models/.coverage +0 -0
- conson_xp-0.9.2/tests/unit/test_models/__init__.py +0 -0
- conson_xp-0.9.2/tests/unit/test_models/test_cache.py +175 -0
- conson_xp-0.9.2/tests/unit/test_models/test_conbus_client_send.py +199 -0
- conson_xp-0.9.2/tests/unit/test_models/test_event_telegram.py +149 -0
- conson_xp-0.9.2/tests/unit/test_models/test_log_entry.py +301 -0
- conson_xp-0.9.2/tests/unit/test_models/test_module_type.py +187 -0
- conson_xp-0.9.2/tests/unit/test_models/test_reply_telegram.py +439 -0
- conson_xp-0.9.2/tests/unit/test_models/test_system_telegram.py +289 -0
- conson_xp-0.9.2/tests/unit/test_models/test_system_telegram_enhancements.py +232 -0
- conson_xp-0.9.2/tests/unit/test_models/test_version_telegram.py +195 -0
- conson_xp-0.9.2/tests/unit/test_models/test_xp24_action_telegram.py +180 -0
- conson_xp-0.9.2/tests/unit/test_services/.coverage +0 -0
- conson_xp-0.9.2/tests/unit/test_services/__init__.py +0 -0
- conson_xp-0.9.2/tests/unit/test_services/test_base_server_service.py +107 -0
- conson_xp-0.9.2/tests/unit/test_services/test_blink_service.py +201 -0
- conson_xp-0.9.2/tests/unit/test_services/test_checksum_service.py +270 -0
- conson_xp-0.9.2/tests/unit/test_services/test_conbus_datapoint_service.py +237 -0
- conson_xp-0.9.2/tests/unit/test_services/test_conbus_reverse_proxy_service.py +305 -0
- conson_xp-0.9.2/tests/unit/test_services/test_conbus_service.py +122 -0
- conson_xp-0.9.2/tests/unit/test_services/test_discovery_service.py +238 -0
- conson_xp-0.9.2/tests/unit/test_services/test_homekit_cache_service.py +364 -0
- conson_xp-0.9.2/tests/unit/test_services/test_homekit_config_validator.py +306 -0
- conson_xp-0.9.2/tests/unit/test_services/test_homekit_conson_service.py +178 -0
- conson_xp-0.9.2/tests/unit/test_services/test_link_number_service.py +226 -0
- conson_xp-0.9.2/tests/unit/test_services/test_log_file_service.py +438 -0
- conson_xp-0.9.2/tests/unit/test_services/test_module_type_service.py +217 -0
- conson_xp-0.9.2/tests/unit/test_services/test_telegram_input_service.py +187 -0
- conson_xp-0.9.2/tests/unit/test_services/test_telegram_service.py +458 -0
- conson_xp-0.9.2/tests/unit/test_services/test_version_service.py +304 -0
- conson_xp-0.9.2/tests/unit/test_services/test_xp130_server_service.py +259 -0
- conson_xp-0.9.2/tests/unit/test_services/test_xp20_server_service.py +98 -0
- conson_xp-0.9.2/tests/unit/test_services/test_xp230_server_service.py +236 -0
- conson_xp-0.9.2/tests/unit/test_services/test_xp24_action_service.py +228 -0
- conson_xp-0.9.2/tests/unit/test_services/test_xp24_server_service.py +120 -0
- conson_xp-0.9.2/tests/unit/test_services/test_xp33_server_service.py +357 -0
- conson_xp-0.9.2/tests/unit/test_utils/__init__.py +0 -0
- conson_xp-0.9.2/tests/unit/test_utils/test_checksum.py +212 -0
- conson_xp-0.9.2/tests/unit/test_utils/test_time_utils.py +214 -0
conson_xp-0.9.2/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 lduchosal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
NOTICE: This software implements protocols for interoperability purposes only,
|
|
26
|
+
as permitted under Article 6 of the EU Software Directive and similar fair use
|
|
27
|
+
provisions. No commercial activities or trademark infringement are intended.
|
|
28
|
+
Any product names, identifiers, or specifications are used solely for
|
|
29
|
+
interoperability and educational purposes.
|
conson_xp-0.9.2/PKG-INFO
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: conson-xp
|
|
3
|
+
Version: 0.9.2
|
|
4
|
+
Summary: XP Protocol Communication Tools
|
|
5
|
+
Author-Email: ldvchosal <ldvchosal@github.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 lduchosal
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
NOTICE: This software implements protocols for interoperability purposes only,
|
|
31
|
+
as permitted under Article 6 of the EU Software Directive and similar fair use
|
|
32
|
+
provisions. No commercial activities or trademark infringement are intended.
|
|
33
|
+
Any product names, identifiers, or specifications are used solely for
|
|
34
|
+
interoperability and educational purposes.
|
|
35
|
+
Project-URL: Homepage, https://github.com/lduchosal/xp
|
|
36
|
+
Project-URL: Bug Reports, https://github.com/lduchosal/xp/issues
|
|
37
|
+
Project-URL: Source, https://github.com/lduchosal/xp
|
|
38
|
+
Requires-Python: >=3.10
|
|
39
|
+
Requires-Dist: click>=8.0
|
|
40
|
+
Requires-Dist: click-help-colors>=0.9
|
|
41
|
+
Requires-Dist: pyyaml>=6.0
|
|
42
|
+
Requires-Dist: structlog>=22.0
|
|
43
|
+
Requires-Dist: fastapi>=0.104.0
|
|
44
|
+
Requires-Dist: uvicorn>=0.24.0
|
|
45
|
+
Requires-Dist: pydantic>=2.0.0
|
|
46
|
+
Requires-Dist: HAP-python[QRCode]>=5.0.0
|
|
47
|
+
Requires-Dist: PyDispatcher>=2.0.5
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# XP Protocol Communication Tool
|
|
51
|
+
|
|
52
|
+
A comprehensive Python CLI and API tool for CONSON XP Protocol operations, including console bus (Conbus) communication, telegram parsing, HomeKit integration, and module management.
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
### Core Communication
|
|
57
|
+
- **Conbus Operations**: Send and receive telegrams via TCP connections to XP130 and XP230 servers
|
|
58
|
+
- **Telegram Parsing**: Parse event, system, and reply telegrams from remote console bus devices
|
|
59
|
+
- **Real-time Communication**: Bidirectional communication with XP protocol devices
|
|
60
|
+
- **Server Discovery**: Automatic discovery of XP servers on the network
|
|
61
|
+
|
|
62
|
+
### Protocol Support
|
|
63
|
+
- **Multiple XP Modules Types**: XP20, XP24, XP33, XP130, XP230, CP20 server support
|
|
64
|
+
- **Telegram Types**: Event, system, reply, output, and blink telegrams
|
|
65
|
+
- **Checksum Validation**: Multiple checksum algorithms for data integrity
|
|
66
|
+
- **Link Number Management**: Handle telegram versioning and link numbers
|
|
67
|
+
|
|
68
|
+
### Device Management
|
|
69
|
+
- **Module Type Database**: Comprehensive module type information and search
|
|
70
|
+
- **Datapoint Operations**: Read/write datapoints on connected devices
|
|
71
|
+
- **Output Control**: Control outputs on XP devices
|
|
72
|
+
- **Blink Operations**: Visual feedback and device identification
|
|
73
|
+
|
|
74
|
+
### Integration & APIs
|
|
75
|
+
- **REST API**: FastAPI-based REST endpoints for all operations
|
|
76
|
+
- **HomeKit Integration**: Apple HomeKit bridge for smart home integration
|
|
77
|
+
- **Configuration Management**: YAML-based configuration with validation
|
|
78
|
+
- **Reverse Proxy**: Proxy server for device communication
|
|
79
|
+
|
|
80
|
+
### Development & Testing
|
|
81
|
+
- **JSON Output**: All commands support both human-readable and JSON output formats
|
|
82
|
+
- **Comprehensive Testing**: 90%+ test coverage with unit and integration tests
|
|
83
|
+
- **Modern Python**: Type hints, async/await, and modern Python practices
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
### Using PDM (Recommended)
|
|
88
|
+
```bash
|
|
89
|
+
git clone <repository-url>
|
|
90
|
+
cd xp
|
|
91
|
+
pdm install
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Using pip
|
|
95
|
+
```bash
|
|
96
|
+
git clone <repository-url>
|
|
97
|
+
cd xp
|
|
98
|
+
pip install -e .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Development Installation
|
|
102
|
+
```bash
|
|
103
|
+
# Using PDM
|
|
104
|
+
pdm install -G dev
|
|
105
|
+
|
|
106
|
+
# Using pip
|
|
107
|
+
pip install -e ".[dev]"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Usage
|
|
111
|
+
|
|
112
|
+
### Telegram Operations
|
|
113
|
+
|
|
114
|
+
Parse different types of telegrams:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Parse event telegram
|
|
118
|
+
xp telegram parse "<E14L00I02MAK>"
|
|
119
|
+
|
|
120
|
+
# Parse system telegram
|
|
121
|
+
xp telegram parse "<S0020012521F02D18FN>"
|
|
122
|
+
|
|
123
|
+
# Parse reply telegram
|
|
124
|
+
xp telegram parse "<R0020012521F02D18+26,0§CIL>"
|
|
125
|
+
|
|
126
|
+
# Auto-detect telegram type
|
|
127
|
+
xp telegram parse "<E14L00I02MAK>"
|
|
128
|
+
|
|
129
|
+
# Parse multiple telegrams from data stream
|
|
130
|
+
xp telegram parse-multiple "Data <E14L00I02MAK> more <E14L01I03BB1>"
|
|
131
|
+
|
|
132
|
+
# Validate telegram format and checksum
|
|
133
|
+
xp telegram validate "<E14L00I02MAK>"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Module Type Operations
|
|
137
|
+
|
|
138
|
+
Manage and query module types:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Get module information by ID or name
|
|
142
|
+
xp module info 14
|
|
143
|
+
xp module info XP2606
|
|
144
|
+
|
|
145
|
+
# List all modules
|
|
146
|
+
xp module list
|
|
147
|
+
|
|
148
|
+
# List modules by category
|
|
149
|
+
xp module list --category "Interface Panels"
|
|
150
|
+
|
|
151
|
+
# Group modules by category
|
|
152
|
+
xp module list --group-by-category
|
|
153
|
+
|
|
154
|
+
# Search modules
|
|
155
|
+
xp module search "push button"
|
|
156
|
+
xp module search --field name "XP"
|
|
157
|
+
|
|
158
|
+
# List available categories
|
|
159
|
+
xp module categories
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Checksum Operations
|
|
163
|
+
|
|
164
|
+
Calculate and validate checksums:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Calculate simple checksum
|
|
168
|
+
xp checksum calculate "E14L00I02M"
|
|
169
|
+
|
|
170
|
+
# Calculate CRC32 checksum
|
|
171
|
+
xp checksum calculate "E14L00I02M" --algorithm crc32
|
|
172
|
+
|
|
173
|
+
# Validate checksum
|
|
174
|
+
xp checksum validate "E14L00I02M" "AK"
|
|
175
|
+
|
|
176
|
+
# Validate CRC32 checksum
|
|
177
|
+
xp checksum validate "E14L00I02M" "ABCDABCD" --algorithm crc32
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Conbus Operations
|
|
181
|
+
|
|
182
|
+
Connect to XP servers and perform real-time operations:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Send custom telegrams to server
|
|
186
|
+
xp conbus custom <host> <port> <telegram>
|
|
187
|
+
|
|
188
|
+
# Discover XP servers on network
|
|
189
|
+
xp conbus discover
|
|
190
|
+
|
|
191
|
+
# Send blink commands
|
|
192
|
+
xp conbus blink <host> <port> <module_id> <datapoint>
|
|
193
|
+
xp conbus blink all <host> <port> # Blink all modules
|
|
194
|
+
|
|
195
|
+
# Control outputs
|
|
196
|
+
xp conbus output <host> <port> <module_id> <datapoint> <value>
|
|
197
|
+
|
|
198
|
+
# Read/write datapoints
|
|
199
|
+
xp conbus datapoint read <host> <port> <module_id> <datapoint>
|
|
200
|
+
xp conbus datapoint write <host> <port> <module_id> <datapoint> <value>
|
|
201
|
+
|
|
202
|
+
# Receive real-time telegrams
|
|
203
|
+
xp conbus receive <host> <port>
|
|
204
|
+
|
|
205
|
+
# Send raw telegrams
|
|
206
|
+
xp conbus raw <host> <port> <raw_data>
|
|
207
|
+
|
|
208
|
+
# Scan for connected modules
|
|
209
|
+
xp conbus scan <host> <port>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### API Server
|
|
213
|
+
|
|
214
|
+
Start the FastAPI REST server:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Start API server (default: localhost:8000)
|
|
218
|
+
xp api start
|
|
219
|
+
|
|
220
|
+
# Start with custom host and port
|
|
221
|
+
xp api start --host 0.0.0.0 --port 8080
|
|
222
|
+
|
|
223
|
+
# Start with auto-reload for development
|
|
224
|
+
xp api start --reload
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
API endpoints are available at:
|
|
228
|
+
- `/docs` - Interactive API documentation
|
|
229
|
+
- `/health` - Health check endpoint
|
|
230
|
+
- `/conbus/*` - Conbus operation endpoints
|
|
231
|
+
|
|
232
|
+
### HomeKit Integration
|
|
233
|
+
|
|
234
|
+
Manage HomeKit bridge for smart home integration:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Validate HomeKit and Conson configuration
|
|
238
|
+
xp homekit config validate
|
|
239
|
+
|
|
240
|
+
# Show configuration summary
|
|
241
|
+
xp homekit config show
|
|
242
|
+
|
|
243
|
+
# Start HomeKit bridge
|
|
244
|
+
xp homekit start
|
|
245
|
+
|
|
246
|
+
# Start with custom configuration files
|
|
247
|
+
xp homekit start --conson-config custom-conson.yml --homekit-config custom-homekit.yml
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Server Management
|
|
251
|
+
|
|
252
|
+
Manage XP protocol servers:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Start different server types
|
|
256
|
+
xp server start --type xp130 --port 10001
|
|
257
|
+
xp server start --type xp230 --port 10002
|
|
258
|
+
xp server start --type cp20 --port 10003
|
|
259
|
+
|
|
260
|
+
# Start reverse proxy
|
|
261
|
+
xp reverse-proxy start --target-host 192.168.1.100 --target-port 10001
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### File Operations
|
|
265
|
+
|
|
266
|
+
Process telegram files and logs:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Parse telegrams from file
|
|
270
|
+
xp file parse telegrams.txt
|
|
271
|
+
|
|
272
|
+
# Process log files
|
|
273
|
+
xp file process-log logfile.txt
|
|
274
|
+
|
|
275
|
+
# Extract telegrams from mixed content
|
|
276
|
+
xp file extract-telegrams mixed-data.txt
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### JSON Output
|
|
280
|
+
|
|
281
|
+
Add `--json-output` or `-j` to any command for JSON formatted output:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
xp telegram parse "<E14L00I02MAK>" --json-output
|
|
285
|
+
xp module info 14 -j
|
|
286
|
+
xp checksum calculate "E14L00I02M" -j
|
|
287
|
+
xp conbus discover -j
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Architecture
|
|
291
|
+
|
|
292
|
+
The project follows a layered architecture with clear separation of concerns:
|
|
293
|
+
|
|
294
|
+
### Core Layers
|
|
295
|
+
- **CLI Layer** (`cli/`): Command-line interface with modular command structure
|
|
296
|
+
- **API Layer** (`api/`): FastAPI REST endpoints with CORS support
|
|
297
|
+
- **Services Layer** (`services/`): Business logic and protocol implementations
|
|
298
|
+
- **Models Layer** (`models/`): Pydantic data models and response structures
|
|
299
|
+
- **Utils Layer** (`utils/`): Utility functions and helpers
|
|
300
|
+
- **Connection Layer** (`connection/`): Network communication and protocol handling
|
|
301
|
+
|
|
302
|
+
### Key Components
|
|
303
|
+
- **Telegram Processing**: Parse and validate XP protocol telegrams
|
|
304
|
+
- **Conbus Communication**: Real-time TCP/UDP communication with XP servers
|
|
305
|
+
- **HomeKit Bridge**: Apple HomeKit integration for smart home connectivity
|
|
306
|
+
- **Server Implementations**: Multiple XP server type support (XP130, XP230, etc.)
|
|
307
|
+
- **Configuration Management**: YAML-based configuration with validation
|
|
308
|
+
|
|
309
|
+
## Development
|
|
310
|
+
|
|
311
|
+
### Using PDM Scripts
|
|
312
|
+
|
|
313
|
+
The project uses PDM for dependency management with convenient scripts:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Run all tests with coverage
|
|
317
|
+
pdm run test
|
|
318
|
+
|
|
319
|
+
# Run only unit tests
|
|
320
|
+
pdm run test-unit
|
|
321
|
+
|
|
322
|
+
# Run only integration tests
|
|
323
|
+
pdm run test-integration
|
|
324
|
+
|
|
325
|
+
# Run tests with HTML coverage report
|
|
326
|
+
pdm run test-cov
|
|
327
|
+
|
|
328
|
+
# Code quality checks
|
|
329
|
+
pdm run lint # Check code with ruff
|
|
330
|
+
pdm run lint-fix # Fix linting issues automatically
|
|
331
|
+
pdm run format # Format code with black
|
|
332
|
+
pdm run format-check # Check formatting
|
|
333
|
+
pdm run typecheck # Type checking with mypy
|
|
334
|
+
|
|
335
|
+
# Run all quality checks
|
|
336
|
+
pdm run check
|
|
337
|
+
|
|
338
|
+
# Clean up build artifacts
|
|
339
|
+
pdm run clean
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Manual Testing Commands
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Run all tests with coverage (manual)
|
|
346
|
+
PYTHONPATH=src python -m pytest tests/ -v --cov=src/xp --cov-report=term-missing
|
|
347
|
+
|
|
348
|
+
# Run specific test file
|
|
349
|
+
PYTHONPATH=src python -m pytest tests/unit/test_models/test_event_telegram.py -v
|
|
350
|
+
|
|
351
|
+
# Run tests with coverage threshold
|
|
352
|
+
PYTHONPATH=src python -m pytest tests/ -v --cov=src/xp --cov-report=term-missing --cov-fail-under=90
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Code Quality
|
|
356
|
+
|
|
357
|
+
The project includes comprehensive tooling for code quality:
|
|
358
|
+
|
|
359
|
+
- **Testing**: pytest with 90% coverage requirement
|
|
360
|
+
- **Formatting**: black code formatter
|
|
361
|
+
- **Linting**: ruff (modern Python linter)
|
|
362
|
+
- **Type Checking**: mypy static type checker
|
|
363
|
+
- **Dead Code Detection**: vulture
|
|
364
|
+
- **Dependency Management**: PDM
|
|
365
|
+
|
|
366
|
+
### Project Structure
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
xp/
|
|
370
|
+
├── src/xp/
|
|
371
|
+
│ ├── api/ # FastAPI REST endpoints
|
|
372
|
+
│ │ ├── models/ # API data models
|
|
373
|
+
│ │ └── routers/ # API route handlers
|
|
374
|
+
│ ├── cli/ # Command-line interface
|
|
375
|
+
│ │ ├── commands/ # CLI command modules
|
|
376
|
+
│ │ └── utils/ # CLI utilities
|
|
377
|
+
│ ├── connection/ # Network communication
|
|
378
|
+
│ ├── models/ # Core data models
|
|
379
|
+
│ ├── services/ # Business logic
|
|
380
|
+
│ └── utils/ # Utility functions
|
|
381
|
+
├── tests/
|
|
382
|
+
│ ├── unit/ # Unit tests
|
|
383
|
+
│ ├── integration/ # Integration tests
|
|
384
|
+
│ └── fixtures/ # Test data and fixtures
|
|
385
|
+
├── pyproject.toml # Project configuration
|
|
386
|
+
└── pdm.lock # Dependency lock file
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Requirements
|
|
390
|
+
|
|
391
|
+
### Runtime Dependencies
|
|
392
|
+
|
|
393
|
+
- **Python 3.10+** (Required)
|
|
394
|
+
- **click >= 8.0** - CLI framework with colored help
|
|
395
|
+
- **click-help-colors >= 0.9** - Colored CLI help text
|
|
396
|
+
- **pyyaml >= 6.0** - YAML configuration support
|
|
397
|
+
- **structlog >= 22.0** - Structured logging
|
|
398
|
+
- **fastapi >= 0.104.0** - REST API framework
|
|
399
|
+
- **uvicorn >= 0.24.0** - ASGI server
|
|
400
|
+
- **pydantic >= 2.0.0** - Data validation and serialization
|
|
401
|
+
- **HAP-python[QRCode] >= 5.0.0** - HomeKit integration
|
|
402
|
+
|
|
403
|
+
### Development Dependencies
|
|
404
|
+
|
|
405
|
+
- **pytest >= 7.0** - Testing framework
|
|
406
|
+
- **pytest-cov >= 4.0** - Coverage reporting
|
|
407
|
+
- **black >= 22.0** - Code formatting
|
|
408
|
+
- **ruff >= 0.1.0** - Modern Python linting
|
|
409
|
+
- **mypy >= 1.0** - Static type checking
|
|
410
|
+
- **vulture >= 2.14** - Dead code detection
|
|
411
|
+
- **httpx >= 0.24.0** - HTTP client for testing
|
|
412
|
+
|
|
413
|
+
## License
|
|
414
|
+
|
|
415
|
+
MIT License - see LICENSE file for details.
|
|
416
|
+
|
|
417
|
+
## Notice
|
|
418
|
+
|
|
419
|
+
This software is developed for **interoperability purposes only** under fair use provisions and EU Software Directive Article 6. See NOTICE.md for full details on intellectual property compliance.
|