connectlife-cloud 0.1.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.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: connectlife-cloud
3
+ Version: 0.1.0
4
+ Summary: ConnectLife Cloud API client library for Home Assistant integrations
5
+ Home-page: https://github.com/Connectlife-LLC/connectlife-cloud
6
+ Author: ConnectLife LLC
7
+ Author-email: ConnectLife LLC <support@connectlife.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/Connectlife-LLC/connectlife-cloud
10
+ Project-URL: Repository, https://github.com/Connectlife-LLC/connectlife-cloud
11
+ Project-URL: Issues, https://github.com/Connectlife-LLC/connectlife-cloud/issues
12
+ Keywords: homeassistant,connectlife,api,client,iot
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Home Automation
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ Requires-Dist: aiohttp>=3.8.0
28
+ Requires-Dist: pytz>=2021.1
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=6.0; extra == "dev"
31
+ Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
32
+ Requires-Dist: pytest-cov>=2.10.0; extra == "dev"
33
+ Requires-Dist: black>=21.0.0; extra == "dev"
34
+ Requires-Dist: isort>=5.0.0; extra == "dev"
35
+ Requires-Dist: mypy>=0.910; extra == "dev"
36
+ Requires-Dist: pre-commit>=2.15.0; extra == "dev"
37
+ Dynamic: author
38
+ Dynamic: home-page
39
+ Dynamic: requires-python
40
+
41
+ # ConnectLife Cloud API Client
42
+
43
+ A Python client library for the ConnectLife Cloud API, designed for Home Assistant integrations.
44
+
45
+ ## Features
46
+
47
+ - Async/await support
48
+ - Full type hints
49
+ - Comprehensive error handling
50
+ - Device management
51
+ - Real-time status updates
52
+ - Power consumption tracking
53
+ - Self-check diagnostics
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ pip install connectlife-cloud
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ ```python
64
+ import asyncio
65
+ from connectlife_cloud import ConnectLifeCloudClient
66
+
67
+ async def main():
68
+ client = ConnectLifeCloudClient(
69
+ client_id="your_client_id",
70
+ client_secret="your_client_secret"
71
+ )
72
+
73
+ try:
74
+ # Get devices
75
+ devices = await client.get_devices(access_token="your_token")
76
+ print(f"Found {len(devices)} devices")
77
+
78
+ # Control a device
79
+ result = await client.control_device(
80
+ puid="device_puid",
81
+ properties={"power": True, "mode": "cool"},
82
+ access_token="your_token"
83
+ )
84
+ print(f"Control result: {result}")
85
+
86
+ finally:
87
+ await client.close()
88
+
89
+ asyncio.run(main())
90
+ ```
91
+
92
+ ## API Reference
93
+
94
+ ### ConnectLifeCloudClient
95
+
96
+ The main client class for interacting with the ConnectLife Cloud API.
97
+
98
+ #### Methods
99
+
100
+ - `get_devices(access_token)`: Get list of devices
101
+ - `control_device(puid, properties, access_token)`: Control a device
102
+ - `get_property_list(device_type_code, device_feature_code, access_token)`: Get device properties
103
+ - `query_static_data(puid, access_token)`: Query static device data
104
+ - `get_hour_power(date, puid, access_token)`: Get hourly power consumption
105
+ - `get_self_check(no_record, puid, access_token)`: Get device self-check info
106
+
107
+ ## License
108
+
109
+ MIT License
@@ -0,0 +1,12 @@
1
+ devices/__init__.py,sha256=j3aCdUvDAUFAEvhX1TifRKcfG9iZwUNfMlHsLNWCC8k,1968
2
+ devices/atw_035_699.py,sha256=VFbecy2kMILn9nqgM0Yrhkb3jKwRg6L0DUDcEr__Cxo,3915
3
+ devices/base.py,sha256=7o4Gk4BYPYdnfUzYg2hOWJtO3QbqWPUJofpPWQf0x-g,4778
4
+ devices/base_bean.py,sha256=3neUOm1DkEq9p6Vvgi70tkuu3xDaFK4dBldH5H1U6eM,7098
5
+ devices/bean_006_299.py,sha256=IVV1OWXesQb-X-bmAaIx5y_Lyy5lXMPW4jPbiYlO2Do,4791
6
+ devices/hum_007.py,sha256=MWptxVxnt9DyxatgNqyn5Q7Y6jnAm7Vjv2Ds7-pSjlk,3070
7
+ devices/split_ac_009_199.py,sha256=5OO6mGBKSoDKWVkc79sTYnYYiNW3obmvxyA3csqN3zc,4465
8
+ devices/window_ac_008_399.py,sha256=h-LbTU90Qrkt4hlcEumu354gP_EBoQVCcbo8Vjgqru4,3230
9
+ connectlife_cloud-0.1.0.dist-info/METADATA,sha256=j49cwg0WFKjJ_dUOWYkoms9eLx3LvfmQwC-rbeZ1teI,3509
10
+ connectlife_cloud-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ connectlife_cloud-0.1.0.dist-info/top_level.txt,sha256=NJIjRQBHLZIoWIeR0cX1MxMlXvTMHRqN9EOA2djrqnI,8
12
+ connectlife_cloud-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ devices
devices/__init__.py ADDED
@@ -0,0 +1,46 @@
1
+ """Device parsers package."""
2
+ from typing import Dict, Type
3
+ import logging
4
+
5
+ from .atw_035_699 import SplitWater035699Parser
6
+ from .base import BaseDeviceParser
7
+ from .base_bean import BaseBeanParser
8
+ from .hum_007 import Humidity007Parser
9
+ from .split_ac_009_199 import SplitAC009199Parser
10
+ from .window_ac_008_399 import WindowAC008399Parser
11
+ from .bean_006_299 import Split006299Parser
12
+
13
+ _LOGGER = logging.getLogger(__name__)
14
+
15
+ # Registry of device parsers
16
+ DEVICE_PARSERS: Dict[tuple[str, str], Type[BaseDeviceParser]] = {
17
+ ("035", "699"): SplitWater035699Parser,
18
+ ("006", "299"): Split006299Parser,
19
+ ("007", ""): Humidity007Parser,
20
+ }
21
+
22
+
23
+ def get_device_parser(device_type: str , feature_code: str) -> Type[BaseDeviceParser]:
24
+ """Get device parser for the given device type."""
25
+ _LOGGER.debug("Getting device parser for type %s", device_type)
26
+ if DEVICE_PARSERS.get((device_type, feature_code)):
27
+ _LOGGER.debug("三联供设备 %s", device_type)
28
+ return DEVICE_PARSERS[(device_type, feature_code)]
29
+ if device_type == "007":
30
+ _LOGGER.debug("除湿机设备 %s", device_type)
31
+ return Humidity007Parser
32
+ # 预设的设备类型集合
33
+ supported_device_types = ["009", "008", "006", "016"]
34
+ if device_type in supported_device_types:
35
+ parser_class = BaseBeanParser
36
+ _LOGGER.debug("Using default parser for device type %s", device_type)
37
+ # try:
38
+ # static_data = await self.async_get_property_list(device_type, feature_code)
39
+ # _LOGGER.debug("Static data for device %s: %s: %s", device_type, feature_code, static_data)
40
+ # except Exception as query_err:
41
+ # _LOGGER.error("Error querying static data for device %s: %s", feature_code, query_err)
42
+ return parser_class
43
+ else:
44
+ _LOGGER.warning("Unsupported device type: %s", device_type)
45
+ raise ValueError(f"Unsupported device type: {device_type}")
46
+
devices/atw_035_699.py ADDED
@@ -0,0 +1,117 @@
1
+ """Parser for Split AC (009-199) device type."""
2
+ from typing import Dict
3
+
4
+ from .base import BaseDeviceParser, DeviceAttribute
5
+
6
+ class SplitWater035699Parser(BaseDeviceParser):
7
+ """Parser for Split AC 009-199 device type."""
8
+
9
+ @property
10
+ def device_type(self) -> str:
11
+ return "035"
12
+
13
+ @property
14
+ def feature_code(self) -> str:
15
+ return "699"
16
+
17
+ @property
18
+ def attributes(self) -> Dict[str, DeviceAttribute]:
19
+ return {
20
+ "t_work_mode": DeviceAttribute(
21
+ key="t_work_mode",
22
+ name="设定模式",
23
+ attr_type="Enum",
24
+ step=1,
25
+ value_range="1, 0, 15, 5, 6, 16, 3",
26
+ value_map={
27
+ "0": "制热",
28
+ "1": "制冷",
29
+ "15": "自动",
30
+ "5": "热水+制冷",
31
+ "16": "热水+自动",
32
+ "3": "热水",
33
+ "6": "热水+制热"
34
+ },
35
+ read_write="RW"
36
+ ),
37
+ "t_temp": DeviceAttribute(
38
+ key="t_temp",
39
+ name="设置温度",
40
+ attr_type="Number",
41
+ step=1,
42
+ value_range="16~32,61~90",
43
+ read_write="RW"
44
+ ),
45
+ "t_power": DeviceAttribute(
46
+ key="t_power",
47
+ name="开关机",
48
+ attr_type="Enum",
49
+ step=1,
50
+ value_range="0,1",
51
+ value_map={
52
+ "0": "关",
53
+ "1": "开"
54
+ },
55
+ read_write="RW"
56
+ ),
57
+ "f_zone1water_temp1": DeviceAttribute(
58
+ key="f_zone1water_temp1",
59
+ name="1温区实际值",
60
+ attr_type="Number",
61
+ step=1,
62
+ value_range="16~32,61~90",
63
+ read_write="R"
64
+ ),
65
+ "f_zone2water_temp2": DeviceAttribute(
66
+ key="f_zone2water_temp2",
67
+ name="2温区实际值",
68
+ attr_type="Number",
69
+ step=1,
70
+ value_range="16~32,61~90",
71
+ read_write="R"
72
+ ),
73
+ "f_water_tank_temp": DeviceAttribute(
74
+ key="f_water_tank_temp",
75
+ name="生活热水实际值",
76
+ attr_type="Number",
77
+ step=1,
78
+ value_range="16~32,61~90",
79
+ read_write="R"
80
+ ),
81
+ "t_zone1water_settemp1": DeviceAttribute(
82
+ key="t_zone1water_settemp1",
83
+ name="1温区设置值",
84
+ attr_type="Number",
85
+ step=1,
86
+ value_range="16~32,61~90",
87
+ read_write="RW"
88
+ ),
89
+ "t_zone2water_settemp2": DeviceAttribute(
90
+ key="t_zone2water_settemp2",
91
+ name="2温区设置值",
92
+ attr_type="Number",
93
+ step=1,
94
+ value_range="16~32,61~90",
95
+ read_write="RW"
96
+ ),
97
+ "t_dhw_temp": DeviceAttribute(
98
+ key="t_dhw_temp",
99
+ name="生活热水设置值",
100
+ attr_type="Number",
101
+ step=1,
102
+ value_range="16~32,61~90",
103
+ read_write="RW"
104
+ ),
105
+ "f_power_consumption": DeviceAttribute(
106
+ key="f_power_consumption",
107
+ name="电量累积消耗值",
108
+ attr_type="Number",
109
+ read_write="R"
110
+ ),
111
+ }
112
+
113
+ def remove_attribute(self, key: str) -> None:
114
+ """移除指定的属性"""
115
+ attributes = self.attributes
116
+ if key in attributes:
117
+ del attributes[key]
devices/base.py ADDED
@@ -0,0 +1,129 @@
1
+ """Base device parser class."""
2
+ from abc import ABC, abstractmethod
3
+ from typing import Any, Dict, Optional
4
+ from dataclasses import dataclass
5
+ import logging
6
+
7
+ _LOGGER = logging.getLogger(__name__)
8
+
9
+ @dataclass
10
+ class DeviceAttribute:
11
+ """Device attribute definition."""
12
+ key: str
13
+ name: str
14
+ attr_type: str
15
+ step: int = 1
16
+ value_range: Optional[str] = None#数值区间
17
+ value_map: Optional[Dict[str, str]] = None#数值集合
18
+ read_write: str = "RW"
19
+
20
+ class BaseDeviceParser(ABC):
21
+ """Base class for device parsers."""
22
+
23
+ @property
24
+ @abstractmethod
25
+ def device_type(self) -> str:
26
+ """Return device type code."""
27
+ pass
28
+
29
+ @property
30
+ @abstractmethod
31
+ def feature_code(self) -> str:
32
+ """Return feature code."""
33
+ pass
34
+
35
+ @property
36
+ @abstractmethod
37
+ def attributes(self) -> Dict[str, DeviceAttribute]:
38
+ """Return device attributes."""
39
+ pass
40
+ def remove_attribute(self, key: str) -> None:
41
+ """移除指定的属性"""
42
+ attributes = self.attributes
43
+ if key in attributes:
44
+ del attributes[key]
45
+
46
+ def parse_status(self, status: Dict[str, Any]) -> Dict[str, Any]:
47
+ """Parse device status."""
48
+ _LOGGER.debug(
49
+ "Parsing status for device type %s-%s with attributes: %s",
50
+ self.device_type,
51
+ self.feature_code,
52
+ {k: attr.name for k, attr in self.attributes.items()}
53
+ )
54
+ _LOGGER.debug("Raw status: %s", status)
55
+
56
+ parsed_status = {}
57
+ for key, attr in self.attributes.items():
58
+ if key in status:
59
+ value = status[key]
60
+ try:
61
+ if attr.value_map and value in attr.value_map:
62
+ parsed_value = attr.value_map[value]
63
+ # _LOGGER.debug(
64
+ # "Mapped attribute %s (%s) from %s to %s",
65
+ # key, attr.name, value, parsed_value
66
+ # )
67
+ elif attr.attr_type == "Number":
68
+ parsed_value = float(value)
69
+ # _LOGGER.debug(
70
+ # "Converted attribute %s (%s) to number: %s",
71
+ # key, attr.name, parsed_value
72
+ # )
73
+ else:
74
+ parsed_value = value
75
+ # _LOGGER.debug(
76
+ # "Using raw value for attribute %s (%s): %s",
77
+ # key, attr.name, parsed_value
78
+ # )
79
+ parsed_status[key] = parsed_value
80
+ except (ValueError, TypeError) as err:
81
+ _LOGGER.warning(
82
+ "Failed to parse attribute %s (%s) with value %s: %s",
83
+ key, attr.name, value, err
84
+ )
85
+ continue
86
+
87
+ _LOGGER.debug("Parsed status: %s", parsed_status)
88
+ return parsed_status
89
+
90
+ def validate_value(self, key: str, value: Any) -> bool:
91
+ """Validate value for a given attribute."""
92
+ if key not in self.attributes:
93
+ _LOGGER.warning("Attribute %s not found in device type %s-%s",
94
+ key, self.device_type, self.feature_code)
95
+ return False
96
+
97
+ attr = self.attributes[key]
98
+ if attr.read_write == "R":
99
+ _LOGGER.warning("Attribute %s (%s) is read-only", key, attr.name)
100
+ return False
101
+
102
+ if attr.value_range:
103
+ try:
104
+ min_val, max_val = map(float, attr.value_range.split(","))
105
+ value = float(value)
106
+ valid = min_val <= value <= max_val
107
+ if not valid:
108
+ _LOGGER.warning(
109
+ "Value %s for attribute %s (%s) is outside valid range %s-%s",
110
+ value, key, attr.name, min_val, max_val
111
+ )
112
+ return valid
113
+ except (ValueError, TypeError) as err:
114
+ _LOGGER.warning(
115
+ "Failed to validate range for attribute %s (%s): %s",
116
+ key, attr.name, err
117
+ )
118
+ return False
119
+
120
+ if attr.value_map:
121
+ valid = str(value) in attr.value_map.keys()
122
+ if not valid:
123
+ _LOGGER.warning(
124
+ "Value %s for attribute %s (%s) is not in valid map %s",
125
+ value, key, attr.name, list(attr.value_map.keys())
126
+ )
127
+ return valid
128
+
129
+ return True
devices/base_bean.py ADDED
@@ -0,0 +1,203 @@
1
+ # base_bean.py
2
+ from typing import Dict, List
3
+
4
+ from .base import BaseDeviceParser, DeviceAttribute
5
+
6
+ class BaseBeanParser(BaseDeviceParser):
7
+
8
+ @property
9
+ def device_type(self) -> str:
10
+ return "1"
11
+
12
+ @property
13
+ def feature_code(self) -> str:
14
+ return "2"
15
+
16
+ def remove_attribute(self, key: str) -> None:
17
+ """移除指定的属性"""
18
+ if key in self._attributes:
19
+ del self._attributes[key]
20
+
21
+
22
+ @property
23
+ def attributes(self) -> Dict[str, DeviceAttribute]:
24
+ if not hasattr(self, '_attributes'):
25
+ self._attributes = {
26
+ "t_work_mode": DeviceAttribute(
27
+ key="t_work_mode",
28
+ name="设定模式",
29
+ attr_type="Enum",
30
+ step=1,
31
+ value_range="0,1,2,3,4,5",
32
+ value_map={
33
+ "0": "送风",
34
+ "1": "制热",
35
+ "2": "制冷",
36
+ "3": "除湿",
37
+ "4": "自动",
38
+ "5": "E-star",
39
+ "8": "标准模式",
40
+ "9": "ECO模式",
41
+ "10": "双能热水模式",
42
+ "11": "双能1模式",
43
+ "12": "电热热水模式"
44
+ },
45
+ read_write="RW"
46
+ ),
47
+ "t_power": DeviceAttribute(
48
+ key="t_power",
49
+ name="开关机",
50
+ attr_type="Enum",
51
+ step=1,
52
+ value_range="0,1",
53
+ value_map={
54
+ "0": "关",
55
+ "1": "开"
56
+ },
57
+ read_write="RW"
58
+ ),
59
+ "t_temp": DeviceAttribute(
60
+ key="t_temp",
61
+ name="设置温度",
62
+ attr_type="Number",
63
+ step=1,
64
+ value_range="16~32,61~90",
65
+ read_write="RW"
66
+ ),
67
+ "t_fan_speed": DeviceAttribute(
68
+ key="t_fan_speed",
69
+ name="设定风速",
70
+ attr_type="Enum",
71
+ step=1,
72
+ value_range="0,5,6,7,8,9",
73
+ value_map={
74
+ "2": "低风",
75
+ "3": "中风",
76
+ "4": "高风",
77
+ "0": "自动",
78
+ "5": "低",
79
+ "6": "中低",
80
+ "7": "中",
81
+ "8": "中高",
82
+ "9": "高"
83
+ },
84
+ read_write="RW"
85
+ ),
86
+ "t_up_down": DeviceAttribute(
87
+ key="t_up_down",
88
+ name="上下风",
89
+ attr_type="Enum",
90
+ step=1,
91
+ value_range="0,1",
92
+ value_map={
93
+ "0": "取消",
94
+ "1": "开启"
95
+ },
96
+ read_write="RW"
97
+ ),
98
+ "t_temp_type": DeviceAttribute(
99
+ key="t_temp_type",
100
+ name="温度单位切换",
101
+ attr_type="Enum",
102
+ step=1,
103
+ value_range="0,1",
104
+ value_map={
105
+ "0": "摄氏",
106
+ "1": "华氏"
107
+ },
108
+ read_write="RW"
109
+ ),
110
+ "t_left_right": DeviceAttribute(
111
+ key="t_left_right",
112
+ name="左右风",
113
+ attr_type="Enum",
114
+ step=1,
115
+ value_range="0,1",
116
+ value_map={
117
+ "0": "取消",
118
+ "1": "开启"
119
+ },
120
+ read_write="RW"
121
+ ),
122
+ "f_power_consumption": DeviceAttribute(
123
+ key="f_power_consumption",
124
+ name="电量累积消耗值",
125
+ attr_type="Number",
126
+ read_write="R"
127
+ ),
128
+ "t_fan_mute": DeviceAttribute(
129
+ key="t_fan_mute",
130
+ name="设定静音",
131
+ attr_type="Enum",
132
+ step=1,
133
+ value_range="0,1",
134
+ value_map={
135
+ "0": "停",
136
+ "1": "开"
137
+ },
138
+ read_write="RW"
139
+ ),
140
+ "f_temp_in": DeviceAttribute(
141
+ key="f_temp_in",
142
+ name="室内温度",
143
+ attr_type="Number",
144
+ read_write="R"
145
+ ),
146
+ "t_8heat": DeviceAttribute(
147
+ key="t_8heat",
148
+ name="8°制热",
149
+ attr_type="Enum",
150
+ step=1,
151
+ value_range="0,1",
152
+ value_map={
153
+ "0": "关闭",
154
+ "1": "开启"
155
+ },
156
+ read_write="RW"
157
+ ),
158
+ "t_eco": DeviceAttribute(
159
+ key="t_eco",
160
+ name="节能模式",
161
+ attr_type="Enum",
162
+ step=1,
163
+ value_range="0,1",
164
+ value_map={
165
+ "0": "关闭",
166
+ "1": "开启"
167
+ },
168
+ read_write="RW"
169
+ ),
170
+ "t_humidity": DeviceAttribute(
171
+ key="t_humidity",
172
+ name="设定湿度值",
173
+ attr_type="Number",
174
+ step=5,
175
+ value_range="30~80",
176
+ read_write="RW"
177
+ ),
178
+ "f_humidity": DeviceAttribute(
179
+ key="f_humidity",
180
+ name="实际湿度",
181
+ attr_type="Number",
182
+ step=1,
183
+ value_range="30~90",
184
+ read_write="R"
185
+ ),
186
+ "t_super": DeviceAttribute(
187
+ key="t_super",
188
+ name="强力",
189
+ attr_type="Enum",
190
+ step=1,
191
+ value_range="0,1",
192
+ value_map={
193
+ "0": "取消",
194
+ "1": "开启"
195
+ },
196
+ read_write="RW"
197
+ )
198
+ }
199
+ return self._attributes
200
+
201
+ @attributes.setter
202
+ def attributes(self, value: Dict[str, DeviceAttribute]):
203
+ self._attributes = value
@@ -0,0 +1,141 @@
1
+ # base_bean.py
2
+ from typing import Dict, List
3
+
4
+ from .base import BaseDeviceParser, DeviceAttribute
5
+ from .base_bean import BaseBeanParser
6
+
7
+ class Split006299Parser(BaseDeviceParser):
8
+
9
+ @property
10
+ def device_type(self) -> str:
11
+ return "006"
12
+
13
+ @property
14
+ def feature_code(self) -> str:
15
+ return "299"
16
+
17
+ def remove_attribute(self, key: str) -> None:
18
+ """移除指定的属性"""
19
+ if key in self._attributes:
20
+ del self._attributes[key]
21
+
22
+
23
+ @property
24
+ def attributes(self) -> Dict[str, DeviceAttribute]:
25
+ if not hasattr(self, '_attributes'):
26
+ self._attributes = {
27
+ "t_work_mode": DeviceAttribute(
28
+ key="t_work_mode",
29
+ name="设定模式",
30
+ attr_type="Enum",
31
+ step=1,
32
+ value_range="0,1,2,3,4,5",
33
+ value_map={
34
+ "0": "送风",
35
+ "1": "制热",
36
+ "2": "制冷",
37
+ "3": "除湿",
38
+ "4": "自动"
39
+ },
40
+ read_write="RW"
41
+ ),
42
+ "t_power": DeviceAttribute(
43
+ key="t_power",
44
+ name="开关机",
45
+ attr_type="Enum",
46
+ step=1,
47
+ value_range="0,1",
48
+ value_map={
49
+ "0": "关",
50
+ "1": "开"
51
+ },
52
+ read_write="RW"
53
+ ),
54
+ "t_temp": DeviceAttribute(
55
+ key="t_temp",
56
+ name="设置温度",
57
+ attr_type="Number",
58
+ step=1,
59
+ value_range="16~32,61~90",
60
+ read_write="RW"
61
+ ),
62
+ "t_fan_speed": DeviceAttribute(
63
+ key="t_fan_speed",
64
+ name="设定风速",
65
+ attr_type="Enum",
66
+ step=1,
67
+ value_range="0,5,6,7,8,9",
68
+ value_map={
69
+ "0": "自动",
70
+ "5": "低",
71
+ "7": "中",
72
+ "9": "高"
73
+ },
74
+ read_write="RW"
75
+ ),
76
+ "t_up_down": DeviceAttribute(
77
+ key="t_up_down",
78
+ name="上下风",
79
+ attr_type="Enum",
80
+ step=1,
81
+ value_range="0,1",
82
+ value_map={
83
+ "0": "取消",
84
+ "1": "开启"
85
+ },
86
+ read_write="RW"
87
+ ),
88
+ "t_temp_type": DeviceAttribute(
89
+ key="t_temp_type",
90
+ name="温度单位切换",
91
+ attr_type="Enum",
92
+ step=1,
93
+ value_range="0,1",
94
+ value_map={
95
+ "0": "摄氏",
96
+ "1": "华氏"
97
+ },
98
+ read_write="RW"
99
+ ),
100
+ "f_power_consumption": DeviceAttribute(
101
+ key="f_power_consumption",
102
+ name="电量累积消耗值",
103
+ attr_type="Number",
104
+ read_write="R"
105
+ ),
106
+ "t_fan_mute": DeviceAttribute(
107
+ key="t_fan_mute",
108
+ name="设定静音",
109
+ attr_type="Enum",
110
+ step=1,
111
+ value_range="0,1",
112
+ value_map={
113
+ "0": "停",
114
+ "1": "开"
115
+ },
116
+ read_write="RW"
117
+ ),
118
+ "f_temp_in": DeviceAttribute(
119
+ key="f_temp_in",
120
+ name="室内温度",
121
+ attr_type="Number",
122
+ read_write="R"
123
+ ),
124
+ "t_super": DeviceAttribute(
125
+ key="t_super",
126
+ name="强力",
127
+ attr_type="Enum",
128
+ step=1,
129
+ value_range="0,1",
130
+ value_map={
131
+ "0": "取消",
132
+ "1": "开启"
133
+ },
134
+ read_write="RW"
135
+ )
136
+ }
137
+ return self._attributes
138
+
139
+ @attributes.setter
140
+ def attributes(self, value: Dict[str, DeviceAttribute]):
141
+ self._attributes = value
devices/hum_007.py ADDED
@@ -0,0 +1,90 @@
1
+ """Parser for Split AC (009-199) device type."""
2
+ from typing import Dict
3
+
4
+ from .base import BaseDeviceParser, DeviceAttribute
5
+
6
+ class Humidity007Parser(BaseDeviceParser):
7
+ """Parser for Split AC 009-199 device type."""
8
+
9
+ @property
10
+ def device_type(self) -> str:
11
+ return "007"
12
+
13
+ @property
14
+ def feature_code(self) -> str:
15
+ return ""
16
+
17
+
18
+ @property
19
+ def attributes(self) -> Dict[str, DeviceAttribute]:
20
+ if not hasattr(self, '_attributes'):
21
+ self._attributes = {
22
+ "t_work_mode": DeviceAttribute(
23
+ key="t_work_mode",
24
+ name="设定模式",
25
+ attr_type="Enum",
26
+ step=1,
27
+ value_range="1, 0, 15, 5, 6, 16, 3",
28
+ value_map={
29
+ "0": "持续",
30
+ "1": "正常",
31
+ "2": "自动",
32
+ "3": "干衣"
33
+ },
34
+ read_write="RW"
35
+ ),
36
+ "t_humidity": DeviceAttribute(
37
+ key="t_humidity",
38
+ name="设定湿度值",
39
+ attr_type="Number",
40
+ step=5,
41
+ value_range="30~80",
42
+ read_write="RW"
43
+ ),
44
+ "f_humidity": DeviceAttribute(
45
+ key="f_humidity",
46
+ name="实际湿度",
47
+ attr_type="Number",
48
+ step=1,
49
+ value_range="30~90",
50
+ read_write="R"
51
+ ),
52
+ "t_power": DeviceAttribute(
53
+ key="t_power",
54
+ name="开关机",
55
+ attr_type="Enum",
56
+ step=1,
57
+ value_range="0,1",
58
+ value_map={
59
+ "0": "关",
60
+ "1": "开"
61
+ },
62
+ read_write="RW"
63
+ ),
64
+ "t_fan_speed": DeviceAttribute(
65
+ key="t_fan_speed",
66
+ name="设定风速",
67
+ attr_type="Enum",
68
+ step=1,
69
+ value_range="0,5,6,7,8,9",
70
+ value_map={
71
+ "2": "自动",
72
+ "3": "中风",
73
+ "1": "高风",
74
+ "0": "低风"
75
+ },
76
+ read_write="RW"
77
+ ),
78
+ "f_power_consumption": DeviceAttribute(
79
+ key="f_power_consumption",
80
+ name="电量累积消耗值",
81
+ attr_type="Number",
82
+ read_write="R"
83
+ ),
84
+ }
85
+ return self._attributes
86
+
87
+ def remove_attribute(self, key: str) -> None:
88
+ """移除指定的属性"""
89
+ if key in self._attributes:
90
+ del self._attributes[key]
@@ -0,0 +1,143 @@
1
+ """Parser for Split AC (009-199) device type."""
2
+ from typing import Dict
3
+
4
+ from .base import BaseDeviceParser, DeviceAttribute
5
+
6
+ class SplitAC009199Parser(BaseDeviceParser):
7
+ """Parser for Split AC 009-199 device type."""
8
+
9
+ @property
10
+ def device_type(self) -> str:
11
+ return "009"
12
+
13
+ @property
14
+ def feature_code(self) -> str:
15
+ return "199"
16
+
17
+ @property
18
+ def attributes(self) -> Dict[str, DeviceAttribute]:
19
+ return {
20
+ "t_work_mode": DeviceAttribute(
21
+ key="t_work_mode",
22
+ name="设定模式",
23
+ attr_type="Enum",
24
+ step=1,
25
+ value_range="0,1,2,3,4",
26
+ value_map={
27
+ "0": "送风",
28
+ "1": "制热",
29
+ "2": "制冷",
30
+ "3": "除湿",
31
+ "4": "自动"
32
+ },
33
+ read_write="RW"
34
+ ),
35
+ "t_power": DeviceAttribute(
36
+ key="t_power",
37
+ name="开关机",
38
+ attr_type="Enum",
39
+ step=1,
40
+ value_range="0,1",
41
+ value_map={
42
+ "0": "关",
43
+ "1": "开"
44
+ },
45
+ read_write="RW"
46
+ ),
47
+ "t_temp": DeviceAttribute(
48
+ key="t_temp",
49
+ name="设置温度",
50
+ attr_type="Number",
51
+ step=1,
52
+ value_range="16~32,61~90",
53
+ read_write="RW"
54
+ ),
55
+ "t_fan_speed": DeviceAttribute(
56
+ key="t_fan_speed",
57
+ name="设定风速",
58
+ attr_type="Enum",
59
+ step=1,
60
+ value_range="0,5,6,7,8,9",
61
+ value_map={
62
+ "0": "自动",
63
+ "5": "超低",
64
+ "6": "低",
65
+ "7": "中",
66
+ "8": "高",
67
+ "9": "超高"
68
+ },
69
+ read_write="RW"
70
+ ),
71
+ "t_up_down": DeviceAttribute(
72
+ key="t_up_down",
73
+ name="上下风",
74
+ attr_type="Enum",
75
+ step=1,
76
+ value_range="0,1",
77
+ value_map={
78
+ "0": "取消",
79
+ "1": "开启"
80
+ },
81
+ read_write="RW"
82
+ ),
83
+ "t_left_right": DeviceAttribute(
84
+ key="t_left_right",
85
+ name="左右风",
86
+ attr_type="Enum",
87
+ step=1,
88
+ value_range="0,1",
89
+ value_map={
90
+ "0": "取消",
91
+ "1": "开启"
92
+ },
93
+ read_write="RW"
94
+ ),
95
+ "t_power_consumption": DeviceAttribute(
96
+ key="t_power_consumption",
97
+ name="电量累积消耗值",
98
+ attr_type="Number",
99
+ read_write="R"
100
+ ),
101
+ "t_fan_mute": DeviceAttribute(
102
+ key="t_fan_mute",
103
+ name="设定静音",
104
+ attr_type="Enum",
105
+ step=1,
106
+ value_range="0,1",
107
+ value_map={
108
+ "0": "停",
109
+ "1": "开"
110
+ },
111
+ read_write="RW"
112
+ ),
113
+ "t_super": DeviceAttribute(
114
+ key="t_super",
115
+ name="强力",
116
+ attr_type="Enum",
117
+ step=1,
118
+ value_range="0,1",
119
+ value_map={
120
+ "0": "取消",
121
+ "1": "开启"
122
+ },
123
+ read_write="RW"
124
+ ),
125
+ "t_temp_in": DeviceAttribute(
126
+ key="t_temp_in",
127
+ name="室内温度",
128
+ attr_type="Number",
129
+ read_write="R"
130
+ ),
131
+ "t_8heat": DeviceAttribute(
132
+ key="t_8heat",
133
+ name="8°制热",
134
+ attr_type="Enum",
135
+ step=1,
136
+ value_range="0,1",
137
+ value_map={
138
+ "0": "关闭",
139
+ "1": "开启"
140
+ },
141
+ read_write="RW"
142
+ )
143
+ }
@@ -0,0 +1,104 @@
1
+ """Parser for Window AC (008-399) device type."""
2
+ from typing import Dict
3
+
4
+ from .base import BaseDeviceParser, DeviceAttribute
5
+
6
+ class WindowAC008399Parser(BaseDeviceParser):
7
+ """Parser for Window AC 008-399 device type."""
8
+
9
+ @property
10
+ def device_type(self) -> str:
11
+ return "008"
12
+
13
+ @property
14
+ def feature_code(self) -> str:
15
+ return "399"
16
+
17
+ @property
18
+ def attributes(self) -> Dict[str, DeviceAttribute]:
19
+ return {
20
+ "t_work_mode": DeviceAttribute(
21
+ key="t_work_mode",
22
+ name="设定模式",
23
+ attr_type="Enum",
24
+ step=1,
25
+ value_range="0,1,2,3,5",
26
+ value_map={
27
+ "0": "送风",
28
+ "1": "制热",
29
+ "2": "制冷",
30
+ "3": "除湿",
31
+ "5": "E-star"
32
+ },
33
+ read_write="RW"
34
+ ),
35
+ "t_power": DeviceAttribute(
36
+ key="t_power",
37
+ name="开关机",
38
+ attr_type="Enum",
39
+ step=1,
40
+ value_range="0,1",
41
+ value_map={
42
+ "0": "关",
43
+ "1": "开"
44
+ },
45
+ read_write="RW"
46
+ ),
47
+ "t_temp": DeviceAttribute(
48
+ key="t_temp",
49
+ name="设置温度",
50
+ attr_type="Number",
51
+ step=1,
52
+ value_range="16~30,61~86",
53
+ read_write="RW"
54
+ ),
55
+ "t_fan_speed": DeviceAttribute(
56
+ key="t_fan_speed",
57
+ name="设定风速",
58
+ attr_type="Enum",
59
+ step=1,
60
+ value_range="5,7,9",
61
+ value_map={
62
+ "5": "低风",
63
+ "7": "中风",
64
+ "9": "高风"
65
+ },
66
+ read_write="RW"
67
+ ),
68
+ "t_power_consumption": DeviceAttribute(
69
+ key="t_power_consumption",
70
+ name="电量累积消耗值",
71
+ attr_type="Number",
72
+ read_write="R"
73
+ ),
74
+ "t_fan_mute": DeviceAttribute(
75
+ key="t_fan_mute",
76
+ name="设定静音",
77
+ attr_type="Enum",
78
+ step=1,
79
+ value_range="0,1",
80
+ value_map={
81
+ "0": "停",
82
+ "1": "开"
83
+ },
84
+ read_write="RW"
85
+ ),
86
+ "t_super": DeviceAttribute(
87
+ key="t_super",
88
+ name="强力",
89
+ attr_type="Enum",
90
+ step=1,
91
+ value_range="0,1",
92
+ value_map={
93
+ "0": "取消",
94
+ "1": "开启"
95
+ },
96
+ read_write="RW"
97
+ ),
98
+ "t_temp_in": DeviceAttribute(
99
+ key="t_temp_in",
100
+ name="室内温度",
101
+ attr_type="Number",
102
+ read_write="R"
103
+ )
104
+ }