conson-xp 1.45.0__py3-none-any.whl → 1.47.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/METADATA +1 -1
- conson_xp-1.47.0.dist-info/RECORD +210 -0
- xp/__init__.py +3 -2
- xp/cli/commands/conbus/conbus.py +1 -1
- xp/cli/commands/conbus/conbus_actiontable_commands.py +33 -15
- xp/cli/commands/conbus/conbus_autoreport_commands.py +8 -4
- xp/cli/commands/conbus/conbus_blink_commands.py +20 -10
- xp/cli/commands/conbus/conbus_config_commands.py +2 -1
- xp/cli/commands/conbus/conbus_custom_commands.py +4 -2
- xp/cli/commands/conbus/conbus_datapoint_commands.py +10 -5
- xp/cli/commands/conbus/conbus_discover_commands.py +8 -4
- xp/cli/commands/conbus/conbus_event_commands.py +8 -4
- xp/cli/commands/conbus/conbus_export_commands.py +8 -4
- xp/cli/commands/conbus/conbus_lightlevel_commands.py +16 -8
- xp/cli/commands/conbus/conbus_linknumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_modulenumber_commands.py +8 -4
- xp/cli/commands/conbus/conbus_msactiontable_commands.py +78 -40
- xp/cli/commands/conbus/conbus_output_commands.py +16 -8
- xp/cli/commands/conbus/conbus_raw_commands.py +6 -3
- xp/cli/commands/conbus/conbus_receive_commands.py +6 -3
- xp/cli/commands/conbus/conbus_scan_commands.py +6 -3
- xp/cli/commands/file_commands.py +6 -3
- xp/cli/commands/homekit/homekit.py +4 -2
- xp/cli/commands/homekit/homekit_start_commands.py +2 -1
- xp/cli/commands/module_commands.py +8 -4
- xp/cli/commands/reverse_proxy_commands.py +8 -4
- xp/cli/commands/server/server_commands.py +6 -3
- xp/cli/commands/telegram/telegram_blink_commands.py +4 -2
- xp/cli/commands/telegram/telegram_checksum_commands.py +4 -2
- xp/cli/commands/telegram/telegram_discover_commands.py +2 -1
- xp/cli/commands/telegram/telegram_linknumber_commands.py +4 -2
- xp/cli/commands/telegram/telegram_parse_commands.py +4 -2
- xp/cli/commands/telegram/telegram_version_commands.py +2 -1
- xp/cli/commands/term/term_commands.py +4 -2
- xp/cli/main.py +2 -1
- xp/cli/utils/click_tree.py +6 -3
- xp/cli/utils/datapoint_type_choice.py +4 -2
- xp/cli/utils/decorators.py +42 -21
- xp/cli/utils/error_handlers.py +16 -8
- xp/cli/utils/formatters.py +22 -11
- xp/cli/utils/module_type_choice.py +4 -2
- xp/cli/utils/serial_number_type.py +4 -2
- xp/cli/utils/system_function_choice.py +4 -2
- xp/cli/utils/xp_module_type.py +4 -2
- xp/models/actiontable/actiontable.py +8 -8
- xp/models/actiontable/actiontable_type.py +20 -0
- xp/models/actiontable/msactiontable_xp20.py +8 -4
- xp/models/actiontable/msactiontable_xp24.py +12 -6
- xp/models/actiontable/msactiontable_xp33.py +20 -10
- xp/models/conbus/conbus.py +8 -4
- xp/models/conbus/conbus_autoreport.py +4 -2
- xp/models/conbus/conbus_blink.py +4 -2
- xp/models/conbus/conbus_client_config.py +6 -3
- xp/models/conbus/conbus_connection_status.py +4 -2
- xp/models/conbus/conbus_custom.py +4 -2
- xp/models/conbus/conbus_datapoint.py +4 -2
- xp/models/conbus/conbus_discover.py +6 -3
- xp/models/conbus/conbus_event_list.py +4 -2
- xp/models/conbus/conbus_event_raw.py +4 -2
- xp/models/conbus/conbus_export.py +2 -1
- xp/models/conbus/conbus_lightlevel.py +4 -2
- xp/models/conbus/conbus_linknumber.py +4 -2
- xp/models/conbus/conbus_logger_config.py +8 -4
- xp/models/conbus/conbus_output.py +4 -2
- xp/models/conbus/conbus_raw.py +4 -2
- xp/models/conbus/conbus_receive.py +4 -2
- xp/models/conbus/conbus_writeconfig.py +4 -2
- xp/models/config/conson_module_config.py +8 -4
- xp/models/homekit/homekit_accessory.py +4 -2
- xp/models/homekit/homekit_config.py +12 -6
- xp/models/log_entry.py +16 -8
- xp/models/protocol/conbus_protocol.py +36 -18
- xp/models/response.py +12 -8
- xp/models/telegram/action_type.py +4 -2
- xp/models/telegram/datapoint_type.py +4 -2
- xp/models/telegram/event_telegram.py +14 -7
- xp/models/telegram/event_type.py +2 -1
- xp/models/telegram/input_action_type.py +2 -1
- xp/models/telegram/input_type.py +2 -1
- xp/models/telegram/module_type.py +24 -12
- xp/models/telegram/module_type_code.py +2 -1
- xp/models/telegram/output_telegram.py +16 -10
- xp/models/telegram/reply_telegram.py +24 -13
- xp/models/telegram/system_function.py +6 -3
- xp/models/telegram/system_telegram.py +10 -6
- xp/models/telegram/telegram.py +2 -1
- xp/models/telegram/telegram_type.py +2 -1
- xp/models/telegram/timeparam_type.py +2 -1
- xp/models/term/connection_state.py +4 -2
- xp/models/term/module_state.py +2 -1
- xp/models/term/protocol_keys_config.py +6 -3
- xp/models/term/status_message.py +2 -1
- xp/models/term/telegram_display.py +2 -1
- xp/models/write_config_type.py +4 -2
- xp/services/actiontable/actiontable_serializer.py +34 -41
- xp/services/actiontable/download_state_machine.py +281 -0
- xp/services/actiontable/msactiontable_xp20_serializer.py +77 -49
- xp/services/actiontable/msactiontable_xp24_serializer.py +78 -53
- xp/services/actiontable/msactiontable_xp33_serializer.py +39 -9
- xp/services/actiontable/serializer_protocol.py +76 -0
- xp/services/conbus/actiontable/actiontable_download_service.py +134 -280
- xp/services/conbus/actiontable/actiontable_list_service.py +17 -4
- xp/services/conbus/actiontable/actiontable_show_service.py +10 -6
- xp/services/conbus/actiontable/actiontable_upload_service.py +17 -9
- xp/services/conbus/conbus_blink_all_service.py +16 -8
- xp/services/conbus/conbus_blink_service.py +14 -7
- xp/services/conbus/conbus_custom_service.py +16 -8
- xp/services/conbus/conbus_datapoint_queryall_service.py +18 -9
- xp/services/conbus/conbus_datapoint_service.py +18 -9
- xp/services/conbus/conbus_discover_service.py +24 -13
- xp/services/conbus/conbus_event_list_service.py +11 -7
- xp/services/conbus/conbus_event_raw_service.py +18 -10
- xp/services/conbus/conbus_export_service.py +28 -14
- xp/services/conbus/conbus_output_service.py +18 -10
- xp/services/conbus/conbus_raw_service.py +16 -8
- xp/services/conbus/conbus_receive_service.py +18 -10
- xp/services/conbus/conbus_scan_service.py +18 -10
- xp/services/conbus/msactiontable/msactiontable_upload_service.py +17 -9
- xp/services/conbus/write_config_service.py +18 -9
- xp/services/homekit/homekit_cache_service.py +12 -6
- xp/services/homekit/homekit_conbus_service.py +12 -6
- xp/services/homekit/homekit_config_validator.py +34 -17
- xp/services/homekit/homekit_conson_validator.py +18 -9
- xp/services/homekit/homekit_dimminglight.py +14 -7
- xp/services/homekit/homekit_dimminglight_service.py +14 -7
- xp/services/homekit/homekit_hap_service.py +18 -9
- xp/services/homekit/homekit_lightbulb.py +10 -5
- xp/services/homekit/homekit_lightbulb_service.py +10 -5
- xp/services/homekit/homekit_module_service.py +8 -4
- xp/services/homekit/homekit_outlet.py +14 -7
- xp/services/homekit/homekit_outlet_service.py +12 -6
- xp/services/homekit/homekit_service.py +24 -12
- xp/services/log_file_service.py +16 -8
- xp/services/module_type_service.py +10 -5
- xp/services/protocol/conbus_event_protocol.py +140 -21
- 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 +26 -31
- 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.45.0.dist-info/RECORD +0 -210
- 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.45.0.dist-info → conson_xp-1.47.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.45.0.dist-info → conson_xp-1.47.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -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.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Outlet Service.
|
|
2
3
|
|
|
3
4
|
This module provides service implementation for outlet accessories.
|
|
4
5
|
"""
|
|
@@ -18,7 +19,8 @@ from xp.models.telegram.datapoint_type import DataPointType
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class HomeKitOutletService:
|
|
21
|
-
"""
|
|
22
|
+
"""
|
|
23
|
+
Outlet service for HomeKit.
|
|
22
24
|
|
|
23
25
|
Attributes:
|
|
24
26
|
event_bus: Event bus for inter-service communication.
|
|
@@ -28,7 +30,8 @@ class HomeKitOutletService:
|
|
|
28
30
|
event_bus: EventBus
|
|
29
31
|
|
|
30
32
|
def __init__(self, event_bus: EventBus):
|
|
31
|
-
"""
|
|
33
|
+
"""
|
|
34
|
+
Initialize the outlet service.
|
|
32
35
|
|
|
33
36
|
Args:
|
|
34
37
|
event_bus: Event bus instance.
|
|
@@ -42,7 +45,8 @@ class HomeKitOutletService:
|
|
|
42
45
|
self.event_bus.on(OutletGetInUseEvent, self.handle_outlet_get_in_use)
|
|
43
46
|
|
|
44
47
|
def handle_outlet_get_on(self, event: OutletGetOnEvent) -> bool:
|
|
45
|
-
"""
|
|
48
|
+
"""
|
|
49
|
+
Handle outlet get on event.
|
|
46
50
|
|
|
47
51
|
Args:
|
|
48
52
|
event: Outlet get on event.
|
|
@@ -65,7 +69,8 @@ class HomeKitOutletService:
|
|
|
65
69
|
return True
|
|
66
70
|
|
|
67
71
|
def handle_outlet_set_on(self, event: OutletSetOnEvent) -> bool:
|
|
68
|
-
"""
|
|
72
|
+
"""
|
|
73
|
+
Handle outlet set on event.
|
|
69
74
|
|
|
70
75
|
Args:
|
|
71
76
|
event: Outlet set on event.
|
|
@@ -97,7 +102,8 @@ class HomeKitOutletService:
|
|
|
97
102
|
return True
|
|
98
103
|
|
|
99
104
|
def handle_outlet_get_in_use(self, event: OutletGetInUseEvent) -> bool:
|
|
100
|
-
"""
|
|
105
|
+
"""
|
|
106
|
+
Handle outlet get in-use event.
|
|
101
107
|
|
|
102
108
|
Args:
|
|
103
109
|
event: Outlet get in-use event.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
HomeKit Service for Apple HomeKit integration.
|
|
2
3
|
|
|
3
4
|
This module provides the main service for HomeKit integration.
|
|
4
5
|
"""
|
|
@@ -34,7 +35,8 @@ from xp.services.protocol.protocol_factory import TelegramFactory
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
class HomeKitService:
|
|
37
|
-
"""
|
|
38
|
+
"""
|
|
39
|
+
Main HomeKit service for Apple HomeKit integration.
|
|
38
40
|
|
|
39
41
|
Attributes:
|
|
40
42
|
cli_config: Conbus client configuration.
|
|
@@ -66,7 +68,8 @@ class HomeKitService:
|
|
|
66
68
|
module_factory: HomekitHapService,
|
|
67
69
|
telegram_service: TelegramService,
|
|
68
70
|
):
|
|
69
|
-
"""
|
|
71
|
+
"""
|
|
72
|
+
Initialize the HomeKit service.
|
|
70
73
|
|
|
71
74
|
Args:
|
|
72
75
|
cli_config: Conbus client configuration.
|
|
@@ -142,7 +145,8 @@ class HomeKitService:
|
|
|
142
145
|
self.reactor.run()
|
|
143
146
|
|
|
144
147
|
def _start_module_factory(self) -> None:
|
|
145
|
-
"""
|
|
148
|
+
"""
|
|
149
|
+
Start module factory after reactor starts.
|
|
146
150
|
|
|
147
151
|
Creates and schedules an async task to start the HAP service.
|
|
148
152
|
"""
|
|
@@ -181,7 +185,8 @@ class HomeKitService:
|
|
|
181
185
|
event.protocol.sendFrame(b"S0000000000F01D00")
|
|
182
186
|
|
|
183
187
|
def handle_connection_failed(self, event: ConnectionFailedEvent) -> None:
|
|
184
|
-
"""
|
|
188
|
+
"""
|
|
189
|
+
Handle connection failed.
|
|
185
190
|
|
|
186
191
|
Args:
|
|
187
192
|
event: Connection failed event.
|
|
@@ -189,7 +194,8 @@ class HomeKitService:
|
|
|
189
194
|
self.logger.error(f"Connection failed: {event.reason}")
|
|
190
195
|
|
|
191
196
|
def handle_connection_lost(self, event: ConnectionLostEvent) -> None:
|
|
192
|
-
"""
|
|
197
|
+
"""
|
|
198
|
+
Handle connection lost.
|
|
193
199
|
|
|
194
200
|
Args:
|
|
195
201
|
event: Connection lost event.
|
|
@@ -199,7 +205,8 @@ class HomeKitService:
|
|
|
199
205
|
)
|
|
200
206
|
|
|
201
207
|
def handle_telegram_received(self, event: TelegramReceivedEvent) -> str:
|
|
202
|
-
"""
|
|
208
|
+
"""
|
|
209
|
+
Handle received telegram events.
|
|
203
210
|
|
|
204
211
|
Args:
|
|
205
212
|
event: Telegram received event.
|
|
@@ -236,7 +243,8 @@ class HomeKitService:
|
|
|
236
243
|
return event.frame
|
|
237
244
|
|
|
238
245
|
def dispatch_light_level_event(self, event: TelegramReceivedEvent) -> None:
|
|
239
|
-
"""
|
|
246
|
+
"""
|
|
247
|
+
Dispatch light level received event.
|
|
240
248
|
|
|
241
249
|
Args:
|
|
242
250
|
event: Telegram received event.
|
|
@@ -260,7 +268,8 @@ class HomeKitService:
|
|
|
260
268
|
self.logger.debug("LightLevelReceivedEvent dispatched successfully")
|
|
261
269
|
|
|
262
270
|
def dispatch_output_state_event(self, event: TelegramReceivedEvent) -> None:
|
|
263
|
-
"""
|
|
271
|
+
"""
|
|
272
|
+
Dispatch output state received event.
|
|
264
273
|
|
|
265
274
|
Args:
|
|
266
275
|
event: Telegram received event.
|
|
@@ -286,7 +295,8 @@ class HomeKitService:
|
|
|
286
295
|
def dispatch_event_telegram_received_event(
|
|
287
296
|
self, event: TelegramReceivedEvent
|
|
288
297
|
) -> None:
|
|
289
|
-
"""
|
|
298
|
+
"""
|
|
299
|
+
Dispatch event telegram received event.
|
|
290
300
|
|
|
291
301
|
Args:
|
|
292
302
|
event: Telegram received event.
|
|
@@ -319,7 +329,8 @@ class HomeKitService:
|
|
|
319
329
|
self.logger.debug("ModuleStateChangedEvent dispatched successfully")
|
|
320
330
|
|
|
321
331
|
def dispatch_module_discovered_event(self, event: TelegramReceivedEvent) -> None:
|
|
322
|
-
"""
|
|
332
|
+
"""
|
|
333
|
+
Dispatch module discovered event.
|
|
323
334
|
|
|
324
335
|
Args:
|
|
325
336
|
event: Telegram received event.
|
|
@@ -339,7 +350,8 @@ class HomeKitService:
|
|
|
339
350
|
self.logger.debug("ModuleDiscoveredEvent dispatched successfully")
|
|
340
351
|
|
|
341
352
|
def handle_module_discovered(self, event: ModuleDiscoveredEvent) -> str:
|
|
342
|
-
"""
|
|
353
|
+
"""
|
|
354
|
+
Handle module discovered event.
|
|
343
355
|
|
|
344
356
|
Args:
|
|
345
357
|
event: Module discovered event.
|
xp/services/log_file_service.py
CHANGED
|
@@ -38,7 +38,8 @@ class LogFileService:
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
def __init__(self, telegram_service: TelegramService):
|
|
41
|
-
"""
|
|
41
|
+
"""
|
|
42
|
+
Initialize the log file service.
|
|
42
43
|
|
|
43
44
|
Args:
|
|
44
45
|
telegram_service: Telegram service for parsing telegrams.
|
|
@@ -48,7 +49,8 @@ class LogFileService:
|
|
|
48
49
|
def parse_log_file(
|
|
49
50
|
self, file_path: str, base_date: Optional[datetime] = None
|
|
50
51
|
) -> List[LogEntry]:
|
|
51
|
-
"""
|
|
52
|
+
"""
|
|
53
|
+
Parse a console bus log file into LogEntry objects.
|
|
52
54
|
|
|
53
55
|
Args:
|
|
54
56
|
file_path: Path to the log file.
|
|
@@ -79,7 +81,8 @@ class LogFileService:
|
|
|
79
81
|
def parse_log_lines(
|
|
80
82
|
self, lines: List[str], base_date: Optional[datetime] = None
|
|
81
83
|
) -> List[LogEntry]:
|
|
82
|
-
"""
|
|
84
|
+
"""
|
|
85
|
+
Parse log lines into LogEntry objects.
|
|
83
86
|
|
|
84
87
|
Args:
|
|
85
88
|
lines: List of log lines to parse.
|
|
@@ -115,7 +118,8 @@ class LogFileService:
|
|
|
115
118
|
def _parse_log_line(
|
|
116
119
|
self, line: str, line_number: int, base_date: Optional[datetime] = None
|
|
117
120
|
) -> Optional[LogEntry]:
|
|
118
|
-
"""
|
|
121
|
+
"""
|
|
122
|
+
Parse a single log line into a LogEntry.
|
|
119
123
|
|
|
120
124
|
Args:
|
|
121
125
|
line: Log line to parse.
|
|
@@ -157,7 +161,8 @@ class LogFileService:
|
|
|
157
161
|
return entry
|
|
158
162
|
|
|
159
163
|
def validate_log_format(self, file_path: str) -> bool:
|
|
160
|
-
"""
|
|
164
|
+
"""
|
|
165
|
+
Validate that a file follows the expected log format.
|
|
161
166
|
|
|
162
167
|
Args:
|
|
163
168
|
file_path: Path to the log file.
|
|
@@ -174,7 +179,8 @@ class LogFileService:
|
|
|
174
179
|
return False
|
|
175
180
|
|
|
176
181
|
def extract_telegrams(self, file_path: str) -> List[str]:
|
|
177
|
-
"""
|
|
182
|
+
"""
|
|
183
|
+
Extract all telegram strings from a log file.
|
|
178
184
|
|
|
179
185
|
Args:
|
|
180
186
|
file_path: Path to the log file.
|
|
@@ -187,7 +193,8 @@ class LogFileService:
|
|
|
187
193
|
|
|
188
194
|
@staticmethod
|
|
189
195
|
def get_file_statistics(entries: List[LogEntry]) -> Dict[str, Any]:
|
|
190
|
-
"""
|
|
196
|
+
"""
|
|
197
|
+
Generate statistics for a list of log entries.
|
|
191
198
|
|
|
192
199
|
Args:
|
|
193
200
|
entries: List of LogEntry objects.
|
|
@@ -280,7 +287,8 @@ class LogFileService:
|
|
|
280
287
|
start_time: Optional[datetime] = None,
|
|
281
288
|
end_time: Optional[datetime] = None,
|
|
282
289
|
) -> List[LogEntry]:
|
|
283
|
-
"""
|
|
290
|
+
"""
|
|
291
|
+
Filter log entries based on criteria.
|
|
284
292
|
|
|
285
293
|
Args:
|
|
286
294
|
entries: List of LogEntry objects to filter.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Module Type Service for XP module management.
|
|
2
3
|
|
|
3
|
-
This module provides lookup, validation, and search functionality for XP system module
|
|
4
|
+
This module provides lookup, validation, and search functionality for XP system module
|
|
5
|
+
types.
|
|
4
6
|
"""
|
|
5
7
|
|
|
6
8
|
from typing import Dict, List, Optional, Union
|
|
@@ -199,7 +201,8 @@ class ModuleTypeService:
|
|
|
199
201
|
|
|
200
202
|
@staticmethod
|
|
201
203
|
def _format_module_summary(module_type: ModuleType) -> str:
|
|
202
|
-
"""
|
|
204
|
+
"""
|
|
205
|
+
Format a single module type for display.
|
|
203
206
|
|
|
204
207
|
Args:
|
|
205
208
|
module_type: The module type to format.
|
|
@@ -226,7 +229,8 @@ class ModuleTypeService:
|
|
|
226
229
|
|
|
227
230
|
@staticmethod
|
|
228
231
|
def _format_all_modules() -> str:
|
|
229
|
-
"""
|
|
232
|
+
"""
|
|
233
|
+
Format all modules in a simple list.
|
|
230
234
|
|
|
231
235
|
Returns:
|
|
232
236
|
Formatted string with all modules.
|
|
@@ -241,7 +245,8 @@ class ModuleTypeService:
|
|
|
241
245
|
|
|
242
246
|
@staticmethod
|
|
243
247
|
def _format_modules_by_category() -> str:
|
|
244
|
-
"""
|
|
248
|
+
"""
|
|
249
|
+
Format modules grouped by category.
|
|
245
250
|
|
|
246
251
|
Returns:
|
|
247
252
|
Formatted string with modules grouped by category.
|