conson-xp 1.36.0__py3-none-any.whl → 1.38.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.36.0.dist-info → conson_xp-1.38.0.dist-info}/METADATA +6 -1
- {conson_xp-1.36.0.dist-info → conson_xp-1.38.0.dist-info}/RECORD +51 -46
- xp/__init__.py +1 -1
- xp/cli/commands/__init__.py +2 -0
- xp/cli/commands/conbus/__init__.py +2 -0
- xp/cli/commands/conbus/conbus.py +26 -0
- xp/cli/commands/conbus/conbus_actiontable_commands.py +18 -9
- xp/cli/commands/conbus/conbus_autoreport_commands.py +5 -2
- xp/cli/commands/conbus/conbus_event_commands.py +1 -7
- xp/cli/commands/conbus/conbus_export_commands.py +7 -6
- xp/cli/commands/conbus/conbus_lightlevel_commands.py +2 -0
- xp/cli/commands/conbus/conbus_linknumber_commands.py +2 -0
- xp/cli/commands/conbus/conbus_modulenumber_commands.py +2 -0
- xp/cli/commands/conbus/conbus_msactiontable_commands.py +92 -9
- xp/cli/commands/conbus/conbus_output_commands.py +4 -0
- xp/models/actiontable/msactiontable.py +9 -0
- xp/models/actiontable/msactiontable_xp20.py +14 -14
- xp/models/actiontable/msactiontable_xp24.py +228 -11
- xp/models/actiontable/msactiontable_xp33.py +42 -14
- xp/models/conbus/conbus_export.py +6 -2
- xp/models/config/__init__.py +1 -0
- xp/models/{homekit/homekit_conson_config.py → config/conson_module_config.py} +3 -1
- xp/models/protocol/conbus_protocol.py +1 -1
- xp/models/telegram/datapoint_type.py +30 -0
- xp/services/actiontable/msactiontable_xp20_serializer.py +12 -0
- xp/services/actiontable/msactiontable_xp24_serializer.py +13 -1
- xp/services/actiontable/msactiontable_xp33_serializer.py +12 -0
- xp/services/conbus/actiontable/actiontable_download_service.py +8 -5
- xp/services/conbus/actiontable/actiontable_list_service.py +2 -1
- xp/services/conbus/actiontable/actiontable_show_service.py +2 -2
- xp/services/conbus/actiontable/actiontable_upload_service.py +1 -1
- xp/services/conbus/conbus_datapoint_service.py +1 -1
- xp/services/conbus/conbus_event_list_service.py +1 -1
- xp/services/conbus/conbus_export_service.py +1 -1
- xp/services/conbus/msactiontable/__init__.py +1 -0
- xp/services/conbus/{actiontable/msactiontable_service.py → msactiontable/msactiontable_download_service.py} +9 -6
- xp/services/conbus/msactiontable/msactiontable_list_service.py +92 -0
- xp/services/conbus/msactiontable/msactiontable_show_service.py +89 -0
- xp/services/homekit/homekit_config_validator.py +1 -1
- xp/services/homekit/homekit_conson_validator.py +1 -1
- xp/services/homekit/homekit_dimminglight.py +1 -1
- xp/services/homekit/homekit_lightbulb.py +1 -1
- xp/services/homekit/homekit_module_service.py +1 -1
- xp/services/homekit/homekit_outlet.py +1 -1
- xp/services/protocol/conbus_event_protocol.py +7 -3
- xp/services/server/server_service.py +1 -1
- xp/services/term/state_monitor_service.py +1 -1
- xp/utils/dependencies.py +36 -14
- {conson_xp-1.36.0.dist-info → conson_xp-1.38.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.36.0.dist-info → conson_xp-1.38.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.36.0.dist-info → conson_xp-1.38.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -59,7 +59,7 @@ class ActionTableListService:
|
|
|
59
59
|
|
|
60
60
|
# Load configuration
|
|
61
61
|
try:
|
|
62
|
-
from xp.models.
|
|
62
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
63
63
|
|
|
64
64
|
config = ConsonModuleListConfig.from_yaml(str(config_path))
|
|
65
65
|
except Exception as e:
|
|
@@ -72,6 +72,7 @@ class ActionTableListService:
|
|
|
72
72
|
{
|
|
73
73
|
"serial_number": module.serial_number,
|
|
74
74
|
"module_type": module.module_type,
|
|
75
|
+
"action_table": len(module.action_table) if module.action_table else 0,
|
|
75
76
|
}
|
|
76
77
|
for module in config.root
|
|
77
78
|
]
|
|
@@ -4,7 +4,7 @@ import logging
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import Any, Callable, Optional
|
|
6
6
|
|
|
7
|
-
from xp.models.
|
|
7
|
+
from xp.models.config.conson_module_config import ConsonModuleConfig
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ActionTableShowService:
|
|
@@ -61,7 +61,7 @@ class ActionTableShowService:
|
|
|
61
61
|
|
|
62
62
|
# Load configuration
|
|
63
63
|
try:
|
|
64
|
-
from xp.models.
|
|
64
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
65
65
|
|
|
66
66
|
config = ConsonModuleListConfig.from_yaml(str(config_path))
|
|
67
67
|
except Exception as e:
|
|
@@ -5,7 +5,7 @@ from typing import Any, Optional
|
|
|
5
5
|
|
|
6
6
|
from psygnal import Signal
|
|
7
7
|
|
|
8
|
-
from xp.models.
|
|
8
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
9
9
|
from xp.models.protocol.conbus_protocol import TelegramReceivedEvent
|
|
10
10
|
from xp.models.telegram.system_function import SystemFunction
|
|
11
11
|
from xp.models.telegram.telegram_type import TelegramType
|
|
@@ -9,7 +9,7 @@ from collections import defaultdict
|
|
|
9
9
|
from typing import Dict, List
|
|
10
10
|
|
|
11
11
|
from xp.models import ConbusEventListResponse
|
|
12
|
-
from xp.models.
|
|
12
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
13
13
|
from xp.services.actiontable.actiontable_serializer import ActionTableSerializer
|
|
14
14
|
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ import yaml
|
|
|
9
9
|
from psygnal import Signal
|
|
10
10
|
|
|
11
11
|
from xp.models.conbus.conbus_export import ConbusExportResponse
|
|
12
|
-
from xp.models.
|
|
12
|
+
from xp.models.config.conson_module_config import (
|
|
13
13
|
ConsonModuleConfig,
|
|
14
14
|
ConsonModuleListConfig,
|
|
15
15
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""MsAction table services for Conbus."""
|
|
@@ -5,6 +5,7 @@ from typing import Any, Optional, Union
|
|
|
5
5
|
|
|
6
6
|
from psygnal import Signal
|
|
7
7
|
|
|
8
|
+
from xp.models.actiontable.msactiontable import MsActionTable
|
|
8
9
|
from xp.models.actiontable.msactiontable_xp20 import Xp20MsActionTable
|
|
9
10
|
from xp.models.actiontable.msactiontable_xp24 import Xp24MsActionTable
|
|
10
11
|
from xp.models.actiontable.msactiontable_xp33 import Xp33MsActionTable
|
|
@@ -30,7 +31,7 @@ class MsActionTableError(Exception):
|
|
|
30
31
|
pass
|
|
31
32
|
|
|
32
33
|
|
|
33
|
-
class
|
|
34
|
+
class MsActionTableDownloadService:
|
|
34
35
|
"""
|
|
35
36
|
Service for downloading MS action tables via Conbus protocol.
|
|
36
37
|
|
|
@@ -46,7 +47,7 @@ class MsActionTableService:
|
|
|
46
47
|
|
|
47
48
|
on_progress: Signal = Signal(str)
|
|
48
49
|
on_error: Signal = Signal(str)
|
|
49
|
-
on_finish: Signal = Signal(
|
|
50
|
+
on_finish: Signal = Signal(MsActionTable, str) # Union type for Xp20/24/33 or None
|
|
50
51
|
|
|
51
52
|
def __init__(
|
|
52
53
|
self,
|
|
@@ -164,7 +165,8 @@ class MsActionTableService:
|
|
|
164
165
|
all_data = "".join(self.msactiontable_data)
|
|
165
166
|
# Deserialize from received data
|
|
166
167
|
msactiontable = self.serializer.from_data(all_data)
|
|
167
|
-
self.
|
|
168
|
+
msactiontable_short = self.serializer.format_decoded_output(msactiontable) # type: ignore[arg-type]
|
|
169
|
+
self.succeed(msactiontable, msactiontable_short)
|
|
168
170
|
return
|
|
169
171
|
|
|
170
172
|
self.logger.debug("Invalid msactiontable response")
|
|
@@ -182,18 +184,19 @@ class MsActionTableService:
|
|
|
182
184
|
"""
|
|
183
185
|
self.logger.debug(f"Failed: {message}")
|
|
184
186
|
self.on_error.emit(message)
|
|
185
|
-
self.on_finish.emit(None)
|
|
186
187
|
|
|
187
188
|
def succeed(
|
|
188
189
|
self,
|
|
189
190
|
msactiontable: Union[Xp20MsActionTable, Xp24MsActionTable, Xp33MsActionTable],
|
|
191
|
+
msactiontable_short: str,
|
|
190
192
|
) -> None:
|
|
191
193
|
"""Handle succeed connection event.
|
|
192
194
|
|
|
193
195
|
Args:
|
|
194
196
|
msactiontable: result.
|
|
197
|
+
msactiontable_short: result in short form.
|
|
195
198
|
"""
|
|
196
|
-
self.on_finish.emit(msactiontable)
|
|
199
|
+
self.on_finish.emit(msactiontable, msactiontable_short)
|
|
197
200
|
|
|
198
201
|
def start(
|
|
199
202
|
self,
|
|
@@ -242,7 +245,7 @@ class MsActionTableService:
|
|
|
242
245
|
"""Stop the reactor."""
|
|
243
246
|
self.conbus_protocol.stop_reactor()
|
|
244
247
|
|
|
245
|
-
def __enter__(self) -> "
|
|
248
|
+
def __enter__(self) -> "MsActionTableDownloadService":
|
|
246
249
|
"""Enter context manager.
|
|
247
250
|
|
|
248
251
|
Returns:
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Service for listing modules with action table configurations from conson.yml."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from psygnal import Signal
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MsActionTableListService:
|
|
11
|
+
"""Service for listing modules with action table configurations.
|
|
12
|
+
|
|
13
|
+
Reads conson.yml and returns a list of all modules that have action table
|
|
14
|
+
configurations defined.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
on_finish: Signal emitted with dict[str, Any] when listing completes.
|
|
18
|
+
on_error: Signal emitted with error message string when an error occurs.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
on_finish: Signal = Signal(object) # dict[str, Any]
|
|
22
|
+
on_error: Signal = Signal(str)
|
|
23
|
+
|
|
24
|
+
def __init__(self) -> None:
|
|
25
|
+
"""Initialize the action table list service."""
|
|
26
|
+
self.logger = logging.getLogger(__name__)
|
|
27
|
+
|
|
28
|
+
def __enter__(self) -> "MsActionTableListService":
|
|
29
|
+
"""Context manager entry.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
Self for context manager use.
|
|
33
|
+
"""
|
|
34
|
+
return self
|
|
35
|
+
|
|
36
|
+
def __exit__(self, _exc_type: Any, _exc_val: Any, _exc_tb: Any) -> None:
|
|
37
|
+
"""Context manager exit."""
|
|
38
|
+
# Disconnect service signals
|
|
39
|
+
self.on_finish.disconnect()
|
|
40
|
+
self.on_error.disconnect()
|
|
41
|
+
|
|
42
|
+
def start(
|
|
43
|
+
self,
|
|
44
|
+
config_path: Optional[Path] = None,
|
|
45
|
+
) -> None:
|
|
46
|
+
"""List all modules with action table configurations.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
config_path: Optional path to conson.yml. Defaults to current directory.
|
|
50
|
+
"""
|
|
51
|
+
# Default to current directory if not specified
|
|
52
|
+
if config_path is None:
|
|
53
|
+
config_path = Path.cwd() / "conson.yml"
|
|
54
|
+
|
|
55
|
+
# Check if config file exists
|
|
56
|
+
if not config_path.exists():
|
|
57
|
+
self._handle_error("Error: conson.yml not found in current directory")
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
# Load configuration
|
|
61
|
+
try:
|
|
62
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
63
|
+
|
|
64
|
+
config = ConsonModuleListConfig.from_yaml(str(config_path))
|
|
65
|
+
except Exception as e:
|
|
66
|
+
self.logger.error(f"Failed to load conson.yml: {e}")
|
|
67
|
+
self._handle_error(f"Error: Failed to load conson.yml: {e}")
|
|
68
|
+
return
|
|
69
|
+
|
|
70
|
+
# Filter modules that have ms_action_table configured
|
|
71
|
+
modules_with_msactiontable = [
|
|
72
|
+
{
|
|
73
|
+
"serial_number": module.serial_number,
|
|
74
|
+
"module_type": module.module_type,
|
|
75
|
+
"msaction_table": 1 if module.msaction_table else 0,
|
|
76
|
+
}
|
|
77
|
+
for module in config.root
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
# Prepare result
|
|
81
|
+
result = {"modules": modules_with_msactiontable}
|
|
82
|
+
|
|
83
|
+
# Emit finish signal
|
|
84
|
+
self.on_finish.emit(result)
|
|
85
|
+
|
|
86
|
+
def _handle_error(self, message: str) -> None:
|
|
87
|
+
"""Handle error and emit error signal.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
message: Error message.
|
|
91
|
+
"""
|
|
92
|
+
self.on_error.emit(message)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Service for showing ms action table configuration for a specific module."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Callable, Optional
|
|
6
|
+
|
|
7
|
+
from xp.models.config.conson_module_config import ConsonModuleConfig
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MsActionTableShowService:
|
|
11
|
+
"""Service for showing action table configuration for a specific module.
|
|
12
|
+
|
|
13
|
+
Reads conson.yml and returns the action table configuration for the specified
|
|
14
|
+
module serial number.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self) -> None:
|
|
18
|
+
"""Initialize the action table show service."""
|
|
19
|
+
self.logger = logging.getLogger(__name__)
|
|
20
|
+
self.finish_callback: Optional[Callable[[ConsonModuleConfig], None]] = None
|
|
21
|
+
self.error_callback: Optional[Callable[[str], None]] = None
|
|
22
|
+
|
|
23
|
+
def __enter__(self) -> "MsActionTableShowService":
|
|
24
|
+
"""Context manager entry.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
Self for context manager use.
|
|
28
|
+
"""
|
|
29
|
+
return self
|
|
30
|
+
|
|
31
|
+
def __exit__(self, _exc_type: Any, _exc_val: Any, _exc_tb: Any) -> None:
|
|
32
|
+
"""Context manager exit."""
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
def start(
|
|
36
|
+
self,
|
|
37
|
+
serial_number: str,
|
|
38
|
+
finish_callback: Callable[[ConsonModuleConfig], None],
|
|
39
|
+
error_callback: Callable[[str], None],
|
|
40
|
+
config_path: Optional[Path] = None,
|
|
41
|
+
) -> None:
|
|
42
|
+
"""Show ms action table configuration for a specific module.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
serial_number: Module serial number.
|
|
46
|
+
finish_callback: Callback to invoke with the module configuration.
|
|
47
|
+
error_callback: Callback to invoke on error.
|
|
48
|
+
config_path: Optional path to conson.yml. Defaults to current directory.
|
|
49
|
+
"""
|
|
50
|
+
self.finish_callback = finish_callback
|
|
51
|
+
self.error_callback = error_callback
|
|
52
|
+
|
|
53
|
+
# Default to current directory if not specified
|
|
54
|
+
if config_path is None:
|
|
55
|
+
config_path = Path.cwd() / "conson.yml"
|
|
56
|
+
|
|
57
|
+
# Check if config file exists
|
|
58
|
+
if not config_path.exists():
|
|
59
|
+
self._handle_error("Error: conson.yml not found in current directory")
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
# Load configuration
|
|
63
|
+
try:
|
|
64
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
65
|
+
|
|
66
|
+
config = ConsonModuleListConfig.from_yaml(str(config_path))
|
|
67
|
+
except Exception as e:
|
|
68
|
+
self.logger.error(f"Failed to load conson.yml: {e}")
|
|
69
|
+
self._handle_error(f"Error: Failed to load conson.yml: {e}")
|
|
70
|
+
return
|
|
71
|
+
|
|
72
|
+
# Find module
|
|
73
|
+
module = config.find_module(serial_number)
|
|
74
|
+
if not module:
|
|
75
|
+
self._handle_error(f"Error: Module {serial_number} not found in conson.yml")
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
# Invoke callback
|
|
79
|
+
if self.finish_callback is not None:
|
|
80
|
+
self.finish_callback(module)
|
|
81
|
+
|
|
82
|
+
def _handle_error(self, message: str) -> None:
|
|
83
|
+
"""Handle error and invoke error callback.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
message: Error message.
|
|
87
|
+
"""
|
|
88
|
+
if self.error_callback is not None:
|
|
89
|
+
self.error_callback(message)
|
|
@@ -253,8 +253,8 @@ class ConfigValidationService:
|
|
|
253
253
|
conson_config_path: Path to conson.yml configuration file.
|
|
254
254
|
homekit_config_path: Path to homekit.yml configuration file.
|
|
255
255
|
"""
|
|
256
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
256
257
|
from xp.models.homekit.homekit_config import HomekitConfig
|
|
257
|
-
from xp.models.homekit.homekit_conson_config import ConsonModuleListConfig
|
|
258
258
|
|
|
259
259
|
self.conson_config = ConsonModuleListConfig.from_yaml(conson_config_path)
|
|
260
260
|
self.homekit_config = HomekitConfig.from_yaml(homekit_config_path)
|
|
@@ -5,7 +5,7 @@ This module validates conson.yml configuration files for HomeKit integration.
|
|
|
5
5
|
|
|
6
6
|
from typing import List, Set
|
|
7
7
|
|
|
8
|
-
from xp.models.
|
|
8
|
+
from xp.models.config.conson_module_config import (
|
|
9
9
|
ConsonModuleConfig,
|
|
10
10
|
ConsonModuleListConfig,
|
|
11
11
|
)
|
|
@@ -10,8 +10,8 @@ from pyhap.accessory import Accessory
|
|
|
10
10
|
from pyhap.accessory_driver import AccessoryDriver
|
|
11
11
|
from pyhap.const import CATEGORY_LIGHTBULB
|
|
12
12
|
|
|
13
|
+
from xp.models.config.conson_module_config import ConsonModuleConfig
|
|
13
14
|
from xp.models.homekit.homekit_config import HomekitAccessoryConfig
|
|
14
|
-
from xp.models.homekit.homekit_conson_config import ConsonModuleConfig
|
|
15
15
|
from xp.models.protocol.conbus_protocol import (
|
|
16
16
|
DimmingLightGetBrightnessEvent,
|
|
17
17
|
DimmingLightGetOnEvent,
|
|
@@ -10,8 +10,8 @@ from pyhap.accessory import Accessory
|
|
|
10
10
|
from pyhap.accessory_driver import AccessoryDriver
|
|
11
11
|
from pyhap.const import CATEGORY_LIGHTBULB
|
|
12
12
|
|
|
13
|
+
from xp.models.config.conson_module_config import ConsonModuleConfig
|
|
13
14
|
from xp.models.homekit.homekit_config import HomekitAccessoryConfig
|
|
14
|
-
from xp.models.homekit.homekit_conson_config import ConsonModuleConfig
|
|
15
15
|
from xp.models.protocol.conbus_protocol import (
|
|
16
16
|
LightBulbGetOnEvent,
|
|
17
17
|
LightBulbSetOnEvent,
|
|
@@ -6,7 +6,7 @@ This module provides service implementation for HomeKit module management.
|
|
|
6
6
|
import logging
|
|
7
7
|
from typing import Optional
|
|
8
8
|
|
|
9
|
-
from xp.models.
|
|
9
|
+
from xp.models.config.conson_module_config import (
|
|
10
10
|
ConsonModuleConfig,
|
|
11
11
|
ConsonModuleListConfig,
|
|
12
12
|
)
|
|
@@ -10,8 +10,8 @@ from pyhap.accessory import Accessory
|
|
|
10
10
|
from pyhap.accessory_driver import AccessoryDriver
|
|
11
11
|
from pyhap.const import CATEGORY_OUTLET
|
|
12
12
|
|
|
13
|
+
from xp.models.config.conson_module_config import ConsonModuleConfig
|
|
13
14
|
from xp.models.homekit.homekit_config import HomekitAccessoryConfig
|
|
14
|
-
from xp.models.homekit.homekit_conson_config import ConsonModuleConfig
|
|
15
15
|
from xp.models.protocol.conbus_protocol import (
|
|
16
16
|
OutletGetInUseEvent,
|
|
17
17
|
OutletGetOnEvent,
|
|
@@ -320,9 +320,13 @@ class ConbusEventProtocol(protocol.Protocol, protocol.ClientFactory):
|
|
|
320
320
|
|
|
321
321
|
def stop_reactor(self) -> None:
|
|
322
322
|
"""Stop the reactor if it's running."""
|
|
323
|
-
|
|
324
|
-
self.
|
|
325
|
-
|
|
323
|
+
try:
|
|
324
|
+
if self._reactor.running:
|
|
325
|
+
self.logger.info("Stopping reactor")
|
|
326
|
+
self._reactor.stop()
|
|
327
|
+
except Exception as e:
|
|
328
|
+
# Reactor might have already stopped or not been started via run()
|
|
329
|
+
self.logger.debug(f"Reactor stop failed (likely already stopped): {e}")
|
|
326
330
|
|
|
327
331
|
def connect(self) -> None:
|
|
328
332
|
"""Connect to TCP server.
|
|
@@ -6,7 +6,7 @@ from typing import Dict, List, Optional
|
|
|
6
6
|
|
|
7
7
|
from psygnal import Signal
|
|
8
8
|
|
|
9
|
-
from xp.models.
|
|
9
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
10
10
|
from xp.models.protocol.conbus_protocol import TelegramReceivedEvent
|
|
11
11
|
from xp.models.telegram.datapoint_type import DataPointType
|
|
12
12
|
from xp.models.telegram.module_type_code import ModuleTypeCode
|
xp/utils/dependencies.py
CHANGED
|
@@ -8,8 +8,8 @@ from twisted.internet.posixbase import PosixReactorBase
|
|
|
8
8
|
|
|
9
9
|
from xp.models import ConbusClientConfig
|
|
10
10
|
from xp.models.conbus.conbus_logger_config import ConbusLoggerConfig
|
|
11
|
+
from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
11
12
|
from xp.models.homekit.homekit_config import HomekitConfig
|
|
12
|
-
from xp.models.homekit.homekit_conson_config import ConsonModuleListConfig
|
|
13
13
|
from xp.models.term.protocol_keys_config import ProtocolKeysConfig
|
|
14
14
|
from xp.services.actiontable.actiontable_serializer import ActionTableSerializer
|
|
15
15
|
from xp.services.actiontable.msactiontable_serializer import MsActionTableSerializer
|
|
@@ -23,7 +23,7 @@ from xp.services.actiontable.msactiontable_xp33_serializer import (
|
|
|
23
23
|
Xp33MsActionTableSerializer,
|
|
24
24
|
)
|
|
25
25
|
from xp.services.conbus.actiontable.actiontable_download_service import (
|
|
26
|
-
|
|
26
|
+
ActionTableDownloadService,
|
|
27
27
|
)
|
|
28
28
|
from xp.services.conbus.actiontable.actiontable_list_service import (
|
|
29
29
|
ActionTableListService,
|
|
@@ -34,7 +34,6 @@ from xp.services.conbus.actiontable.actiontable_show_service import (
|
|
|
34
34
|
from xp.services.conbus.actiontable.actiontable_upload_service import (
|
|
35
35
|
ActionTableUploadService,
|
|
36
36
|
)
|
|
37
|
-
from xp.services.conbus.actiontable.msactiontable_service import MsActionTableService
|
|
38
37
|
from xp.services.conbus.conbus_blink_all_service import ConbusBlinkAllService
|
|
39
38
|
from xp.services.conbus.conbus_blink_service import ConbusBlinkService
|
|
40
39
|
from xp.services.conbus.conbus_custom_service import ConbusCustomService
|
|
@@ -52,6 +51,15 @@ from xp.services.conbus.conbus_output_service import ConbusOutputService
|
|
|
52
51
|
from xp.services.conbus.conbus_raw_service import ConbusRawService
|
|
53
52
|
from xp.services.conbus.conbus_receive_service import ConbusReceiveService
|
|
54
53
|
from xp.services.conbus.conbus_scan_service import ConbusScanService
|
|
54
|
+
from xp.services.conbus.msactiontable.msactiontable_download_service import (
|
|
55
|
+
MsActionTableDownloadService,
|
|
56
|
+
)
|
|
57
|
+
from xp.services.conbus.msactiontable.msactiontable_list_service import (
|
|
58
|
+
MsActionTableListService,
|
|
59
|
+
)
|
|
60
|
+
from xp.services.conbus.msactiontable.msactiontable_show_service import (
|
|
61
|
+
MsActionTableShowService,
|
|
62
|
+
)
|
|
55
63
|
from xp.services.conbus.write_config_service import WriteConfigService
|
|
56
64
|
from xp.services.homekit.homekit_cache_service import HomeKitCacheService
|
|
57
65
|
from xp.services.homekit.homekit_conbus_service import HomeKitConbusService
|
|
@@ -99,6 +107,7 @@ class ServiceContainer:
|
|
|
99
107
|
logger_config_path: str = "logger.yml",
|
|
100
108
|
homekit_config_path: str = "homekit.yml",
|
|
101
109
|
conson_config_path: str = "conson.yml",
|
|
110
|
+
export_config_path: str = "export.yml",
|
|
102
111
|
server_port: int = 10001,
|
|
103
112
|
protocol_keys_config_path: str = "protocol.yml",
|
|
104
113
|
reverse_proxy_port: int = 10001,
|
|
@@ -111,6 +120,7 @@ class ServiceContainer:
|
|
|
111
120
|
logger_config_path: Path to the Conbus Loggerr configuration file
|
|
112
121
|
homekit_config_path: Path to the HomeKit configuration file
|
|
113
122
|
conson_config_path: Path to the Conson configuration file
|
|
123
|
+
export_config_path: Path to the Conson export file
|
|
114
124
|
protocol_keys_config_path: Path to the protocol keys configuration file
|
|
115
125
|
server_port: Port for the server service
|
|
116
126
|
reverse_proxy_port: Port for the reverse proxy service
|
|
@@ -120,6 +130,7 @@ class ServiceContainer:
|
|
|
120
130
|
self._logger_config_path = logger_config_path
|
|
121
131
|
self._homekit_config_path = homekit_config_path
|
|
122
132
|
self._conson_config_path = conson_config_path
|
|
133
|
+
self._export_config_path = export_config_path
|
|
123
134
|
self._protocol_keys_config_path = protocol_keys_config_path
|
|
124
135
|
self._server_port = server_port
|
|
125
136
|
self._reverse_proxy_port = reverse_proxy_port
|
|
@@ -141,6 +152,12 @@ class ServiceContainer:
|
|
|
141
152
|
scope=punq.Scope.singleton,
|
|
142
153
|
)
|
|
143
154
|
|
|
155
|
+
self.container.register(
|
|
156
|
+
ConsonModuleListConfig,
|
|
157
|
+
factory=lambda: ConsonModuleListConfig.from_yaml(self._conson_config_path),
|
|
158
|
+
scope=punq.Scope.singleton,
|
|
159
|
+
)
|
|
160
|
+
|
|
144
161
|
# Telegram services layer
|
|
145
162
|
self.container.register(TelegramService, scope=punq.Scope.singleton)
|
|
146
163
|
self.container.register(
|
|
@@ -302,8 +319,8 @@ class ServiceContainer:
|
|
|
302
319
|
)
|
|
303
320
|
|
|
304
321
|
self.container.register(
|
|
305
|
-
|
|
306
|
-
factory=lambda:
|
|
322
|
+
ActionTableDownloadService,
|
|
323
|
+
factory=lambda: ActionTableDownloadService(
|
|
307
324
|
conbus_protocol=self.container.resolve(ConbusEventProtocol),
|
|
308
325
|
actiontable_serializer=self.container.resolve(ActionTableSerializer),
|
|
309
326
|
telegram_service=self.container.resolve(TelegramService),
|
|
@@ -353,8 +370,8 @@ class ServiceContainer:
|
|
|
353
370
|
)
|
|
354
371
|
|
|
355
372
|
self.container.register(
|
|
356
|
-
|
|
357
|
-
factory=lambda:
|
|
373
|
+
MsActionTableDownloadService,
|
|
374
|
+
factory=lambda: MsActionTableDownloadService(
|
|
358
375
|
conbus_protocol=self.container.resolve(ConbusEventProtocol),
|
|
359
376
|
xp20ms_serializer=self.container.resolve(Xp20MsActionTableSerializer),
|
|
360
377
|
xp24ms_serializer=self.container.resolve(Xp24MsActionTableSerializer),
|
|
@@ -389,13 +406,6 @@ class ServiceContainer:
|
|
|
389
406
|
scope=punq.Scope.singleton,
|
|
390
407
|
)
|
|
391
408
|
|
|
392
|
-
# HomeKit conson config
|
|
393
|
-
self.container.register(
|
|
394
|
-
ConsonModuleListConfig,
|
|
395
|
-
factory=lambda: ConsonModuleListConfig.from_yaml(self._conson_config_path),
|
|
396
|
-
scope=punq.Scope.singleton,
|
|
397
|
-
)
|
|
398
|
-
|
|
399
409
|
# HomeKit services layer
|
|
400
410
|
self.container.register(
|
|
401
411
|
HomekitModuleService,
|
|
@@ -468,6 +478,18 @@ class ServiceContainer:
|
|
|
468
478
|
scope=punq.Scope.singleton,
|
|
469
479
|
)
|
|
470
480
|
|
|
481
|
+
self.container.register(
|
|
482
|
+
MsActionTableListService,
|
|
483
|
+
factory=MsActionTableListService,
|
|
484
|
+
scope=punq.Scope.singleton,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
self.container.register(
|
|
488
|
+
MsActionTableShowService,
|
|
489
|
+
factory=MsActionTableShowService,
|
|
490
|
+
scope=punq.Scope.singleton,
|
|
491
|
+
)
|
|
492
|
+
|
|
471
493
|
# Server services layer
|
|
472
494
|
self.container.register(
|
|
473
495
|
ServerService,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|