python-roborock 3.7.1__tar.gz → 3.7.4__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.
Files changed (94) hide show
  1. {python_roborock-3.7.1 → python_roborock-3.7.4}/PKG-INFO +1 -1
  2. {python_roborock-3.7.1 → python_roborock-3.7.4}/pyproject.toml +2 -2
  3. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/containers.py +3 -0
  4. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/clean_summary.py +2 -3
  5. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/common.py +1 -2
  6. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/device_features.py +5 -7
  7. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/do_not_disturb.py +4 -13
  8. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/home.py +43 -14
  9. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/network_info.py +3 -6
  10. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/valley_electricity_timer.py +3 -10
  11. {python_roborock-3.7.1 → python_roborock-3.7.4}/.gitignore +0 -0
  12. {python_roborock-3.7.1 → python_roborock-3.7.4}/LICENSE +0 -0
  13. {python_roborock-3.7.1 → python_roborock-3.7.4}/README.md +0 -0
  14. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/__init__.py +0 -0
  15. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/api.py +0 -0
  16. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/broadcast_protocol.py +0 -0
  17. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/callbacks.py +0 -0
  18. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/cli.py +0 -0
  19. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/cloud_api.py +0 -0
  20. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/command_cache.py +0 -0
  21. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/const.py +0 -0
  22. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/__init__.py +0 -0
  23. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/b01_q10/__init__.py +0 -0
  24. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/b01_q10/b01_q10_code_mappings.py +0 -0
  25. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/b01_q10/b01_q10_containers.py +0 -0
  26. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/b01_q7/__init__.py +0 -0
  27. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/b01_q7/b01_q7_code_mappings.py +0 -0
  28. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/b01_q7/b01_q7_containers.py +0 -0
  29. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/code_mappings.py +0 -0
  30. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/dyad/__init__.py +0 -0
  31. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/dyad/dyad_code_mappings.py +0 -0
  32. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/dyad/dyad_containers.py +0 -0
  33. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/v1/__init__.py +0 -0
  34. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/v1/v1_clean_modes.py +0 -0
  35. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/v1/v1_code_mappings.py +0 -0
  36. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/v1/v1_containers.py +0 -0
  37. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/zeo/__init__.py +0 -0
  38. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/zeo/zeo_code_mappings.py +0 -0
  39. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/data/zeo/zeo_containers.py +0 -0
  40. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/device_features.py +0 -0
  41. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/README.md +0 -0
  42. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/__init__.py +0 -0
  43. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/a01_channel.py +0 -0
  44. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/b01_channel.py +0 -0
  45. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/cache.py +0 -0
  46. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/channel.py +0 -0
  47. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/device.py +0 -0
  48. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/device_manager.py +0 -0
  49. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/local_channel.py +0 -0
  50. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/mqtt_channel.py +0 -0
  51. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/__init__.py +0 -0
  52. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/a01/__init__.py +0 -0
  53. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/b01/__init__.py +0 -0
  54. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/traits_mixin.py +0 -0
  55. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/__init__.py +0 -0
  56. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/child_lock.py +0 -0
  57. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/command.py +0 -0
  58. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/consumeable.py +0 -0
  59. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/dust_collection_mode.py +0 -0
  60. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/flow_led_status.py +0 -0
  61. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/led_status.py +0 -0
  62. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/map_content.py +0 -0
  63. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/maps.py +0 -0
  64. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/rooms.py +0 -0
  65. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/routines.py +0 -0
  66. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/smart_wash_params.py +0 -0
  67. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/status.py +0 -0
  68. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/volume.py +0 -0
  69. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/traits/v1/wash_towel_mode.py +0 -0
  70. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/v1_channel.py +0 -0
  71. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/devices/v1_rpc_channel.py +0 -0
  72. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/exceptions.py +0 -0
  73. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/map/__init__.py +0 -0
  74. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/map/map_parser.py +0 -0
  75. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/mqtt/__init__.py +0 -0
  76. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/mqtt/roborock_session.py +0 -0
  77. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/mqtt/session.py +0 -0
  78. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/protocol.py +0 -0
  79. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/protocols/a01_protocol.py +0 -0
  80. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/protocols/b01_protocol.py +0 -0
  81. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/protocols/v1_protocol.py +0 -0
  82. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/py.typed +0 -0
  83. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/roborock_future.py +0 -0
  84. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/roborock_message.py +0 -0
  85. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/roborock_typing.py +0 -0
  86. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/util.py +0 -0
  87. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/version_1_apis/__init__.py +0 -0
  88. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/version_1_apis/roborock_client_v1.py +0 -0
  89. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/version_1_apis/roborock_local_client_v1.py +0 -0
  90. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/version_1_apis/roborock_mqtt_client_v1.py +0 -0
  91. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/version_a01_apis/__init__.py +0 -0
  92. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/version_a01_apis/roborock_client_a01.py +0 -0
  93. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/version_a01_apis/roborock_mqtt_client_a01.py +0 -0
  94. {python_roborock-3.7.1 → python_roborock-3.7.4}/roborock/web_api.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-roborock
3
- Version: 3.7.1
3
+ Version: 3.7.4
4
4
  Summary: A package to control Roborock vacuums.
5
5
  Project-URL: Repository, https://github.com/humbertogontijo/python-roborock
6
6
  Project-URL: Documentation, https://python-roborock.readthedocs.io/
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-roborock"
3
- version = "3.7.1"
3
+ version = "3.7.4"
4
4
  description = "A package to control Roborock vacuums."
5
5
  authors = [{ name = "humbertogontijo", email = "humbertogontijo@users.noreply.github.com" }, {name="Lash-L"}, {name="allenporter"}]
6
6
  requires-python = ">=3.11, <4"
@@ -44,7 +44,7 @@ dev = [
44
44
  "pytest",
45
45
  "pre-commit>=3.5,<5.0",
46
46
  "mypy",
47
- "ruff==0.14.1",
47
+ "ruff==0.14.4",
48
48
  "codespell",
49
49
  "pyshark>=0.6,<0.7",
50
50
  "aioresponses>=0.7.7,<0.8",
@@ -140,6 +140,9 @@ class RoborockBaseTimer(RoborockBase):
140
140
  else None
141
141
  )
142
142
 
143
+ def as_list(self) -> list:
144
+ return [self.start_hour, self.start_minute, self.end_hour, self.end_minute]
145
+
143
146
  def __repr__(self) -> str:
144
147
  return _attr_repr(self)
145
148
 
@@ -14,7 +14,7 @@ class CleanSummaryTrait(CleanSummaryWithDetail, common.V1TraitMixin):
14
14
 
15
15
  command = RoborockCommand.GET_CLEAN_SUMMARY
16
16
 
17
- async def refresh(self) -> Self:
17
+ async def refresh(self) -> None:
18
18
  """Refresh the clean summary data and last clean record.
19
19
 
20
20
  Assumes that the clean summary has already been fetched.
@@ -23,10 +23,9 @@ class CleanSummaryTrait(CleanSummaryWithDetail, common.V1TraitMixin):
23
23
  if not self.records:
24
24
  _LOGGER.debug("No clean records available in clean summary.")
25
25
  self.last_clean_record = None
26
- return self
26
+ return
27
27
  last_record_id = self.records[-1]
28
28
  self.last_clean_record = await self.get_clean_record(last_record_id)
29
- return self
30
29
 
31
30
  @classmethod
32
31
  def _parse_type_response(cls, response: common.V1ResponseData) -> Self:
@@ -76,7 +76,7 @@ class V1TraitMixin(ABC):
76
76
  raise ValueError("Device trait in invalid state")
77
77
  return self._rpc_channel
78
78
 
79
- async def refresh(self) -> Self:
79
+ async def refresh(self) -> None:
80
80
  """Refresh the contents of this trait."""
81
81
  response = await self.rpc_channel.send_command(self.command)
82
82
  new_data = self._parse_response(response)
@@ -84,7 +84,6 @@ class V1TraitMixin(ABC):
84
84
  raise ValueError(f"Internal error, unexpected response type: {new_data!r}")
85
85
  _LOGGER.debug("Refreshed %s: %s", self.__class__.__name__, new_data)
86
86
  self._update_trait_values(new_data)
87
- return self
88
87
 
89
88
  def _update_trait_values(self, new_data: RoborockBase) -> None:
90
89
  """Update the values of this trait from another instance."""
@@ -1,5 +1,4 @@
1
1
  from dataclasses import fields
2
- from typing import Self
3
2
 
4
3
  from roborock.data import AppInitStatus, RoborockProductNickname
5
4
  from roborock.device_features import DeviceFeatures
@@ -13,7 +12,7 @@ class DeviceFeaturesTrait(DeviceFeatures, common.V1TraitMixin):
13
12
 
14
13
  command = RoborockCommand.APP_GET_INIT_STATUS
15
14
 
16
- def __init__(self, product_nickname: RoborockProductNickname, cache: Cache) -> None:
15
+ def __init__(self, product_nickname: RoborockProductNickname, cache: Cache) -> None: # pylint: disable=super-init-not-called
17
16
  """Initialize MapContentTrait."""
18
17
  self._nickname = product_nickname
19
18
  self._cache = cache
@@ -22,7 +21,7 @@ class DeviceFeaturesTrait(DeviceFeatures, common.V1TraitMixin):
22
21
  for field in fields(self):
23
22
  setattr(self, field.name, False)
24
23
 
25
- async def refresh(self) -> Self:
24
+ async def refresh(self) -> None:
26
25
  """Refresh the contents of this trait.
27
26
 
28
27
  This will use cached device features if available since they do not
@@ -32,12 +31,11 @@ class DeviceFeaturesTrait(DeviceFeatures, common.V1TraitMixin):
32
31
  cache_data = await self._cache.get()
33
32
  if cache_data.device_features is not None:
34
33
  self._update_trait_values(cache_data.device_features)
35
- return self
34
+ return
36
35
  # Save cached device features
37
- device_features = await super().refresh()
38
- cache_data.device_features = device_features
36
+ await super().refresh()
37
+ cache_data.device_features = self
39
38
  await self._cache.set(cache_data)
40
- return device_features
41
39
 
42
40
  def _parse_response(self, response: common.V1ResponseData) -> DeviceFeatures:
43
41
  """Parse the response from the device into a MapContentTrait instance."""
@@ -17,7 +17,7 @@ class DoNotDisturbTrait(DnDTimer, common.V1TraitMixin, common.RoborockSwitchBase
17
17
 
18
18
  async def set_dnd_timer(self, dnd_timer: DnDTimer) -> None:
19
19
  """Set the Do Not Disturb (DND) timer settings of the device."""
20
- await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_dict())
20
+ await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list())
21
21
 
22
22
  async def clear_dnd_timer(self) -> None:
23
23
  """Clear the Do Not Disturb (DND) timer settings of the device."""
@@ -27,18 +27,9 @@ class DoNotDisturbTrait(DnDTimer, common.V1TraitMixin, common.RoborockSwitchBase
27
27
  """Set the Do Not Disturb (DND) timer settings of the device."""
28
28
  await self.rpc_channel.send_command(
29
29
  RoborockCommand.SET_DND_TIMER,
30
- params={
31
- **self.as_dict(),
32
- _ENABLED_PARAM: 1,
33
- },
30
+ params=self.as_list(),
34
31
  )
35
32
 
36
33
  async def disable(self) -> None:
37
- """Set the Do Not Disturb (DND) timer settings of the device."""
38
- await self.rpc_channel.send_command(
39
- RoborockCommand.SET_DND_TIMER,
40
- params={
41
- **self.as_dict(),
42
- _ENABLED_PARAM: 0,
43
- },
44
- )
34
+ """Disable the Do Not Disturb (DND) timer settings of the device."""
35
+ await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER)
@@ -7,6 +7,12 @@ on the map. It also makes it straight forward to fetch the map image and data.
7
7
  This trait depends on the MapsTrait and RoomsTrait to gather the necessary
8
8
  information. It provides properties to access the current map, the list of
9
9
  rooms with names, and the map image and data.
10
+
11
+ Callers may first call `discover_home()` to populate the home layout cache by
12
+ iterating through all available maps on the device. This will cache the map
13
+ information and room names for all maps to minimize map switching and improve
14
+ performance. After the initial discovery, callers can call `refresh()` to update
15
+ the current map's information and room names as needed.
10
16
  """
11
17
 
12
18
  import asyncio
@@ -64,6 +70,7 @@ class HomeTrait(RoborockBase, common.V1TraitMixin):
64
70
  self._map_content = map_content
65
71
  self._rooms_trait = rooms_trait
66
72
  self._cache = cache
73
+ self._discovery_completed = False
67
74
  self._home_map_info: dict[int, CombinedMapInfo] | None = None
68
75
  self._home_map_content: dict[int, MapContent] | None = None
69
76
 
@@ -82,6 +89,7 @@ class HomeTrait(RoborockBase, common.V1TraitMixin):
82
89
  if cache_data.home_map_info and cache_data.home_map_content:
83
90
  _LOGGER.debug("Home cache already populated, skipping discovery")
84
91
  self._home_map_info = cache_data.home_map_info
92
+ self._discovery_completed = True
85
93
  try:
86
94
  self._home_map_content = {
87
95
  k: self._map_content.parse_map_content(v) for k, v in cache_data.home_map_content.items()
@@ -101,6 +109,7 @@ class HomeTrait(RoborockBase, common.V1TraitMixin):
101
109
 
102
110
  home_map_info, home_map_content = await self._build_home_map_info()
103
111
  _LOGGER.debug("Home discovery complete, caching data for %d maps", len(home_map_info))
112
+ self._discovery_completed = True
104
113
  await self._update_home_cache(home_map_info, home_map_content)
105
114
 
106
115
  async def _refresh_map_info(self, map_info) -> CombinedMapInfo:
@@ -149,15 +158,22 @@ class HomeTrait(RoborockBase, common.V1TraitMixin):
149
158
  home_map_info[map_info.map_flag] = combined_map_info
150
159
  return home_map_info, home_map_content
151
160
 
152
- async def refresh(self) -> Self:
161
+ async def refresh(self) -> None:
153
162
  """Refresh current map's underlying map and room data, updating cache as needed.
154
163
 
155
164
  This will only refresh the current map's data and will not populate non
156
165
  active maps or re-discover the home. It is expected that this will keep
157
166
  information up to date for the current map as users switch to that map.
158
167
  """
159
- if self._home_map_info is None:
160
- raise RoborockException("Cannot refresh home data without home cache, did you call discover_home()?")
168
+ if not self._discovery_completed:
169
+ # Running initial discovery also populates all of the same information
170
+ # as below so we can just call that method. If the device is busy
171
+ # then we'll fall through below to refresh the current map only.
172
+ try:
173
+ await self.discover_home()
174
+ return
175
+ except RoborockDeviceBusy:
176
+ _LOGGER.debug("Cannot refresh home data while device is busy cleaning")
161
177
 
162
178
  # Refresh the list of map names/info
163
179
  await self._maps_trait.refresh()
@@ -170,8 +186,9 @@ class HomeTrait(RoborockBase, common.V1TraitMixin):
170
186
  new_map_content = await self._refresh_map_content()
171
187
  # Refresh the current map's room data
172
188
  combined_map_info = await self._refresh_map_info(current_map_info)
173
- await self._update_current_map_cache(map_flag, combined_map_info, new_map_content)
174
- return self
189
+ await self._update_current_map(
190
+ map_flag, combined_map_info, new_map_content, update_cache=self._discovery_completed
191
+ )
175
192
 
176
193
  @property
177
194
  def home_map_info(self) -> dict[int, CombinedMapInfo] | None:
@@ -206,16 +223,28 @@ class HomeTrait(RoborockBase, common.V1TraitMixin):
206
223
  self._home_map_info = home_map_info
207
224
  self._home_map_content = home_map_content
208
225
 
209
- async def _update_current_map_cache(
210
- self, map_flag: int, map_info: CombinedMapInfo, map_content: MapContent
226
+ async def _update_current_map(
227
+ self,
228
+ map_flag: int,
229
+ map_info: CombinedMapInfo,
230
+ map_content: MapContent,
231
+ update_cache: bool,
211
232
  ) -> None:
212
233
  """Update the cache for the current map only."""
213
- cache_data = await self._cache.get()
214
- cache_data.home_map_info[map_flag] = map_info
215
- if map_content.raw_api_response:
216
- cache_data.home_map_content[map_flag] = map_content.raw_api_response
217
- await self._cache.set(cache_data)
218
- if self._home_map_info is None or self._home_map_content is None:
219
- raise RoborockException("Home cache is not initialized, cannot update current map cache")
234
+ # Update the persistent cache if requested e.g. home discovery has
235
+ # completed and we want to keep it fresh. Otherwise just update the
236
+ # in memory map below.
237
+ if update_cache:
238
+ cache_data = await self._cache.get()
239
+ cache_data.home_map_info[map_flag] = map_info
240
+ if map_content.raw_api_response:
241
+ cache_data.home_map_content[map_flag] = map_content.raw_api_response
242
+ await self._cache.set(cache_data)
243
+
244
+ if self._home_map_info is None:
245
+ self._home_map_info = {}
220
246
  self._home_map_info[map_flag] = map_info
247
+
248
+ if self._home_map_content is None:
249
+ self._home_map_content = {}
221
250
  self._home_map_content[map_flag] = map_content
@@ -3,7 +3,6 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
- from typing import Self
7
6
 
8
7
  from roborock.data import NetworkInfo
9
8
  from roborock.devices.cache import Cache
@@ -25,20 +24,20 @@ class NetworkInfoTrait(NetworkInfo, common.V1TraitMixin):
25
24
 
26
25
  command = RoborockCommand.GET_NETWORK_INFO
27
26
 
28
- def __init__(self, device_uid: str, cache: Cache) -> None:
27
+ def __init__(self, device_uid: str, cache: Cache) -> None: # pylint: disable=super-init-not-called
29
28
  """Initialize the trait."""
30
29
  self._device_uid = device_uid
31
30
  self._cache = cache
32
31
  self.ip = ""
33
32
 
34
- async def refresh(self) -> Self:
33
+ async def refresh(self) -> None:
35
34
  """Refresh the network info from the cache."""
36
35
 
37
36
  cache_data = await self._cache.get()
38
37
  if cache_data.network_info and (network_info := cache_data.network_info.get(self._device_uid)):
39
38
  _LOGGER.debug("Using cached network info for device %s", self._device_uid)
40
39
  self._update_trait_values(network_info)
41
- return self
40
+ return
42
41
 
43
42
  # Load from device if not in cache
44
43
  _LOGGER.debug("No cached network info for device %s, fetching from device", self._device_uid)
@@ -48,8 +47,6 @@ class NetworkInfoTrait(NetworkInfo, common.V1TraitMixin):
48
47
  cache_data.network_info[self._device_uid] = self
49
48
  await self._cache.set(cache_data)
50
49
 
51
- return self
52
-
53
50
  def _parse_response(self, response: common.V1ResponseData) -> NetworkInfo:
54
51
  """Parse the response from the device into a NetworkInfo."""
55
52
  if not isinstance(response, dict):
@@ -18,7 +18,7 @@ class ValleyElectricityTimerTrait(ValleyElectricityTimer, common.V1TraitMixin, c
18
18
 
19
19
  async def set_timer(self, timer: ValleyElectricityTimer) -> None:
20
20
  """Set the Valley Electricity Timer settings of the device."""
21
- await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_dict())
21
+ await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_list())
22
22
 
23
23
  async def clear_timer(self) -> None:
24
24
  """Clear the Valley Electricity Timer settings of the device."""
@@ -28,18 +28,11 @@ class ValleyElectricityTimerTrait(ValleyElectricityTimer, common.V1TraitMixin, c
28
28
  """Enable the Valley Electricity Timer settings of the device."""
29
29
  await self.rpc_channel.send_command(
30
30
  RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER,
31
- params={
32
- **self.as_dict(),
33
- _ENABLED_PARAM: 1,
34
- },
31
+ params=self.as_list(),
35
32
  )
36
33
 
37
34
  async def disable(self) -> None:
38
35
  """Disable the Valley Electricity Timer settings of the device."""
39
36
  await self.rpc_channel.send_command(
40
- RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER,
41
- params={
42
- **self.as_dict(),
43
- _ENABLED_PARAM: 0,
44
- },
37
+ RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER,
45
38
  )
File without changes