python-roborock 3.8.0__tar.gz → 3.8.2__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 (96) hide show
  1. {python_roborock-3.8.0 → python_roborock-3.8.2}/PKG-INFO +1 -1
  2. {python_roborock-3.8.0 → python_roborock-3.8.2}/pyproject.toml +2 -2
  3. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/device.py +8 -1
  4. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/local_channel.py +20 -2
  5. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/child_lock.py +4 -0
  6. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/command.py +7 -1
  7. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/common.py +8 -2
  8. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/consumeable.py +1 -0
  9. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/do_not_disturb.py +6 -0
  10. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/flow_led_status.py +4 -0
  11. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/led_status.py +4 -0
  12. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/valley_electricity_timer.py +6 -0
  13. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/volume.py +1 -0
  14. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/v1_rpc_channel.py +1 -1
  15. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/protocols/v1_protocol.py +5 -2
  16. {python_roborock-3.8.0 → python_roborock-3.8.2}/.gitignore +0 -0
  17. {python_roborock-3.8.0 → python_roborock-3.8.2}/LICENSE +0 -0
  18. {python_roborock-3.8.0 → python_roborock-3.8.2}/README.md +0 -0
  19. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/__init__.py +0 -0
  20. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/api.py +0 -0
  21. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/broadcast_protocol.py +0 -0
  22. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/callbacks.py +0 -0
  23. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/cli.py +0 -0
  24. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/cloud_api.py +0 -0
  25. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/command_cache.py +0 -0
  26. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/const.py +0 -0
  27. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/__init__.py +0 -0
  28. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/b01_q10/__init__.py +0 -0
  29. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/b01_q10/b01_q10_code_mappings.py +0 -0
  30. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/b01_q10/b01_q10_containers.py +0 -0
  31. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/b01_q7/__init__.py +0 -0
  32. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/b01_q7/b01_q7_code_mappings.py +0 -0
  33. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/b01_q7/b01_q7_containers.py +0 -0
  34. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/code_mappings.py +0 -0
  35. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/containers.py +0 -0
  36. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/dyad/__init__.py +0 -0
  37. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/dyad/dyad_code_mappings.py +0 -0
  38. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/dyad/dyad_containers.py +0 -0
  39. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/v1/__init__.py +0 -0
  40. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/v1/v1_clean_modes.py +0 -0
  41. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/v1/v1_code_mappings.py +0 -0
  42. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/v1/v1_containers.py +0 -0
  43. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/zeo/__init__.py +0 -0
  44. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/zeo/zeo_code_mappings.py +0 -0
  45. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/data/zeo/zeo_containers.py +0 -0
  46. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/device_features.py +0 -0
  47. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/README.md +0 -0
  48. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/__init__.py +0 -0
  49. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/a01_channel.py +0 -0
  50. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/b01_channel.py +0 -0
  51. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/cache.py +0 -0
  52. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/channel.py +0 -0
  53. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/device_manager.py +0 -0
  54. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/file_cache.py +0 -0
  55. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/mqtt_channel.py +0 -0
  56. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/__init__.py +0 -0
  57. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/a01/__init__.py +0 -0
  58. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/b01/__init__.py +0 -0
  59. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/traits_mixin.py +0 -0
  60. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/__init__.py +0 -0
  61. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/clean_summary.py +0 -0
  62. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/device_features.py +0 -0
  63. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/dust_collection_mode.py +0 -0
  64. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/home.py +0 -0
  65. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/map_content.py +0 -0
  66. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/maps.py +0 -0
  67. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/network_info.py +0 -0
  68. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/rooms.py +0 -0
  69. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/routines.py +0 -0
  70. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/smart_wash_params.py +0 -0
  71. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/status.py +0 -0
  72. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/traits/v1/wash_towel_mode.py +0 -0
  73. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/devices/v1_channel.py +0 -0
  74. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/exceptions.py +0 -0
  75. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/map/__init__.py +0 -0
  76. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/map/map_parser.py +0 -0
  77. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/mqtt/__init__.py +0 -0
  78. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/mqtt/roborock_session.py +0 -0
  79. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/mqtt/session.py +0 -0
  80. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/protocol.py +0 -0
  81. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/protocols/__init__.py +0 -0
  82. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/protocols/a01_protocol.py +0 -0
  83. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/protocols/b01_protocol.py +0 -0
  84. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/py.typed +0 -0
  85. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/roborock_future.py +0 -0
  86. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/roborock_message.py +0 -0
  87. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/roborock_typing.py +0 -0
  88. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/util.py +0 -0
  89. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/version_1_apis/__init__.py +0 -0
  90. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/version_1_apis/roborock_client_v1.py +0 -0
  91. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/version_1_apis/roborock_local_client_v1.py +0 -0
  92. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/version_1_apis/roborock_mqtt_client_v1.py +0 -0
  93. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/version_a01_apis/__init__.py +0 -0
  94. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/version_a01_apis/roborock_client_a01.py +0 -0
  95. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/version_a01_apis/roborock_mqtt_client_a01.py +0 -0
  96. {python_roborock-3.8.0 → python_roborock-3.8.2}/roborock/web_api.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-roborock
3
- Version: 3.8.0
3
+ Version: 3.8.2
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.8.0"
3
+ version = "3.8.2"
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.4",
47
+ "ruff==0.14.6",
48
48
  "codespell",
49
49
  "pyshark>=0.6,<0.7",
50
50
  "aioresponses>=0.7.7,<0.8",
@@ -143,8 +143,15 @@ class RoborockDevice(ABC, TraitsMixin):
143
143
  """Connect to the device using the appropriate protocol channel."""
144
144
  if self._unsub:
145
145
  raise ValueError("Already connected to the device")
146
- self._unsub = await self._channel.subscribe(self._on_message)
146
+ unsub = await self._channel.subscribe(self._on_message)
147
147
  _LOGGER.info("Connected to V1 device %s", self.name)
148
+ if self.v1_properties is not None:
149
+ try:
150
+ await self.v1_properties.discover_features()
151
+ except RoborockException:
152
+ unsub()
153
+ raise
154
+ self._unsub = unsub
148
155
 
149
156
  async def close(self) -> None:
150
157
  """Close all connections to the device."""
@@ -62,7 +62,14 @@ class LocalChannel(Channel):
62
62
  LocalChannelParams(local_key=local_key, connect_nonce=get_next_int(10000, 32767), ack_nonce=None)
63
63
  )
64
64
 
65
- def _update_encoder_decoder(self, params: LocalChannelParams):
65
+ def _update_encoder_decoder(self, params: LocalChannelParams) -> None:
66
+ """Update the encoder and decoder with new parameters.
67
+
68
+ This is invoked once with an initial set of values used for protocol
69
+ negotiation. Once negotiation completes, it is updated again to set the
70
+ correct nonces for the follow up communications and updates the encoder
71
+ and decoder functions accordingly.
72
+ """
66
73
  self._params = params
67
74
  self._encoder = create_local_encoder(
68
75
  local_key=params.local_key, connect_nonce=params.connect_nonce, ack_nonce=params.ack_nonce
@@ -71,7 +78,7 @@ class LocalChannel(Channel):
71
78
  local_key=params.local_key, connect_nonce=params.connect_nonce, ack_nonce=params.ack_nonce
72
79
  )
73
80
  # Callback to decode messages and dispatch to subscribers
74
- self._data_received: Callable[[bytes], None] = decoder_callback(self._decoder, self._subscribers, _LOGGER)
81
+ self._dispatch = decoder_callback(self._decoder, self._subscribers, _LOGGER)
75
82
 
76
83
  async def _do_hello(self, local_protocol_version: LocalProtocolVersion) -> LocalChannelParams | None:
77
84
  """Perform the initial handshaking and return encoder params if successful."""
@@ -125,6 +132,13 @@ class LocalChannel(Channel):
125
132
 
126
133
  raise RoborockException("Failed to connect to device with any known protocol")
127
134
 
135
+ @property
136
+ def protocol_version(self) -> LocalProtocolVersion:
137
+ """Return the negotiated local protocol version, or a sensible default."""
138
+ if self._local_protocol_version is not None:
139
+ return self._local_protocol_version
140
+ return LocalProtocolVersion.V1
141
+
128
142
  @property
129
143
  def is_connected(self) -> bool:
130
144
  """Check if the channel is currently connected."""
@@ -157,6 +171,10 @@ class LocalChannel(Channel):
157
171
  self.close()
158
172
  raise
159
173
 
174
+ def _data_received(self, data: bytes) -> None:
175
+ """Invoked when data is received on the stream."""
176
+ self._dispatch(data)
177
+
160
178
  def close(self) -> None:
161
179
  """Disconnect from the device."""
162
180
  if self._transport:
@@ -19,7 +19,11 @@ class ChildLockTrait(ChildLockStatus, common.V1TraitMixin, common.RoborockSwitch
19
19
  async def enable(self) -> None:
20
20
  """Enable the child lock."""
21
21
  await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 1})
22
+ # Optimistic update to avoid an extra refresh
23
+ self.lock_status = 1
22
24
 
23
25
  async def disable(self) -> None:
24
26
  """Disable the child lock."""
25
27
  await self.rpc_channel.send_command(RoborockCommand.SET_CHILD_LOCK_STATUS, params={_STATUS_PARAM: 0})
28
+ # Optimistic update to avoid an extra refresh
29
+ self.lock_status = 0
@@ -16,7 +16,13 @@ class CommandTrait:
16
16
  self._rpc_channel = None
17
17
 
18
18
  async def send(self, command: RoborockCommand | str, params: ParamsType = None) -> Any:
19
- """Send a command to the device."""
19
+ """Send a command to the device.
20
+
21
+ Sending a raw command to the device using this method does not update
22
+ the internal state of any other traits. It is the responsibility of the
23
+ caller to ensure that any traits affected by the command are refreshed
24
+ as needed.
25
+ """
20
26
  if not self._rpc_channel:
21
27
  raise ValueError("Device trait in invalid state")
22
28
  return await self._rpc_channel.send_command(command, params=params)
@@ -28,8 +28,14 @@ class V1TraitMixin(ABC):
28
28
  Each trait subclass must define a class variable `command` that specifies
29
29
  the RoborockCommand used to fetch the trait data from the device. The
30
30
  `refresh()` method can be called to update the contents of the trait data
31
- from the device. A trait can also support additional commands for updating
32
- state associated with the trait.
31
+ from the device.
32
+
33
+ A trait can also support additional commands for updating state associated
34
+ with the trait. It is expected that a trait will update its own internal
35
+ state either reflecting the change optimistically or by refreshing the
36
+ trait state from the device. In cases where one trait caches data that is
37
+ also represented in another trait, it is the responsibility of the caller
38
+ to ensure that both traits are refreshed as needed to keep them in sync.
33
39
 
34
40
  The traits typically subclass RoborockBase to provide serialization
35
41
  and deserialization functionality, but this is not strictly required.
@@ -45,3 +45,4 @@ class ConsumableTrait(Consumable, common.V1TraitMixin):
45
45
  async def reset_consumable(self, consumable: ConsumableAttribute) -> None:
46
46
  """Reset a specific consumable attribute on the device."""
47
47
  await self.rpc_channel.send_command(RoborockCommand.RESET_CONSUMABLE, params=[consumable.value])
48
+ await self.refresh()
@@ -18,10 +18,12 @@ class DoNotDisturbTrait(DnDTimer, common.V1TraitMixin, common.RoborockSwitchBase
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
20
  await self.rpc_channel.send_command(RoborockCommand.SET_DND_TIMER, params=dnd_timer.as_list())
21
+ await self.refresh()
21
22
 
22
23
  async def clear_dnd_timer(self) -> None:
23
24
  """Clear the Do Not Disturb (DND) timer settings of the device."""
24
25
  await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER)
26
+ await self.refresh()
25
27
 
26
28
  async def enable(self) -> None:
27
29
  """Set the Do Not Disturb (DND) timer settings of the device."""
@@ -29,7 +31,11 @@ class DoNotDisturbTrait(DnDTimer, common.V1TraitMixin, common.RoborockSwitchBase
29
31
  RoborockCommand.SET_DND_TIMER,
30
32
  params=self.as_list(),
31
33
  )
34
+ # Optimistic update to avoid an extra refresh
35
+ self.enabled = 1
32
36
 
33
37
  async def disable(self) -> None:
34
38
  """Disable the Do Not Disturb (DND) timer settings of the device."""
35
39
  await self.rpc_channel.send_command(RoborockCommand.CLOSE_DND_TIMER)
40
+ # Optimistic update to avoid an extra refresh
41
+ self.enabled = 0
@@ -19,7 +19,11 @@ class FlowLedStatusTrait(FlowLedStatus, common.V1TraitMixin, common.RoborockSwit
19
19
  async def enable(self) -> None:
20
20
  """Enable the Flow LED status."""
21
21
  await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 1})
22
+ # Optimistic update to avoid an extra refresh
23
+ self.status = 1
22
24
 
23
25
  async def disable(self) -> None:
24
26
  """Disable the Flow LED status."""
25
27
  await self.rpc_channel.send_command(RoborockCommand.SET_FLOW_LED_STATUS, params={_STATUS_PARAM: 0})
28
+ # Optimistic update to avoid an extra refresh
29
+ self.status = 0
@@ -19,10 +19,14 @@ class LedStatusTrait(LedStatus, common.V1TraitMixin, common.RoborockSwitchBase):
19
19
  async def enable(self) -> None:
20
20
  """Enable the LED status."""
21
21
  await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[1])
22
+ # Optimistic update to avoid an extra refresh
23
+ self.status = 1
22
24
 
23
25
  async def disable(self) -> None:
24
26
  """Disable the LED status."""
25
27
  await self.rpc_channel.send_command(RoborockCommand.SET_LED_STATUS, params=[0])
28
+ # Optimistic update to avoid an extra refresh
29
+ self.status = 0
26
30
 
27
31
  @classmethod
28
32
  def _parse_type_response(cls, response: V1ResponseData) -> LedStatus:
@@ -19,10 +19,12 @@ class ValleyElectricityTimerTrait(ValleyElectricityTimer, common.V1TraitMixin, c
19
19
  async def set_timer(self, timer: ValleyElectricityTimer) -> None:
20
20
  """Set the Valley Electricity Timer settings of the device."""
21
21
  await self.rpc_channel.send_command(RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER, params=timer.as_list())
22
+ await self.refresh()
22
23
 
23
24
  async def clear_timer(self) -> None:
24
25
  """Clear the Valley Electricity Timer settings of the device."""
25
26
  await self.rpc_channel.send_command(RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER)
27
+ await self.refresh()
26
28
 
27
29
  async def enable(self) -> None:
28
30
  """Enable the Valley Electricity Timer settings of the device."""
@@ -30,9 +32,13 @@ class ValleyElectricityTimerTrait(ValleyElectricityTimer, common.V1TraitMixin, c
30
32
  RoborockCommand.SET_VALLEY_ELECTRICITY_TIMER,
31
33
  params=self.as_list(),
32
34
  )
35
+ # Optimistic update to avoid an extra refresh
36
+ self.enabled = 1
33
37
 
34
38
  async def disable(self) -> None:
35
39
  """Disable the Valley Electricity Timer settings of the device."""
36
40
  await self.rpc_channel.send_command(
37
41
  RoborockCommand.CLOSE_VALLEY_ELECTRICITY_TIMER,
38
42
  )
43
+ # Optimistic update to avoid an extra refresh
44
+ self.enabled = 0
@@ -24,3 +24,4 @@ class SoundVolumeTrait(SoundVolume, common.V1TraitMixin):
24
24
  async def set_volume(self, volume: int) -> None:
25
25
  """Set the sound volume of the device."""
26
26
  await self.rpc_channel.send_command(RoborockCommand.CHANGE_SOUND_VOLUME, params=[volume])
27
+ self.volume = volume
@@ -188,7 +188,7 @@ def create_local_rpc_channel(local_channel: LocalChannel) -> V1RpcChannel:
188
188
  return PayloadEncodedV1RpcChannel(
189
189
  "local",
190
190
  local_channel,
191
- lambda x: x.encode_message(RoborockMessageProtocol.GENERAL_REQUEST),
191
+ lambda x: x.encode_message(RoborockMessageProtocol.GENERAL_REQUEST, version=local_channel.protocol_version),
192
192
  decode_rpc_response,
193
193
  )
194
194
 
@@ -73,14 +73,17 @@ class RequestMessage:
73
73
  request_id: int = field(default_factory=lambda: get_next_int(10000, 32767))
74
74
 
75
75
  def encode_message(
76
- self, protocol: RoborockMessageProtocol, security_data: SecurityData | None = None, version: str = "1.0"
76
+ self,
77
+ protocol: RoborockMessageProtocol,
78
+ security_data: SecurityData | None = None,
79
+ version: LocalProtocolVersion = LocalProtocolVersion.V1,
77
80
  ) -> RoborockMessage:
78
81
  """Convert the request message to a RoborockMessage."""
79
82
  return RoborockMessage(
80
83
  timestamp=self.timestamp,
81
84
  protocol=protocol,
82
85
  payload=self._as_payload(security_data=security_data),
83
- version=version.encode(),
86
+ version=version.value.encode(),
84
87
  )
85
88
 
86
89
  def _as_payload(self, security_data: SecurityData | None) -> bytes:
File without changes