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.
Files changed (197) hide show
  1. conson_xp-0.9.2/LICENSE +29 -0
  2. conson_xp-0.9.2/PKG-INFO +419 -0
  3. conson_xp-0.9.2/README.md +370 -0
  4. conson_xp-0.9.2/pyproject.toml +171 -0
  5. conson_xp-0.9.2/src/xp/__init__.py +7 -0
  6. conson_xp-0.9.2/src/xp/api/__init__.py +1 -0
  7. conson_xp-0.9.2/src/xp/api/main.py +118 -0
  8. conson_xp-0.9.2/src/xp/api/models/__init__.py +1 -0
  9. conson_xp-0.9.2/src/xp/api/models/api.py +18 -0
  10. conson_xp-0.9.2/src/xp/api/models/discover.py +16 -0
  11. conson_xp-0.9.2/src/xp/api/routers/__init__.py +15 -0
  12. conson_xp-0.9.2/src/xp/api/routers/conbus.py +5 -0
  13. conson_xp-0.9.2/src/xp/api/routers/conbus_blink.py +86 -0
  14. conson_xp-0.9.2/src/xp/api/routers/conbus_custom.py +54 -0
  15. conson_xp-0.9.2/src/xp/api/routers/conbus_datapoint.py +56 -0
  16. conson_xp-0.9.2/src/xp/api/routers/conbus_discover.py +46 -0
  17. conson_xp-0.9.2/src/xp/api/routers/conbus_output.py +119 -0
  18. conson_xp-0.9.2/src/xp/api/routers/errors.py +35 -0
  19. conson_xp-0.9.2/src/xp/cli/__init__.py +5 -0
  20. conson_xp-0.9.2/src/xp/cli/__main__.py +6 -0
  21. conson_xp-0.9.2/src/xp/cli/commands/__init__.py +31 -0
  22. conson_xp-0.9.2/src/xp/cli/commands/api.py +14 -0
  23. conson_xp-0.9.2/src/xp/cli/commands/api_start_commands.py +111 -0
  24. conson_xp-0.9.2/src/xp/cli/commands/cache_commands.py +207 -0
  25. conson_xp-0.9.2/src/xp/cli/commands/conbus.py +29 -0
  26. conson_xp-0.9.2/src/xp/cli/commands/conbus_blink_commands.py +112 -0
  27. conson_xp-0.9.2/src/xp/cli/commands/conbus_config_commands.py +31 -0
  28. conson_xp-0.9.2/src/xp/cli/commands/conbus_custom_commands.py +51 -0
  29. conson_xp-0.9.2/src/xp/cli/commands/conbus_datapoint_commands.py +58 -0
  30. conson_xp-0.9.2/src/xp/cli/commands/conbus_discover_commands.py +37 -0
  31. conson_xp-0.9.2/src/xp/cli/commands/conbus_output_commands.py +103 -0
  32. conson_xp-0.9.2/src/xp/cli/commands/conbus_raw_commands.py +50 -0
  33. conson_xp-0.9.2/src/xp/cli/commands/conbus_receive_commands.py +47 -0
  34. conson_xp-0.9.2/src/xp/cli/commands/conbus_scan_commands.py +124 -0
  35. conson_xp-0.9.2/src/xp/cli/commands/file_commands.py +172 -0
  36. conson_xp-0.9.2/src/xp/cli/commands/homekit.py +80 -0
  37. conson_xp-0.9.2/src/xp/cli/commands/homekit_start_commands.py +40 -0
  38. conson_xp-0.9.2/src/xp/cli/commands/module_commands.py +164 -0
  39. conson_xp-0.9.2/src/xp/cli/commands/reverse_proxy_commands.py +164 -0
  40. conson_xp-0.9.2/src/xp/cli/commands/server_commands.py +130 -0
  41. conson_xp-0.9.2/src/xp/cli/commands/telegram.py +37 -0
  42. conson_xp-0.9.2/src/xp/cli/commands/telegram_blink_commands.py +72 -0
  43. conson_xp-0.9.2/src/xp/cli/commands/telegram_checksum_commands.py +96 -0
  44. conson_xp-0.9.2/src/xp/cli/commands/telegram_discover_commands.py +40 -0
  45. conson_xp-0.9.2/src/xp/cli/commands/telegram_linknumber_commands.py +76 -0
  46. conson_xp-0.9.2/src/xp/cli/commands/telegram_parse_commands.py +74 -0
  47. conson_xp-0.9.2/src/xp/cli/commands/telegram_version_commands.py +43 -0
  48. conson_xp-0.9.2/src/xp/cli/main.py +48 -0
  49. conson_xp-0.9.2/src/xp/cli/utils/__init__.py +2 -0
  50. conson_xp-0.9.2/src/xp/cli/utils/click_tree.py +32 -0
  51. conson_xp-0.9.2/src/xp/cli/utils/datapoint_type_choice.py +29 -0
  52. conson_xp-0.9.2/src/xp/cli/utils/decorators.py +185 -0
  53. conson_xp-0.9.2/src/xp/cli/utils/error_handlers.py +166 -0
  54. conson_xp-0.9.2/src/xp/cli/utils/formatters.py +225 -0
  55. conson_xp-0.9.2/src/xp/cli/utils/serial_number_type.py +28 -0
  56. conson_xp-0.9.2/src/xp/cli/utils/system_function_choice.py +29 -0
  57. conson_xp-0.9.2/src/xp/connection/__init__.py +13 -0
  58. conson_xp-0.9.2/src/xp/connection/exceptions.py +24 -0
  59. conson_xp-0.9.2/src/xp/models/__init__.py +31 -0
  60. conson_xp-0.9.2/src/xp/models/action_type.py +17 -0
  61. conson_xp-0.9.2/src/xp/models/cache.py +106 -0
  62. conson_xp-0.9.2/src/xp/models/conbus.py +55 -0
  63. conson_xp-0.9.2/src/xp/models/conbus_blink.py +40 -0
  64. conson_xp-0.9.2/src/xp/models/conbus_client_config.py +14 -0
  65. conson_xp-0.9.2/src/xp/models/conbus_connection_status.py +26 -0
  66. conson_xp-0.9.2/src/xp/models/conbus_custom.py +39 -0
  67. conson_xp-0.9.2/src/xp/models/conbus_datapoint.py +42 -0
  68. conson_xp-0.9.2/src/xp/models/conbus_discover.py +31 -0
  69. conson_xp-0.9.2/src/xp/models/conbus_output.py +40 -0
  70. conson_xp-0.9.2/src/xp/models/conbus_raw.py +30 -0
  71. conson_xp-0.9.2/src/xp/models/conbus_receive.py +28 -0
  72. conson_xp-0.9.2/src/xp/models/datapoint_type.py +51 -0
  73. conson_xp-0.9.2/src/xp/models/event_telegram.py +101 -0
  74. conson_xp-0.9.2/src/xp/models/event_type.py +8 -0
  75. conson_xp-0.9.2/src/xp/models/homekit_accessory.py +20 -0
  76. conson_xp-0.9.2/src/xp/models/homekit_config.py +37 -0
  77. conson_xp-0.9.2/src/xp/models/homekit_conson_config.py +27 -0
  78. conson_xp-0.9.2/src/xp/models/homekit_lightbulb.py +68 -0
  79. conson_xp-0.9.2/src/xp/models/homekit_outlet.py +91 -0
  80. conson_xp-0.9.2/src/xp/models/input_type.py +9 -0
  81. conson_xp-0.9.2/src/xp/models/log_entry.py +93 -0
  82. conson_xp-0.9.2/src/xp/models/module_type.py +133 -0
  83. conson_xp-0.9.2/src/xp/models/module_type_code.py +163 -0
  84. conson_xp-0.9.2/src/xp/models/output_telegram.py +73 -0
  85. conson_xp-0.9.2/src/xp/models/reply_telegram.py +226 -0
  86. conson_xp-0.9.2/src/xp/models/response.py +42 -0
  87. conson_xp-0.9.2/src/xp/models/system_function.py +39 -0
  88. conson_xp-0.9.2/src/xp/models/system_telegram.py +58 -0
  89. conson_xp-0.9.2/src/xp/models/telegram.py +16 -0
  90. conson_xp-0.9.2/src/xp/models/write_config_type.py +18 -0
  91. conson_xp-0.9.2/src/xp/services/__init__.py +20 -0
  92. conson_xp-0.9.2/src/xp/services/base_server_service.py +201 -0
  93. conson_xp-0.9.2/src/xp/services/conbus_blink_service.py +139 -0
  94. conson_xp-0.9.2/src/xp/services/conbus_connection_pool.py +178 -0
  95. conson_xp-0.9.2/src/xp/services/conbus_custom_service.py +68 -0
  96. conson_xp-0.9.2/src/xp/services/conbus_datapoint_service.py +72 -0
  97. conson_xp-0.9.2/src/xp/services/conbus_discover_service.py +82 -0
  98. conson_xp-0.9.2/src/xp/services/conbus_output_service.py +112 -0
  99. conson_xp-0.9.2/src/xp/services/conbus_raw_service.py +72 -0
  100. conson_xp-0.9.2/src/xp/services/conbus_receive_service.py +69 -0
  101. conson_xp-0.9.2/src/xp/services/conbus_scan_service.py +105 -0
  102. conson_xp-0.9.2/src/xp/services/conbus_service.py +306 -0
  103. conson_xp-0.9.2/src/xp/services/cp20_server_service.py +47 -0
  104. conson_xp-0.9.2/src/xp/services/homekit_cache_service.py +234 -0
  105. conson_xp-0.9.2/src/xp/services/homekit_config_validator.py +211 -0
  106. conson_xp-0.9.2/src/xp/services/homekit_conson_config_service.py +73 -0
  107. conson_xp-0.9.2/src/xp/services/homekit_module_service.py +112 -0
  108. conson_xp-0.9.2/src/xp/services/homekit_service.py +114 -0
  109. conson_xp-0.9.2/src/xp/services/log_file_service.py +313 -0
  110. conson_xp-0.9.2/src/xp/services/module_type_service.py +237 -0
  111. conson_xp-0.9.2/src/xp/services/reverse_proxy_service.py +379 -0
  112. conson_xp-0.9.2/src/xp/services/server_service.py +289 -0
  113. conson_xp-0.9.2/src/xp/services/telegram_blink_service.py +150 -0
  114. conson_xp-0.9.2/src/xp/services/telegram_checksum_service.py +171 -0
  115. conson_xp-0.9.2/src/xp/services/telegram_discover_service.py +248 -0
  116. conson_xp-0.9.2/src/xp/services/telegram_link_number_service.py +233 -0
  117. conson_xp-0.9.2/src/xp/services/telegram_output_service.py +319 -0
  118. conson_xp-0.9.2/src/xp/services/telegram_service.py +373 -0
  119. conson_xp-0.9.2/src/xp/services/telegram_version_service.py +302 -0
  120. conson_xp-0.9.2/src/xp/services/xp130_server_service.py +94 -0
  121. conson_xp-0.9.2/src/xp/services/xp20_server_service.py +84 -0
  122. conson_xp-0.9.2/src/xp/services/xp230_server_service.py +67 -0
  123. conson_xp-0.9.2/src/xp/services/xp24_server_service.py +89 -0
  124. conson_xp-0.9.2/src/xp/services/xp33_server_service.py +155 -0
  125. conson_xp-0.9.2/src/xp/utils/__init__.py +12 -0
  126. conson_xp-0.9.2/src/xp/utils/checksum.py +124 -0
  127. conson_xp-0.9.2/src/xp/utils/event_helper.py +29 -0
  128. conson_xp-0.9.2/src/xp/utils/time_utils.py +139 -0
  129. conson_xp-0.9.2/tests/.coverage +0 -0
  130. conson_xp-0.9.2/tests/__init__.py +0 -0
  131. conson_xp-0.9.2/tests/integration/.coverage +0 -0
  132. conson_xp-0.9.2/tests/integration/__init__.py +0 -0
  133. conson_xp-0.9.2/tests/integration/telegram_test_data.py +150 -0
  134. conson_xp-0.9.2/tests/integration/test_api/.coverage +0 -0
  135. conson_xp-0.9.2/tests/integration/test_api/__init__.py +1 -0
  136. conson_xp-0.9.2/tests/integration/test_blink_integration.py +317 -0
  137. conson_xp-0.9.2/tests/integration/test_cache_integration.py +313 -0
  138. conson_xp-0.9.2/tests/integration/test_checksum_integration.py +272 -0
  139. conson_xp-0.9.2/tests/integration/test_conbus_blink_integration.py +190 -0
  140. conson_xp-0.9.2/tests/integration/test_conbus_raw_integration.py +164 -0
  141. conson_xp-0.9.2/tests/integration/test_conbus_receive_integration.py +160 -0
  142. conson_xp-0.9.2/tests/integration/test_discovery_integration.py +140 -0
  143. conson_xp-0.9.2/tests/integration/test_event_telegram_integration.py +190 -0
  144. conson_xp-0.9.2/tests/integration/test_homekit_config_integration.py +297 -0
  145. conson_xp-0.9.2/tests/integration/test_link_number_integration.py +224 -0
  146. conson_xp-0.9.2/tests/integration/test_module_integration.py +289 -0
  147. conson_xp-0.9.2/tests/integration/test_output_integration.py +160 -0
  148. conson_xp-0.9.2/tests/integration/test_reverse_proxy_integration.py +333 -0
  149. conson_xp-0.9.2/tests/integration/test_system_reply_telegram_integration.py +502 -0
  150. conson_xp-0.9.2/tests/integration/test_version_integration.py +230 -0
  151. conson_xp-0.9.2/tests/unit/__init__.py +0 -0
  152. conson_xp-0.9.2/tests/unit/test_api/__init__.py +1 -0
  153. conson_xp-0.9.2/tests/unit/test_cli/__init__.py +0 -0
  154. conson_xp-0.9.2/tests/unit/test_cli/test_conbus_blink_commands.py +40 -0
  155. conson_xp-0.9.2/tests/unit/test_cli/test_serial_number_type.py +81 -0
  156. conson_xp-0.9.2/tests/unit/test_connection/__init__.py +0 -0
  157. conson_xp-0.9.2/tests/unit/test_encoding/__init__.py +1 -0
  158. conson_xp-0.9.2/tests/unit/test_encoding/test_latin1_edge_cases.py +217 -0
  159. conson_xp-0.9.2/tests/unit/test_models/.coverage +0 -0
  160. conson_xp-0.9.2/tests/unit/test_models/__init__.py +0 -0
  161. conson_xp-0.9.2/tests/unit/test_models/test_cache.py +175 -0
  162. conson_xp-0.9.2/tests/unit/test_models/test_conbus_client_send.py +199 -0
  163. conson_xp-0.9.2/tests/unit/test_models/test_event_telegram.py +149 -0
  164. conson_xp-0.9.2/tests/unit/test_models/test_log_entry.py +301 -0
  165. conson_xp-0.9.2/tests/unit/test_models/test_module_type.py +187 -0
  166. conson_xp-0.9.2/tests/unit/test_models/test_reply_telegram.py +439 -0
  167. conson_xp-0.9.2/tests/unit/test_models/test_system_telegram.py +289 -0
  168. conson_xp-0.9.2/tests/unit/test_models/test_system_telegram_enhancements.py +232 -0
  169. conson_xp-0.9.2/tests/unit/test_models/test_version_telegram.py +195 -0
  170. conson_xp-0.9.2/tests/unit/test_models/test_xp24_action_telegram.py +180 -0
  171. conson_xp-0.9.2/tests/unit/test_services/.coverage +0 -0
  172. conson_xp-0.9.2/tests/unit/test_services/__init__.py +0 -0
  173. conson_xp-0.9.2/tests/unit/test_services/test_base_server_service.py +107 -0
  174. conson_xp-0.9.2/tests/unit/test_services/test_blink_service.py +201 -0
  175. conson_xp-0.9.2/tests/unit/test_services/test_checksum_service.py +270 -0
  176. conson_xp-0.9.2/tests/unit/test_services/test_conbus_datapoint_service.py +237 -0
  177. conson_xp-0.9.2/tests/unit/test_services/test_conbus_reverse_proxy_service.py +305 -0
  178. conson_xp-0.9.2/tests/unit/test_services/test_conbus_service.py +122 -0
  179. conson_xp-0.9.2/tests/unit/test_services/test_discovery_service.py +238 -0
  180. conson_xp-0.9.2/tests/unit/test_services/test_homekit_cache_service.py +364 -0
  181. conson_xp-0.9.2/tests/unit/test_services/test_homekit_config_validator.py +306 -0
  182. conson_xp-0.9.2/tests/unit/test_services/test_homekit_conson_service.py +178 -0
  183. conson_xp-0.9.2/tests/unit/test_services/test_link_number_service.py +226 -0
  184. conson_xp-0.9.2/tests/unit/test_services/test_log_file_service.py +438 -0
  185. conson_xp-0.9.2/tests/unit/test_services/test_module_type_service.py +217 -0
  186. conson_xp-0.9.2/tests/unit/test_services/test_telegram_input_service.py +187 -0
  187. conson_xp-0.9.2/tests/unit/test_services/test_telegram_service.py +458 -0
  188. conson_xp-0.9.2/tests/unit/test_services/test_version_service.py +304 -0
  189. conson_xp-0.9.2/tests/unit/test_services/test_xp130_server_service.py +259 -0
  190. conson_xp-0.9.2/tests/unit/test_services/test_xp20_server_service.py +98 -0
  191. conson_xp-0.9.2/tests/unit/test_services/test_xp230_server_service.py +236 -0
  192. conson_xp-0.9.2/tests/unit/test_services/test_xp24_action_service.py +228 -0
  193. conson_xp-0.9.2/tests/unit/test_services/test_xp24_server_service.py +120 -0
  194. conson_xp-0.9.2/tests/unit/test_services/test_xp33_server_service.py +357 -0
  195. conson_xp-0.9.2/tests/unit/test_utils/__init__.py +0 -0
  196. conson_xp-0.9.2/tests/unit/test_utils/test_checksum.py +212 -0
  197. conson_xp-0.9.2/tests/unit/test_utils/test_time_utils.py +214 -0
@@ -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.
@@ -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.