pyvesync 3.0.0b0__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.
Files changed (49) hide show
  1. pyvesync/__init__.py +11 -0
  2. pyvesync/base_devices/__init__.py +35 -0
  3. pyvesync/base_devices/bulb_base.py +348 -0
  4. pyvesync/base_devices/fan_base.py +398 -0
  5. pyvesync/base_devices/fryer_base.py +69 -0
  6. pyvesync/base_devices/humidifier_base.py +460 -0
  7. pyvesync/base_devices/outlet_base.py +315 -0
  8. pyvesync/base_devices/purifier_base.py +518 -0
  9. pyvesync/base_devices/switch_base.py +270 -0
  10. pyvesync/base_devices/thermostat_base.py +277 -0
  11. pyvesync/base_devices/vesyncbasedevice.py +580 -0
  12. pyvesync/const.py +749 -0
  13. pyvesync/device_container.py +360 -0
  14. pyvesync/device_map.py +1090 -0
  15. pyvesync/devices/__init__.py +1 -0
  16. pyvesync/devices/vesyncbulb.py +1254 -0
  17. pyvesync/devices/vesyncfan.py +238 -0
  18. pyvesync/devices/vesynchumidifier.py +785 -0
  19. pyvesync/devices/vesynckitchen.py +664 -0
  20. pyvesync/devices/vesyncoutlet.py +962 -0
  21. pyvesync/devices/vesyncpurifier.py +951 -0
  22. pyvesync/devices/vesyncswitch.py +449 -0
  23. pyvesync/devices/vesyncthermostat.py +175 -0
  24. pyvesync/models/__init__.py +11 -0
  25. pyvesync/models/base_models.py +117 -0
  26. pyvesync/models/bulb_models.py +173 -0
  27. pyvesync/models/bypass_models.py +264 -0
  28. pyvesync/models/fan_models.py +46 -0
  29. pyvesync/models/fryer_models.py +28 -0
  30. pyvesync/models/home_models.py +158 -0
  31. pyvesync/models/humidifier_models.py +187 -0
  32. pyvesync/models/outlet_models.py +194 -0
  33. pyvesync/models/purifier_models.py +204 -0
  34. pyvesync/models/switch_models.py +89 -0
  35. pyvesync/models/thermostat_models.py +122 -0
  36. pyvesync/models/vesync_models.py +252 -0
  37. pyvesync/utils/__init__.py +1 -0
  38. pyvesync/utils/colors.py +248 -0
  39. pyvesync/utils/device_mixins.py +366 -0
  40. pyvesync/utils/enum_utils.py +25 -0
  41. pyvesync/utils/errors.py +859 -0
  42. pyvesync/utils/helpers.py +696 -0
  43. pyvesync/utils/logs.py +500 -0
  44. pyvesync/vesync.py +445 -0
  45. pyvesync-3.0.0b0.dist-info/METADATA +527 -0
  46. pyvesync-3.0.0b0.dist-info/RECORD +49 -0
  47. pyvesync-3.0.0b0.dist-info/WHEEL +5 -0
  48. pyvesync-3.0.0b0.dist-info/licenses/LICENSE +21 -0
  49. pyvesync-3.0.0b0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,158 @@
1
+ """Home and Rooms request and response models.
2
+
3
+ WORK IN PROGRESS - NOT IMPLEMENTED YET
4
+
5
+ Dataclasses should follow the naming convention of Request/Response + <API Name> + Model.
6
+ Internal models should be named starting with IntResp/IntReq<API Name>Model.
7
+
8
+ Attributes:
9
+ ResponseLoginResultModel: Model for the 'result' field in login response.
10
+ ResponseLoginModel: Model for the login response.
11
+ RequestLoginModel: Model for the login request.
12
+
13
+ Notes:
14
+ All models should inherit `ResponseBaseModel` or `RequestBaseModel`. Use
15
+ `pyvesync.models.base_models.DefaultValues` to set default values.
16
+
17
+ """
18
+ from __future__ import annotations
19
+ from dataclasses import dataclass, field
20
+
21
+ from pyvesync.models.base_models import (
22
+ ResponseCodeModel,
23
+ ResponseBaseModel,
24
+ RequestBaseModel,
25
+ DefaultValues,
26
+ )
27
+
28
+
29
+ @dataclass
30
+ class RequestHomeModel(RequestBaseModel):
31
+ """Request model for home data.
32
+
33
+ Inherits from `RequestVeSyncInstanceMixin` to populate fields from the
34
+ VeSync instance. The `VeSync` instance is passed as a
35
+ keyword argument `RequestHomeModel(manager=instance)`.
36
+ """
37
+ # Arguments set by Manager Instance by passing kw_argument manager
38
+ # these fields should be set to init=False
39
+ accountID: str = field(init=False)
40
+ token: str = field(init=False)
41
+ userCountryCode: str = field(init=False)
42
+ # Non-default constants
43
+ method: str = 'getHomeList'
44
+ # default values
45
+ acceptLanguage: str = DefaultValues.acceptLanguage
46
+ appVersion: str = DefaultValues.appVersion
47
+ timeZone: str = DefaultValues.timeZone
48
+ phoneBrand: str = DefaultValues.phoneBrand
49
+ phoneOS: str = DefaultValues.phoneOS
50
+ traceId: str = field(default_factory=DefaultValues.traceId)
51
+ debugMode: bool = DefaultValues.debugMode
52
+
53
+
54
+ @dataclass
55
+ class ResponseHomeModel(ResponseBaseModel):
56
+ """Model for the home data response.
57
+
58
+ Inherits from `ResponseBaseModel`. The `ResponseBaseModel` class provides the
59
+ `code` and `msg` fields. The `ResponseHomeModel` class provides the `result`
60
+ field containing the home data.
61
+
62
+ Attributes:
63
+ result: dict: The home data.
64
+ """
65
+ result: IntResponseHomeResultModel
66
+
67
+
68
+ @dataclass
69
+ class RequestHomeInfoModel(RequestBaseModel):
70
+ """Request model for home room information.
71
+
72
+ Inherits from `RequestVeSyncInstanceMixin` to populate fields from the
73
+ VeSync instance. The `VeSync` instance is passed as a
74
+ keyword argument `RequestHomeModel(manager=instance)`.
75
+ """
76
+ # argument to pass in as positional or keyword argument homeId
77
+ homeId: str
78
+ # Arguments set by Manager Instance by passing kw_argument manager
79
+ # these fields should be set to init=False
80
+ accountID: str = field(init=False)
81
+ token: str = field(init=False)
82
+ userCountryCode: str = field(init=False)
83
+ # Non-default constants
84
+ method: str = 'getHomeDetail'
85
+ # default values
86
+ acceptLanguage: str = DefaultValues.acceptLanguage
87
+ appVersion: str = DefaultValues.appVersion
88
+ timeZone: str = DefaultValues.timeZone
89
+ phoneBrand: str = DefaultValues.phoneBrand
90
+ phoneOS: str = DefaultValues.phoneOS
91
+ traceId: str = field(default_factory=DefaultValues.traceId)
92
+ debugMode: bool = DefaultValues.debugMode
93
+
94
+
95
+ @dataclass
96
+ class ResponseHomeInfoModel(ResponseCodeModel):
97
+ """Model for the home room information response.
98
+
99
+ Inherits from `ResponseCodeModel`. The `ResponseCodeModel` class provides the
100
+ `traceId`, `code`, and `msg` fields. The `ResponseHomeInfoModel` class provides
101
+ the `result` field containing the home room data.
102
+
103
+ Attributes:
104
+ result: dict: The home room data.
105
+ """
106
+ result: IntResponseHomeInfoResultModel
107
+
108
+
109
+ @dataclass
110
+ class IntResponseHomeInfoResultModel:
111
+ """Internal model for the 'result' field in home room response."""
112
+ roomInfoList: list[IntResponseHomeListModel]
113
+
114
+
115
+ @dataclass
116
+ class IntResponseRoomListModel:
117
+ """Internal model for the 'roomList' field in home response."""
118
+ roomID: str
119
+ roomName: str
120
+ deviceList: list[IntResponseRoomDeviceListModel]
121
+ plantComformHumidityRangeLower: int | None = None
122
+ plantComformHumidityRangeHigher: int | None = None
123
+ # group_list = [] # TODO: Create group model
124
+
125
+
126
+ @dataclass
127
+ class IntResponseRoomDeviceListModel:
128
+ """Internal model for the device list in room response."""
129
+ logicalDeviceType: int
130
+ virDeviceType: int
131
+ cid: str
132
+ uuid: str
133
+ subDeviceNo: int
134
+ deviceName: str
135
+ configModule: str
136
+ deviceRegion: str
137
+ deviceType: str
138
+ type: str
139
+ connectionType: str
140
+ currentFirmwareVersion: str
141
+ deviceStatus: str
142
+ connectionStatus: str
143
+ mode: str | None = None
144
+ subDeviceType: str | None = None
145
+ macid: str | None = None
146
+
147
+
148
+ @dataclass
149
+ class IntResponseHomeResultModel:
150
+ """Internal model for the 'result' field in home response."""
151
+ homeList: list[IntResponseHomeListModel]
152
+
153
+
154
+ @dataclass
155
+ class IntResponseHomeListModel:
156
+ """Internal model for the 'homeList' field in home response result."""
157
+ homeID: str
158
+ homeName: str
@@ -0,0 +1,187 @@
1
+ """Data models for VeSync Humidifier devices.
2
+
3
+ These models inherit from `ResponseBaseModel` and `RequestBaseModel` from the
4
+ `base_models` module.
5
+
6
+ The `InnerHumidifierBaseResult` class is used as a base class for the inner humidifier
7
+ result models. The correct subclass is determined by the mashumaro discriminator.
8
+ """
9
+ from __future__ import annotations
10
+ from dataclasses import dataclass
11
+ from typing import Annotated
12
+
13
+ from mashumaro.config import BaseConfig
14
+ from mashumaro.types import Alias
15
+
16
+ from pyvesync.models.base_models import (
17
+ ResponseBaseModel,
18
+ ResponseCodeModel,
19
+ )
20
+ from pyvesync.const import IntFlag
21
+
22
+
23
+ @dataclass
24
+ class ResponseHumidifierBase(ResponseCodeModel):
25
+ """Humidifier Base Response Dict."""
26
+ result: OuterHumidifierResult
27
+
28
+
29
+ @dataclass
30
+ class OuterHumidifierResult(ResponseBaseModel):
31
+ """Humidifier Result Dict."""
32
+ code: int
33
+ result: InnerHumidifierBaseResult
34
+
35
+
36
+ @dataclass
37
+ class InnerHumidifierBaseResult(ResponseBaseModel):
38
+ """Base class for inner humidifier results model.
39
+
40
+ All inner results models inherit from this class and are
41
+ correctly subclassed by the mashumaro discriminator.
42
+ """
43
+
44
+ class Config(BaseConfig): # type: ignore[override]
45
+ """Configure the results model to use subclass discriminator."""
46
+ # discriminator = Discriminator(include_subtypes=True)
47
+ allow_deserialization_not_by_alias = True
48
+
49
+
50
+ class BypassV2InnerErrorResult(InnerHumidifierBaseResult):
51
+ """Inner Error Result Model."""
52
+ msg: str
53
+
54
+ # Inner Result models for individual devices inherit from InnerHumidifierBaseResult
55
+ # and are used to parse the response from the API.
56
+ # The correct subclass is determined by the mashumaro discriminator
57
+
58
+
59
+ @dataclass
60
+ class ClassicLVHumidResult(InnerHumidifierBaseResult):
61
+ """Classic 200S Humidifier Result Model.
62
+
63
+ Inherits from InnerHumidifierBaseResult.
64
+ """
65
+ enabled: bool
66
+ mist_virtual_level: int
67
+ mist_level: int
68
+ mode: str
69
+ display: Annotated[bool, Alias("indicator_light_status")]
70
+ water_lacks: bool
71
+ humidity: int | None = None
72
+ humidity_high: bool = False
73
+ automatic_stop_reach_target: bool = False
74
+ water_tank_lifted: bool = False
75
+ warm_enabled: bool = False
76
+ warm_level: int = IntFlag.NOT_SUPPORTED
77
+ night_light_brightness: int = IntFlag.NOT_SUPPORTED
78
+ configuration: ClassicConfig | None = None
79
+
80
+
81
+ @dataclass
82
+ class ClassicConfig(ResponseBaseModel):
83
+ """Classic 200S Humidifier Configuration Model."""
84
+
85
+ auto_target_humidity: int = 0
86
+ display: Annotated[bool, Alias("indicator_light_status")] = False
87
+ automatic_stop: bool = False
88
+
89
+ class Config(BaseConfig): # type: ignore[override]
90
+ """Configure the results model to use subclass discriminator."""
91
+ allow_deserialization_not_by_alias = True
92
+ forbid_extra_keys = False
93
+
94
+
95
+ @dataclass
96
+ class LV600SConfig(ResponseBaseModel):
97
+ """LV 600S Humidifier Configuration Model."""
98
+ auto_target_humidity: int = 0
99
+ display: bool = False
100
+
101
+
102
+ @dataclass
103
+ class LV600SExtension(ResponseBaseModel):
104
+ """LV 600S Humidifier Configuration Model."""
105
+ timer_remain: int = 0
106
+ schedule_count: int = 0
107
+
108
+
109
+ @dataclass
110
+ class LV600SHumidResult(InnerHumidifierBaseResult):
111
+ """LV600S Humidifier Result Model.
112
+
113
+ Inherits from InnerHumidifierBaseResult.
114
+ """
115
+ automatic_stop_reach_target: bool
116
+ display: bool
117
+ enabled: bool
118
+ humidity: int
119
+ humidity_high: bool
120
+ mist_level: int
121
+ mist_virtual_level: int
122
+ mode: str
123
+ water_lacks: bool
124
+ water_tank_lifted: bool
125
+ extension: LV600SExtension | None = None
126
+ configuration: LV600SConfig | None = None
127
+
128
+ # Models for the VeSync Superior 6000S Humidifier
129
+
130
+
131
+ @dataclass
132
+ class Superior6000SResult(InnerHumidifierBaseResult):
133
+ """Superior 6000S Humidifier Result Model.
134
+
135
+ Inherits from InnerHumidifierBaseResult.
136
+ """
137
+ powerSwitch: int
138
+ humidity: int
139
+ targetHumidity: int
140
+ virtualLevel: int
141
+ mistLevel: int
142
+ workMode: str
143
+ waterLacksState: int
144
+ waterTankLifted: int
145
+ autoStopSwitch: int
146
+ autoStopState: int
147
+ screenSwitch: int
148
+ screenState: int
149
+ scheduleCount: int
150
+ timerRemain: int
151
+ errorCode: int
152
+ autoPreference: int
153
+ childLockSwitch: int
154
+ filterLifePercent: int
155
+ temperature: int
156
+ dryingMode: Superior6000SDryingMode | None = None
157
+
158
+
159
+ @dataclass
160
+ class Superior6000SDryingMode(ResponseBaseModel):
161
+ """Drying Mode Model for Superior 6000S Humidifier."""
162
+ dryingLevel: int
163
+ autoDryingSwitch: int
164
+ dryingState: int
165
+ dryingRemain: int
166
+
167
+
168
+ # Models for the Levoit 1000S Humidifier
169
+
170
+ @dataclass
171
+ class Levoit1000SResult(InnerHumidifierBaseResult):
172
+ """Levoit 1000S Humidifier Result Model."""
173
+ powerSwitch: int
174
+ humidity: int
175
+ targetHumidity: int
176
+ virtualLevel: int
177
+ mistLevel: int
178
+ workMode: str
179
+ waterLacksState: int
180
+ waterTankLifted: int
181
+ autoStopSwitch: int
182
+ autoStopState: int
183
+ screenSwitch: int
184
+ screenState: int
185
+ scheduleCount: int
186
+ timerRemain: int
187
+ errorCode: int
@@ -0,0 +1,194 @@
1
+ """Data models for VeSync outlets."""
2
+ from __future__ import annotations
3
+ from dataclasses import dataclass
4
+ from pyvesync.models.bypass_models import (
5
+ RequestBypassV1,
6
+ )
7
+ from pyvesync.models.base_models import (
8
+ ResponseCodeModel,
9
+ ResponseBaseModel,
10
+ RequestBaseModel
11
+ )
12
+
13
+
14
+ @dataclass
15
+ class Response7AOutlet(ResponseBaseModel):
16
+ """Response model for 7A outlet."""
17
+ activeTime: int
18
+ energy: float
19
+ deviceStatus: str
20
+ power: float | str
21
+ voltage: float | str
22
+
23
+
24
+ @dataclass
25
+ class ResponseEnergyHistory(ResponseCodeModel):
26
+ """Response model for energy history."""
27
+ result: ResponseEnergyResult
28
+
29
+
30
+ @dataclass
31
+ class ResponseEnergyResult(ResponseBaseModel):
32
+ """Response model for energy result."""
33
+ energyConsumptionOfToday: float
34
+ costPerKWH: float
35
+ maxEnergy: float
36
+ totalEnergy: float
37
+ energyInfos: list[EnergyInfo]
38
+
39
+
40
+ @dataclass
41
+ class EnergyInfo:
42
+ """Energy Info list items."""
43
+ timestamp: int
44
+ energyKWH: float
45
+ money: float
46
+
47
+
48
+ @dataclass
49
+ class Response10ADetails(ResponseCodeModel):
50
+ """Response model for Etekcity outlet details."""
51
+ deviceStatus: str
52
+ connectionStatus: str
53
+ activeTime: int
54
+ power: float
55
+ voltage: float
56
+ energy: float | None = None
57
+ nightLightStatus: str | None = None
58
+ nightLightAutoMode: str | None = None
59
+ nightLightBrightness: int | None = None
60
+
61
+
62
+ @dataclass
63
+ class ResponseOldEnergy(ResponseCodeModel):
64
+ """Response model for old energy history."""
65
+ energyConsumptionOfToday: float
66
+ costPerKWH: float
67
+ maxEnergy: float
68
+ totalEnergy: float
69
+ data: list[float]
70
+
71
+
72
+ @dataclass
73
+ class Response15ADetails(ResponseCodeModel):
74
+ """Response for 15A Outlets."""
75
+ result: Response15AOutletResult
76
+
77
+
78
+ @dataclass
79
+ class Response15AOutletResult(ResponseBaseModel):
80
+ """Response model for 15A outlet."""
81
+ deviceStatus: str
82
+ connectionStatus: str
83
+ activeTime: int
84
+ power: float
85
+ voltage: float
86
+ energy: float | None = None
87
+ nightLightStatus: str | None = None
88
+ nightLightAutoMode: str | None = None
89
+ nightLightBrightness: int | None = None
90
+
91
+
92
+ @dataclass
93
+ class Request15ADetails(RequestBypassV1):
94
+ """Request data model for 15A outlet Details."""
95
+
96
+
97
+ @dataclass
98
+ class RequestOutdoorStatus(RequestBypassV1):
99
+ """Request model for outlet status."""
100
+ status: str
101
+ switchNo: str
102
+
103
+
104
+ @dataclass
105
+ class RequestEnergyHistory(RequestBaseModel):
106
+ """Request model for energy history."""
107
+ acceptLanguage: str
108
+ appVersion: str
109
+ accountID: str
110
+ method: str
111
+ phoneBrand: str
112
+ phoneOS: str
113
+ timeZone: str
114
+ token: str
115
+ traceId: str
116
+ userCountryCode: str
117
+ debugMode: bool
118
+ homeTimeZone: str
119
+ uuid: str
120
+
121
+
122
+ @dataclass
123
+ class Request15AStatus(RequestBypassV1):
124
+ """Request data model for 15A outlet.
125
+
126
+ Inherits from RequestBypassV1.
127
+ """
128
+ status: str
129
+
130
+
131
+ @dataclass
132
+ class Request15ANightlight(RequestBypassV1):
133
+ """Nightlight request data model for 15A Outlets.
134
+
135
+ Inherits from RequestBypassV1.
136
+ """
137
+ mode: str
138
+
139
+
140
+ @dataclass
141
+ class ResponseOutdoorDetails(ResponseCodeModel):
142
+ """Response model for outdoor outlet."""
143
+ result: ResponseOutdoorOutletResult
144
+
145
+
146
+ @dataclass
147
+ class ResponseOutdoorOutletResult(ResponseBaseModel):
148
+ """Response model for outdoor outlet."""
149
+ deviceStatus: str
150
+ connectionStatus: str
151
+ activeTime: int
152
+ power: float
153
+ voltage: float
154
+ energy: float
155
+ subDevices: list[ResponseOutdoorSubDevices]
156
+
157
+
158
+ @dataclass
159
+ class ResponseOutdoorSubDevices(ResponseBaseModel):
160
+ """Response model for outdoor energy."""
161
+ subDeviceNo: int
162
+ defaultName: str
163
+ subDeviceName: str
164
+ subDeviceStatus: str
165
+
166
+
167
+ @dataclass
168
+ class ResponseBSDGO1Details(ResponseCodeModel):
169
+ """Response model for BSDGO1 outlet."""
170
+ result: ResponseBSDGO1OutletResult
171
+
172
+
173
+ @dataclass
174
+ class ResponseBSDGO1OutletResult(ResponseBaseModel):
175
+ """Response model for BSDGO1 outlet."""
176
+ powerSwitch_1: int
177
+ active_time: int
178
+ connectionStatus: str
179
+ code: int
180
+
181
+
182
+ @dataclass
183
+ class Timer7AItem(ResponseBaseModel):
184
+ """Timer item for 7A outlet."""
185
+ timerID: str
186
+ counterTimer: int
187
+ action: str
188
+ timerStatus: str
189
+
190
+
191
+ @dataclass
192
+ class ResultESW10Details(ResponseBaseModel):
193
+ """Response model for ESW10 outlet."""
194
+ enabled: bool