conson-xp 1.46.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.46.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/{conbus/actiontable/actiontable_download_state_machine.py → actiontable/download_state_machine.py} +13 -8
- 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 +63 -29
- 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 +46 -24
- xp/services/protocol/conbus_protocol.py +36 -19
- xp/services/protocol/protocol_factory.py +12 -6
- xp/services/protocol/telegram_protocol.py +12 -6
- xp/services/reverse_proxy_service.py +26 -14
- xp/services/server/base_server_service.py +42 -23
- xp/services/server/client_buffer_manager.py +12 -7
- xp/services/server/cp20_server_service.py +10 -7
- xp/services/server/device_service_factory.py +12 -8
- xp/services/server/server_service.py +18 -11
- xp/services/server/xp130_server_service.py +11 -8
- xp/services/server/xp20_server_service.py +16 -10
- xp/services/server/xp230_server_service.py +10 -7
- xp/services/server/xp24_server_service.py +22 -13
- xp/services/server/xp33_server_service.py +44 -25
- xp/services/telegram/telegram_blink_service.py +14 -8
- xp/services/telegram/telegram_checksum_service.py +12 -7
- xp/services/telegram/telegram_datapoint_service.py +14 -9
- xp/services/telegram/telegram_discover_service.py +28 -15
- xp/services/telegram/telegram_link_number_service.py +18 -10
- xp/services/telegram/telegram_output_service.py +24 -12
- xp/services/telegram/telegram_service.py +22 -11
- xp/services/telegram/telegram_version_service.py +14 -8
- xp/services/term/protocol_monitor_service.py +30 -16
- xp/services/term/state_monitor_service.py +39 -21
- xp/term/protocol.py +12 -6
- xp/term/state.py +12 -7
- xp/term/widgets/help_menu.py +6 -3
- xp/term/widgets/modules_list.py +20 -10
- xp/term/widgets/protocol_log.py +12 -6
- xp/term/widgets/status_footer.py +10 -5
- xp/utils/checksum.py +6 -3
- xp/utils/dependencies.py +25 -30
- xp/utils/event_helper.py +6 -4
- xp/utils/logging.py +6 -3
- xp/utils/serialization.py +30 -16
- xp/utils/state_machine.py +16 -9
- xp/utils/time_utils.py +6 -3
- conson_xp-1.46.0.dist-info/RECORD +0 -211
- xp/services/conbus/msactiontable/msactiontable_download_service.py +0 -275
- xp/services/conbus/msactiontable/msactiontable_list_service.py +0 -100
- xp/services/conbus/msactiontable/msactiontable_show_service.py +0 -89
- {conson_xp-1.46.0.dist-info → conson_xp-1.47.0.dist-info}/WHEEL +0 -0
- {conson_xp-1.46.0.dist-info → conson_xp-1.47.0.dist-info}/entry_points.txt +0 -0
- {conson_xp-1.46.0.dist-info → conson_xp-1.47.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusEventRawResponse:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a response from Conbus event raw operation.
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
success: Whether the operation was successful.
|
|
@@ -33,7 +34,8 @@ class ConbusEventRawResponse:
|
|
|
33
34
|
self.received_telegrams = []
|
|
34
35
|
|
|
35
36
|
def to_dict(self) -> Dict[str, Any]:
|
|
36
|
-
"""
|
|
37
|
+
"""
|
|
38
|
+
Convert to dictionary for JSON serialization.
|
|
37
39
|
|
|
38
40
|
Returns:
|
|
39
41
|
Dictionary representation of the response.
|
|
@@ -8,7 +8,8 @@ from xp.models.config.conson_module_config import ConsonModuleListConfig
|
|
|
8
8
|
|
|
9
9
|
@dataclass
|
|
10
10
|
class ConbusExportResponse:
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Response from Conbus export operation.
|
|
12
13
|
|
|
13
14
|
Attributes:
|
|
14
15
|
success: Whether the operation was successful.
|
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusLightlevelResponse:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a response from Conbus lightlevel operation.
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
success: Whether the operation was successful.
|
|
@@ -35,7 +36,8 @@ class ConbusLightlevelResponse:
|
|
|
35
36
|
self.received_telegrams = []
|
|
36
37
|
|
|
37
38
|
def to_dict(self) -> Dict[str, Any]:
|
|
38
|
-
"""
|
|
39
|
+
"""
|
|
40
|
+
Convert to dictionary for JSON serialization.
|
|
39
41
|
|
|
40
42
|
Returns:
|
|
41
43
|
Dictionary representation of the response.
|
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusLinknumberResponse:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a response from Conbus link number operations (set/get).
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
success: Whether the operation was successful.
|
|
@@ -37,7 +38,8 @@ class ConbusLinknumberResponse:
|
|
|
37
38
|
self.received_telegrams = []
|
|
38
39
|
|
|
39
40
|
def to_dict(self) -> Dict[str, Any]:
|
|
40
|
-
"""
|
|
41
|
+
"""
|
|
42
|
+
Convert to dictionary for JSON serialization.
|
|
41
43
|
|
|
42
44
|
Returns:
|
|
43
45
|
Dictionary representation of the response.
|
|
@@ -9,7 +9,8 @@ from pydantic import BaseModel, Field, field_validator
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class LoggingConfig(BaseModel):
|
|
12
|
-
"""
|
|
12
|
+
"""
|
|
13
|
+
Logging configuration.
|
|
13
14
|
|
|
14
15
|
Attributes:
|
|
15
16
|
path: log folder.
|
|
@@ -38,7 +39,8 @@ class LoggingConfig(BaseModel):
|
|
|
38
39
|
@field_validator("levels", mode="before")
|
|
39
40
|
@classmethod
|
|
40
41
|
def convert_level_names(cls, v: Dict[str, Union[str, int]]) -> Dict[str, int]:
|
|
41
|
-
"""
|
|
42
|
+
"""
|
|
43
|
+
Convert string level names to numeric values.
|
|
42
44
|
|
|
43
45
|
Args:
|
|
44
46
|
v: Dictionary with string or int log levels.
|
|
@@ -73,7 +75,8 @@ class LoggingConfig(BaseModel):
|
|
|
73
75
|
|
|
74
76
|
|
|
75
77
|
class ConbusLoggerConfig(BaseModel):
|
|
76
|
-
"""
|
|
78
|
+
"""
|
|
79
|
+
Logging configuration.
|
|
77
80
|
|
|
78
81
|
Attributes:
|
|
79
82
|
log: LoggingConfig instance for logging settings.
|
|
@@ -83,7 +86,8 @@ class ConbusLoggerConfig(BaseModel):
|
|
|
83
86
|
|
|
84
87
|
@classmethod
|
|
85
88
|
def from_yaml(cls, file_path: str) -> "ConbusLoggerConfig":
|
|
86
|
-
"""
|
|
89
|
+
"""
|
|
90
|
+
Load configuration from YAML file.
|
|
87
91
|
|
|
88
92
|
Args:
|
|
89
93
|
file_path: Path to the YAML configuration file.
|
|
@@ -11,7 +11,8 @@ from xp.models.telegram.reply_telegram import ReplyTelegram
|
|
|
11
11
|
|
|
12
12
|
@dataclass
|
|
13
13
|
class ConbusOutputResponse:
|
|
14
|
-
"""
|
|
14
|
+
"""
|
|
15
|
+
Represents a response from Conbus send operation.
|
|
15
16
|
|
|
16
17
|
Attributes:
|
|
17
18
|
success: Whether the operation was successful.
|
|
@@ -43,7 +44,8 @@ class ConbusOutputResponse:
|
|
|
43
44
|
self.received_telegrams = []
|
|
44
45
|
|
|
45
46
|
def to_dict(self) -> Dict[str, Any]:
|
|
46
|
-
"""
|
|
47
|
+
"""
|
|
48
|
+
Convert to dictionary for JSON serialization.
|
|
47
49
|
|
|
48
50
|
Returns:
|
|
49
51
|
Dictionary representation of the response.
|
xp/models/conbus/conbus_raw.py
CHANGED
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, List, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusRawResponse:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a response from Conbus raw telegram send operation.
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
success: Whether the operation was successful.
|
|
@@ -31,7 +32,8 @@ class ConbusRawResponse:
|
|
|
31
32
|
self.received_telegrams = []
|
|
32
33
|
|
|
33
34
|
def to_dict(self) -> Dict[str, Any]:
|
|
34
|
-
"""
|
|
35
|
+
"""
|
|
36
|
+
Convert to dictionary for JSON serialization.
|
|
35
37
|
|
|
36
38
|
Returns:
|
|
37
39
|
Dictionary representation of the response.
|
|
@@ -7,7 +7,8 @@ from typing import Any, Dict, List, Optional
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
9
9
|
class ConbusReceiveResponse:
|
|
10
|
-
"""
|
|
10
|
+
"""
|
|
11
|
+
Represents a response from Conbus receive operation.
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
success: Whether the operation was successful.
|
|
@@ -29,7 +30,8 @@ class ConbusReceiveResponse:
|
|
|
29
30
|
self.received_telegrams = []
|
|
30
31
|
|
|
31
32
|
def to_dict(self) -> Dict[str, Any]:
|
|
32
|
-
"""
|
|
33
|
+
"""
|
|
34
|
+
Convert to dictionary for JSON serialization.
|
|
33
35
|
|
|
34
36
|
Returns:
|
|
35
37
|
Dictionary representation of the response.
|
|
@@ -10,7 +10,8 @@ from xp.models.telegram.system_function import SystemFunction
|
|
|
10
10
|
|
|
11
11
|
@dataclass
|
|
12
12
|
class ConbusWriteConfigResponse:
|
|
13
|
-
"""
|
|
13
|
+
"""
|
|
14
|
+
Represents a response from Conbus write config operations (set/get).
|
|
14
15
|
|
|
15
16
|
Attributes:
|
|
16
17
|
success: Whether the operation was successful.
|
|
@@ -42,7 +43,8 @@ class ConbusWriteConfigResponse:
|
|
|
42
43
|
self.received_telegrams = []
|
|
43
44
|
|
|
44
45
|
def to_dict(self) -> Dict[str, Any]:
|
|
45
|
-
"""
|
|
46
|
+
"""
|
|
47
|
+
Convert to dictionary for JSON serialization.
|
|
46
48
|
|
|
47
49
|
Returns:
|
|
48
50
|
Dictionary representation of the response.
|
|
@@ -8,7 +8,8 @@ from pydantic import BaseModel, IPvAnyAddress
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ConsonModuleConfig(BaseModel):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Configuration for a Conson module.
|
|
12
13
|
|
|
13
14
|
Attributes:
|
|
14
15
|
name: Name of the module.
|
|
@@ -48,7 +49,8 @@ class ConsonModuleConfig(BaseModel):
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
class ConsonModuleListConfig(BaseModel):
|
|
51
|
-
"""
|
|
52
|
+
"""
|
|
53
|
+
Configuration list for Conson modules.
|
|
52
54
|
|
|
53
55
|
Attributes:
|
|
54
56
|
root: List of Conson module configurations.
|
|
@@ -58,7 +60,8 @@ class ConsonModuleListConfig(BaseModel):
|
|
|
58
60
|
|
|
59
61
|
@classmethod
|
|
60
62
|
def from_yaml(cls, file_path: str) -> "ConsonModuleListConfig":
|
|
61
|
-
"""
|
|
63
|
+
"""
|
|
64
|
+
Load configuration from YAML file.
|
|
62
65
|
|
|
63
66
|
Args:
|
|
64
67
|
file_path: Path to the YAML configuration file.
|
|
@@ -78,7 +81,8 @@ class ConsonModuleListConfig(BaseModel):
|
|
|
78
81
|
return cls(root=data)
|
|
79
82
|
|
|
80
83
|
def find_module(self, serial_number: str) -> Optional[ConsonModuleConfig]:
|
|
81
|
-
"""
|
|
84
|
+
"""
|
|
85
|
+
Find a module by serial number.
|
|
82
86
|
|
|
83
87
|
Args:
|
|
84
88
|
serial_number: Module serial number to search for.
|
|
@@ -8,7 +8,8 @@ from pyhap.const import CATEGORY_SENSOR
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class TemperatureSensor(Accessory):
|
|
11
|
-
"""
|
|
11
|
+
"""
|
|
12
|
+
Fake Temperature sensor, measuring every 3 seconds.
|
|
12
13
|
|
|
13
14
|
Attributes:
|
|
14
15
|
category: HomeKit category for sensor.
|
|
@@ -18,7 +19,8 @@ class TemperatureSensor(Accessory):
|
|
|
18
19
|
category = CATEGORY_SENSOR
|
|
19
20
|
|
|
20
21
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
21
|
-
"""
|
|
22
|
+
"""
|
|
23
|
+
Initialize temperature sensor accessory.
|
|
22
24
|
|
|
23
25
|
Args:
|
|
24
26
|
args: Positional arguments passed to parent Accessory.
|
|
@@ -10,7 +10,8 @@ from pydantic import BaseModel, Field, IPvAnyAddress
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class NetworkConfig(BaseModel):
|
|
13
|
-
"""
|
|
13
|
+
"""
|
|
14
|
+
Network configuration settings.
|
|
14
15
|
|
|
15
16
|
Attributes:
|
|
16
17
|
ip: IP address for the network connection.
|
|
@@ -22,7 +23,8 @@ class NetworkConfig(BaseModel):
|
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class RoomConfig(BaseModel):
|
|
25
|
-
"""
|
|
26
|
+
"""
|
|
27
|
+
Room configuration settings.
|
|
26
28
|
|
|
27
29
|
Attributes:
|
|
28
30
|
name: Name of the room.
|
|
@@ -34,7 +36,8 @@ class RoomConfig(BaseModel):
|
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
class BridgeConfig(BaseModel):
|
|
37
|
-
"""
|
|
39
|
+
"""
|
|
40
|
+
HomeKit bridge settings.
|
|
38
41
|
|
|
39
42
|
Attributes:
|
|
40
43
|
name: Name of the HomeKit bridge.
|
|
@@ -46,7 +49,8 @@ class BridgeConfig(BaseModel):
|
|
|
46
49
|
|
|
47
50
|
|
|
48
51
|
class HomekitAccessoryConfig(BaseModel):
|
|
49
|
-
"""
|
|
52
|
+
"""
|
|
53
|
+
HomeKit accessory configuration.
|
|
50
54
|
|
|
51
55
|
Attributes:
|
|
52
56
|
name: Name of the accessory.
|
|
@@ -72,7 +76,8 @@ class HomekitAccessoryConfig(BaseModel):
|
|
|
72
76
|
|
|
73
77
|
|
|
74
78
|
class HomekitConfig(BaseModel):
|
|
75
|
-
"""
|
|
79
|
+
"""
|
|
80
|
+
HomeKit bridge configuration.
|
|
76
81
|
|
|
77
82
|
Attributes:
|
|
78
83
|
homekit: Network configuration for HomeKit.
|
|
@@ -88,7 +93,8 @@ class HomekitConfig(BaseModel):
|
|
|
88
93
|
|
|
89
94
|
@classmethod
|
|
90
95
|
def from_yaml(cls, file_path: str) -> "HomekitConfig":
|
|
91
|
-
"""
|
|
96
|
+
"""
|
|
97
|
+
Load configuration from YAML file.
|
|
92
98
|
|
|
93
99
|
Args:
|
|
94
100
|
file_path: Path to the YAML configuration file.
|
xp/models/log_entry.py
CHANGED
|
@@ -11,7 +11,8 @@ from xp.models.telegram.system_telegram import SystemTelegram
|
|
|
11
11
|
|
|
12
12
|
@dataclass
|
|
13
13
|
class LogEntry:
|
|
14
|
-
"""
|
|
14
|
+
"""
|
|
15
|
+
Represents a single entry in a console bus log file.
|
|
15
16
|
|
|
16
17
|
Format: HH:MM:SS,mmm [TX/RX] <telegram>
|
|
17
18
|
Examples: 22:44:20,352 [TX] <S0012345008F27D00AAFN>
|
|
@@ -41,7 +42,8 @@ class LogEntry:
|
|
|
41
42
|
|
|
42
43
|
@property
|
|
43
44
|
def is_transmitted(self) -> bool:
|
|
44
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
True if this is a transmitted telegram.
|
|
45
47
|
|
|
46
48
|
Returns:
|
|
47
49
|
True if direction is TX, False otherwise.
|
|
@@ -50,7 +52,8 @@ class LogEntry:
|
|
|
50
52
|
|
|
51
53
|
@property
|
|
52
54
|
def is_received(self) -> bool:
|
|
53
|
-
"""
|
|
55
|
+
"""
|
|
56
|
+
True if this is a received telegram.
|
|
54
57
|
|
|
55
58
|
Returns:
|
|
56
59
|
True if direction is RX, False otherwise.
|
|
@@ -59,7 +62,8 @@ class LogEntry:
|
|
|
59
62
|
|
|
60
63
|
@property
|
|
61
64
|
def telegram_type(self) -> str:
|
|
62
|
-
"""
|
|
65
|
+
"""
|
|
66
|
+
Get the telegram type (event, system, reply, unknown).
|
|
63
67
|
|
|
64
68
|
Returns:
|
|
65
69
|
Telegram type string.
|
|
@@ -71,7 +75,8 @@ class LogEntry:
|
|
|
71
75
|
|
|
72
76
|
@property
|
|
73
77
|
def is_valid_parse(self) -> bool:
|
|
74
|
-
"""
|
|
78
|
+
"""
|
|
79
|
+
True if the telegram was successfully parsed.
|
|
75
80
|
|
|
76
81
|
Returns:
|
|
77
82
|
True if parsed without errors, False otherwise.
|
|
@@ -80,7 +85,8 @@ class LogEntry:
|
|
|
80
85
|
|
|
81
86
|
@property
|
|
82
87
|
def checksum_validated(self) -> Optional[bool]:
|
|
83
|
-
"""
|
|
88
|
+
"""
|
|
89
|
+
Get checksum validation status if available.
|
|
84
90
|
|
|
85
91
|
Returns:
|
|
86
92
|
Checksum validation status or None if not available.
|
|
@@ -90,7 +96,8 @@ class LogEntry:
|
|
|
90
96
|
return None
|
|
91
97
|
|
|
92
98
|
def to_dict(self) -> dict[str, Any]:
|
|
93
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Convert to dictionary for JSON serialization.
|
|
94
101
|
|
|
95
102
|
Returns:
|
|
96
103
|
Dictionary representation of the log entry.
|
|
@@ -115,7 +122,8 @@ class LogEntry:
|
|
|
115
122
|
return result
|
|
116
123
|
|
|
117
124
|
def __str__(self) -> str:
|
|
118
|
-
"""
|
|
125
|
+
"""
|
|
126
|
+
Human-readable string representation.
|
|
119
127
|
|
|
120
128
|
Returns:
|
|
121
129
|
Formatted string representation of the log entry.
|
|
@@ -18,7 +18,8 @@ if TYPE_CHECKING:
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class ConnectionMadeEvent(BaseEvent):
|
|
21
|
-
"""
|
|
21
|
+
"""
|
|
22
|
+
Event dispatched when TCP connection is established.
|
|
22
23
|
|
|
23
24
|
Attributes:
|
|
24
25
|
protocol: Reference to the TelegramProtocol instance.
|
|
@@ -30,7 +31,8 @@ class ConnectionMadeEvent(BaseEvent):
|
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
class ConnectionFailedEvent(BaseEvent):
|
|
33
|
-
"""
|
|
34
|
+
"""
|
|
35
|
+
Event dispatched when TCP connection fails.
|
|
34
36
|
|
|
35
37
|
Attributes:
|
|
36
38
|
reason: Failure reason.
|
|
@@ -40,7 +42,8 @@ class ConnectionFailedEvent(BaseEvent):
|
|
|
40
42
|
|
|
41
43
|
|
|
42
44
|
class SendWriteConfigEvent(BaseEvent):
|
|
43
|
-
"""
|
|
45
|
+
"""
|
|
46
|
+
Event for sending write config commands.
|
|
44
47
|
|
|
45
48
|
Attributes:
|
|
46
49
|
serial_number: Serial number.
|
|
@@ -56,7 +59,8 @@ class SendWriteConfigEvent(BaseEvent):
|
|
|
56
59
|
|
|
57
60
|
|
|
58
61
|
class SendActionEvent(BaseEvent):
|
|
59
|
-
"""
|
|
62
|
+
"""
|
|
63
|
+
Event for sending action commands.
|
|
60
64
|
|
|
61
65
|
Attributes:
|
|
62
66
|
serial_number: Serial number of the light bulb set.
|
|
@@ -74,7 +78,8 @@ class SendActionEvent(BaseEvent):
|
|
|
74
78
|
|
|
75
79
|
|
|
76
80
|
class DatapointEvent(BaseEvent):
|
|
77
|
-
"""
|
|
81
|
+
"""
|
|
82
|
+
Base event for datapoint operations.
|
|
78
83
|
|
|
79
84
|
Attributes:
|
|
80
85
|
serial_number: Serial number of the light bulb set.
|
|
@@ -86,7 +91,8 @@ class DatapointEvent(BaseEvent):
|
|
|
86
91
|
|
|
87
92
|
|
|
88
93
|
class OutputStateReceivedEvent(DatapointEvent):
|
|
89
|
-
"""
|
|
94
|
+
"""
|
|
95
|
+
Event when output state is received.
|
|
90
96
|
|
|
91
97
|
Attributes:
|
|
92
98
|
data_value: Data value.
|
|
@@ -96,7 +102,8 @@ class OutputStateReceivedEvent(DatapointEvent):
|
|
|
96
102
|
|
|
97
103
|
|
|
98
104
|
class LightLevelReceivedEvent(DatapointEvent):
|
|
99
|
-
"""
|
|
105
|
+
"""
|
|
106
|
+
Event when light level is received.
|
|
100
107
|
|
|
101
108
|
Attributes:
|
|
102
109
|
data_value: Data value.
|
|
@@ -106,7 +113,8 @@ class LightLevelReceivedEvent(DatapointEvent):
|
|
|
106
113
|
|
|
107
114
|
|
|
108
115
|
class ReadDatapointEvent(DatapointEvent):
|
|
109
|
-
"""
|
|
116
|
+
"""
|
|
117
|
+
Event to read datapoint.
|
|
110
118
|
|
|
111
119
|
Attributes:
|
|
112
120
|
refresh_cache: If True, force cache invalidation and fresh protocol query.
|
|
@@ -125,7 +133,8 @@ class ReadDatapointFromProtocolEvent(DatapointEvent):
|
|
|
125
133
|
|
|
126
134
|
|
|
127
135
|
class ModuleEvent(BaseEvent):
|
|
128
|
-
"""
|
|
136
|
+
"""
|
|
137
|
+
Event dispatched when light bulb set is on.
|
|
129
138
|
|
|
130
139
|
Attributes:
|
|
131
140
|
serial_number: Serial number of the light bulb set.
|
|
@@ -145,7 +154,8 @@ class ModuleEvent(BaseEvent):
|
|
|
145
154
|
|
|
146
155
|
|
|
147
156
|
class LightBulbSetOnEvent(ModuleEvent):
|
|
148
|
-
"""
|
|
157
|
+
"""
|
|
158
|
+
Event dispatched when light bulb set is on.
|
|
149
159
|
|
|
150
160
|
Attributes:
|
|
151
161
|
value: On or Off the light bulb set.
|
|
@@ -161,7 +171,8 @@ class LightBulbGetOnEvent(ModuleEvent, BaseEvent[bool]):
|
|
|
161
171
|
|
|
162
172
|
|
|
163
173
|
class OutletSetOnEvent(ModuleEvent):
|
|
164
|
-
"""
|
|
174
|
+
"""
|
|
175
|
+
Event dispatched when outlet set is on.
|
|
165
176
|
|
|
166
177
|
Attributes:
|
|
167
178
|
value: On or Off the light bulb set.
|
|
@@ -183,7 +194,8 @@ class OutletGetInUseEvent(ModuleEvent):
|
|
|
183
194
|
|
|
184
195
|
|
|
185
196
|
class OutletSetInUseEvent(ModuleEvent, BaseEvent[bool]):
|
|
186
|
-
"""
|
|
197
|
+
"""
|
|
198
|
+
Event dispatched when outlet set is on.
|
|
187
199
|
|
|
188
200
|
Attributes:
|
|
189
201
|
value: On or Off the light bulb set.
|
|
@@ -193,7 +205,8 @@ class OutletSetInUseEvent(ModuleEvent, BaseEvent[bool]):
|
|
|
193
205
|
|
|
194
206
|
|
|
195
207
|
class DimmingLightSetOnEvent(ModuleEvent):
|
|
196
|
-
"""
|
|
208
|
+
"""
|
|
209
|
+
Event dispatched when dimming light set is on.
|
|
197
210
|
|
|
198
211
|
Attributes:
|
|
199
212
|
value: On or Off the light bulb set.
|
|
@@ -211,7 +224,8 @@ class DimmingLightGetOnEvent(ModuleEvent):
|
|
|
211
224
|
|
|
212
225
|
|
|
213
226
|
class DimmingLightSetBrightnessEvent(ModuleEvent):
|
|
214
|
-
"""
|
|
227
|
+
"""
|
|
228
|
+
Event dispatched when dimming light set is on.
|
|
215
229
|
|
|
216
230
|
Attributes:
|
|
217
231
|
brightness: Level of brightness of the dimming light.
|
|
@@ -227,7 +241,8 @@ class DimmingLightGetBrightnessEvent(ModuleEvent):
|
|
|
227
241
|
|
|
228
242
|
|
|
229
243
|
class ConnectionLostEvent(BaseEvent):
|
|
230
|
-
"""
|
|
244
|
+
"""
|
|
245
|
+
Event dispatched when TCP connection is lost.
|
|
231
246
|
|
|
232
247
|
Attributes:
|
|
233
248
|
reason: Disconnection reason.
|
|
@@ -237,7 +252,8 @@ class ConnectionLostEvent(BaseEvent):
|
|
|
237
252
|
|
|
238
253
|
|
|
239
254
|
class TelegramEvent(BaseEvent):
|
|
240
|
-
"""
|
|
255
|
+
"""
|
|
256
|
+
Event for telegram operations.
|
|
241
257
|
|
|
242
258
|
Attributes:
|
|
243
259
|
protocol: TelegramProtocol instance.
|
|
@@ -265,7 +281,8 @@ class TelegramEvent(BaseEvent):
|
|
|
265
281
|
|
|
266
282
|
|
|
267
283
|
class ModuleStateChangedEvent(BaseEvent):
|
|
268
|
-
"""
|
|
284
|
+
"""
|
|
285
|
+
Event dispatched when a module's state changes (from event telegram).
|
|
269
286
|
|
|
270
287
|
Attributes:
|
|
271
288
|
module_type_code: Module type code from event telegram.
|
|
@@ -299,7 +316,8 @@ class TelegramReceivedEvent(TelegramEvent):
|
|
|
299
316
|
|
|
300
317
|
|
|
301
318
|
class InvalidTelegramReceivedEvent(BaseEvent):
|
|
302
|
-
"""
|
|
319
|
+
"""
|
|
320
|
+
Event dispatched when an invalid telegram frame is received.
|
|
303
321
|
|
|
304
322
|
Attributes:
|
|
305
323
|
protocol: TelegramProtocol instance.
|
xp/models/response.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Response model for structured service responses.
|
|
2
3
|
|
|
3
|
-
This module provides the Response class used throughout the application
|
|
4
|
-
|
|
4
|
+
This module provides the Response class used throughout the application for consistent
|
|
5
|
+
service response formatting.
|
|
5
6
|
"""
|
|
6
7
|
|
|
7
8
|
from datetime import datetime
|
|
@@ -9,14 +10,16 @@ from typing import Any, Optional
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class Response:
|
|
12
|
-
"""
|
|
13
|
+
"""
|
|
14
|
+
Standard response model for service operations.
|
|
13
15
|
|
|
14
|
-
Provides consistent structure for all service responses including
|
|
15
|
-
|
|
16
|
+
Provides consistent structure for all service responses including success status,
|
|
17
|
+
data payload, error messages, and timestamp.
|
|
16
18
|
"""
|
|
17
19
|
|
|
18
20
|
def __init__(self, success: bool, data: Any, error: Optional[str] = None):
|
|
19
|
-
"""
|
|
21
|
+
"""
|
|
22
|
+
Initialize response.
|
|
20
23
|
|
|
21
24
|
Args:
|
|
22
25
|
success: Whether the operation was successful
|
|
@@ -29,7 +32,8 @@ class Response:
|
|
|
29
32
|
self.timestamp = datetime.now()
|
|
30
33
|
|
|
31
34
|
def to_dict(self) -> dict:
|
|
32
|
-
"""
|
|
35
|
+
"""
|
|
36
|
+
Convert response to dictionary for JSON serialization.
|
|
33
37
|
|
|
34
38
|
Returns:
|
|
35
39
|
Dictionary representation of the response
|
|
@@ -5,7 +5,8 @@ from typing import Optional
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class ActionType(Enum):
|
|
8
|
-
"""
|
|
8
|
+
"""
|
|
9
|
+
Action types for XP24 telegrams.
|
|
9
10
|
|
|
10
11
|
Attributes:
|
|
11
12
|
OFF_PRESS: Make action (activate relay).
|
|
@@ -17,7 +18,8 @@ class ActionType(Enum):
|
|
|
17
18
|
|
|
18
19
|
@classmethod
|
|
19
20
|
def from_code(cls, code: str) -> Optional["ActionType"]:
|
|
20
|
-
"""
|
|
21
|
+
"""
|
|
22
|
+
Get ActionType from code string.
|
|
21
23
|
|
|
22
24
|
Args:
|
|
23
25
|
code: Action code string.
|
|
@@ -5,7 +5,8 @@ from typing import Optional
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class DataPointType(str, Enum):
|
|
8
|
-
"""
|
|
8
|
+
"""
|
|
9
|
+
Data point types for system telegrams.
|
|
9
10
|
|
|
10
11
|
Attributes:
|
|
11
12
|
MODULE_TYPE: Module type (XP24, XP33, etc).
|
|
@@ -98,7 +99,8 @@ class DataPointType(str, Enum):
|
|
|
98
99
|
|
|
99
100
|
@classmethod
|
|
100
101
|
def from_code(cls, code: str) -> Optional["DataPointType"]:
|
|
101
|
-
"""
|
|
102
|
+
"""
|
|
103
|
+
Get DataPointType from code string.
|
|
102
104
|
|
|
103
105
|
Args:
|
|
104
106
|
code: Datapoint type code string.
|