python-roborock 0.5.2__tar.gz → 0.5.3__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-roborock
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: A package to control Roborock vacuums.
5
5
  Home-page: https://github.com/humbertogontijo/python-roborock
6
6
  License: GPL-3.0-only
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-roborock"
3
- version = "0.5.2"
3
+ version = "0.5.3"
4
4
  description = "A package to control Roborock vacuums."
5
5
  authors = ["humbertogontijo <humbertogontijo@users.noreply.github.com>"]
6
6
  license = "GPL-3.0-only"
@@ -262,7 +262,7 @@ class RoborockClient:
262
262
  async def get_dock_summary(self, device_id: str, dock_type: RoborockDockTypeCode) -> RoborockDockSummary:
263
263
  try:
264
264
  commands = [self.get_dust_collection_mode(device_id)]
265
- if dock_type == RoborockDockTypeCode.EMPTY_WASH_FILL_DOCK:
265
+ if dock_type == RoborockDockTypeCode['3']:
266
266
  commands += [self.get_wash_towel_mode(device_id), self.get_smart_wash_params(device_id)]
267
267
  [
268
268
  dust_collection_mode,
@@ -292,7 +292,7 @@ class RoborockClient:
292
292
  device_id, clean_summary.records[0]
293
293
  )
294
294
  dock_summary = None
295
- if status and status.dock_type != RoborockDockTypeCode.NO_DOCK:
295
+ if status and status.dock_type != RoborockDockTypeCode['0']:
296
296
  dock_summary = await self.get_dock_summary(device_id, status.dock_type)
297
297
  if any([status, dnd_timer, clean_summary, consumable]):
298
298
  return RoborockDeviceProp(
@@ -5,10 +5,29 @@ from enum import Enum
5
5
 
6
6
  class RoborockEnum(str, Enum):
7
7
 
8
+ def __str__(self):
9
+ return str(self.value)
10
+
8
11
  @classmethod
9
12
  def _missing_(cls, code: int):
10
13
  return cls._member_map_.get(str(code))
11
14
 
15
+ @classmethod
16
+ def as_dict(cls):
17
+ return {i.name: i.value for i in cls}
18
+
19
+ @classmethod
20
+ def values(cls):
21
+ return list(cls.as_dict().values())
22
+
23
+ @classmethod
24
+ def keys(cls):
25
+ return list(cls.as_dict().keys())
26
+
27
+ @classmethod
28
+ def items(cls):
29
+ return cls.as_dict().items()
30
+
12
31
 
13
32
  class RoborockCode:
14
33
 
@@ -5,7 +5,8 @@ from typing import Any, Optional
5
5
 
6
6
  from dacite import from_dict, Config
7
7
 
8
- from roborock.code_mappings import RoborockDockWashTowelModeCode, RoborockDockTypeCode
8
+ from roborock.code_mappings import RoborockDockWashTowelModeCode, RoborockDockTypeCode, RoborockMopIntensityCode, \
9
+ RoborockStateCode
9
10
  from .code_mappings import RoborockMopModeCode, RoborockDockErrorCode, \
10
11
  RoborockErrorCode, RoborockDockDustCollectionModeCode, RoborockFanPowerCode
11
12
 
@@ -21,11 +22,7 @@ def decamelize(d):
21
22
 
22
23
 
23
24
  @dataclass
24
- class RoborockBase(dict):
25
- def __init__(self, data: dict[str, any]) -> None:
26
- super().__init__()
27
- if isinstance(data, dict):
28
- self.update(data)
25
+ class RoborockBase:
29
26
 
30
27
  @classmethod
31
28
  def from_dict(cls, data: dict[str, any]):
@@ -164,7 +161,7 @@ class Status(RoborockBase):
164
161
  msg_ver: Optional[int] = None
165
162
  msg_seq: Optional[int] = None
166
163
  status: Optional[str] = None
167
- state: Optional[int] = None
164
+ state: Optional[RoborockStateCode] = None
168
165
  battery: Optional[int] = None
169
166
  clean_time: Optional[int] = None
170
167
  clean_area: Optional[int] = None
@@ -183,7 +180,7 @@ class Status(RoborockBase):
183
180
  map_status: Optional[int] = None
184
181
  is_locating: Optional[int] = None
185
182
  lock_status: Optional[int] = None
186
- water_box_mode: Optional[int] = None
183
+ water_box_mode: Optional[RoborockMopIntensityCode] = None
187
184
  mop_intensity: Optional[str] = None
188
185
  water_box_carriage_status: Optional[int] = None
189
186
  mop_forbidden_enable: Optional[int] = None
@@ -285,12 +282,12 @@ class SmartWashParams(RoborockBase):
285
282
 
286
283
  @dataclass
287
284
  class DustCollectionMode(RoborockBase):
288
- mode: RoborockDockDustCollectionModeCode
285
+ mode: Optional[RoborockDockDustCollectionModeCode] = None
289
286
 
290
287
 
291
288
  @dataclass
292
289
  class WashTowelMode(RoborockBase):
293
- wash_mode: RoborockDockWashTowelModeCode
290
+ wash_mode: Optional[RoborockDockWashTowelModeCode] = None
294
291
 
295
292
 
296
293
  @dataclass
File without changes