pymammotion 0.4.30__py3-none-any.whl → 0.4.32__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.
@@ -9,6 +9,7 @@ from pymammotion.data.model import HashList, RapidState
9
9
  from pymammotion.data.model.device_info import DeviceFirmwares, MowerInfo
10
10
  from pymammotion.data.model.location import Location
11
11
  from pymammotion.data.model.report_info import ReportData
12
+ from pymammotion.data.model.work import CurrentTaskSettings
12
13
  from pymammotion.data.mqtt.properties import ThingPropertiesMessage
13
14
  from pymammotion.data.mqtt.status import ThingStatusMessage
14
15
  from pymammotion.http.model.http import ErrorInfo
@@ -29,6 +30,7 @@ class MowingDevice(DataClassORJSONMixin):
29
30
  mqtt_properties: ThingPropertiesMessage | None = None
30
31
  status_properties: ThingStatusMessage | None = None
31
32
  map: HashList = field(default_factory=HashList)
33
+ work: CurrentTaskSettings = field(default_factory=CurrentTaskSettings)
32
34
  location: Location = field(default_factory=Location)
33
35
  mowing_state: RapidState = field(default_factory=RapidState)
34
36
  report_data: ReportData = field(default_factory=ReportData)
@@ -10,6 +10,7 @@ import betterproto
10
10
  from pymammotion.data.model.device import MowingDevice
11
11
  from pymammotion.data.model.device_info import SideLight
12
12
  from pymammotion.data.model.hash_list import AreaHashNameList, NavGetCommData, NavGetHashListData, Plan, SvgMessage
13
+ from pymammotion.data.model.work import CurrentTaskSettings
13
14
  from pymammotion.data.mqtt.properties import ThingPropertiesMessage
14
15
  from pymammotion.data.mqtt.status import ThingStatusMessage
15
16
  from pymammotion.proto import (
@@ -22,6 +23,7 @@ from pymammotion.proto import (
22
23
  NavGetCommDataAck,
23
24
  NavGetHashListAck,
24
25
  NavPlanJobSet,
26
+ NavReqCoverPath,
25
27
  SvgMessageAckT,
26
28
  TimeCtrlLight,
27
29
  WifiIotStatusReport,
@@ -206,6 +208,11 @@ class StateManager:
206
208
  if resp.res == DrvDevInfoResult.DRV_RESULT_SUC and resp.id == 1 and resp.type == 6:
207
209
  self._device.mower_state.swversion = resp.info
208
210
  self._device.device_firmwares.device_version = resp.info
211
+ case "bidire_reqconver_path":
212
+ work_settings: NavReqCoverPath = net_msg[1]
213
+ self._device.work = CurrentTaskSettings.from_dict(
214
+ work_settings.to_dict(casing=betterproto.Casing.SNAKE)
215
+ )
209
216
 
210
217
  def _update_mul_data(self, message) -> None:
211
218
  pass
@@ -90,12 +90,9 @@ class MammotionBaseDevice:
90
90
  await self.queue_command("get_regional_data", regional_data=region_data)
91
91
 
92
92
  async def plan_callback(self, plan: NavPlanJobSet) -> None:
93
- if plan.plan_index != 0 and plan.total_plan_num - 1 != plan.plan_index:
94
- index = plan.plan_index
95
- while index in self.mower.map.plan and index < plan.total_plan_num:
96
- index += 1
97
- if index < plan.total_plan_num:
98
- await self.queue_command("read_plan", plan_index=index)
93
+ if plan.plan_index < plan.total_plan_num - 1:
94
+ index = plan.plan_index + 1
95
+ await self.queue_command("read_plan", sub_cmd=2, plan_index=index)
99
96
 
100
97
  def _update_raw_data(self, data: bytes) -> None:
101
98
  """Update raw and model data from notifications."""
@@ -224,7 +221,9 @@ class MammotionBaseDevice:
224
221
  if self._cloud_device and len(self.mower.map.area_name) == 0 and not DeviceType.is_luba1(self.mower.name):
225
222
  await self.queue_command("get_area_name_list", device_id=self._cloud_device.iotId)
226
223
 
227
- if len(self.mower.map.plan) == 0 or self.mower.map.plan[0].total_plan_num != len(self.mower.map.plan):
224
+ if len(self.mower.map.plan) == 0 or list(self.mower.map.plan.values())[0].total_plan_num != len(
225
+ self.mower.map.plan
226
+ ):
228
227
  await self.queue_command("read_plan", sub_cmd=2, plan_index=0)
229
228
 
230
229
  for hash, frame in list(self.mower.map.area.items()):
@@ -297,7 +297,7 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
297
297
  await self._ble_sync()
298
298
  self.schedule_ble_sync()
299
299
 
300
- async def _send_command_locked(self, key: str, command: bytes) -> bytes:
300
+ async def _send_command_locked(self, key: str, command: bytes) -> None:
301
301
  """Send command to device and read response."""
302
302
  await self._ensure_connected()
303
303
  try:
@@ -344,12 +344,7 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
344
344
  if has_field(new_msg.net.toapp_wifi_iot_status) and self._commands.get_device_product_key() == "":
345
345
  self._commands.set_device_product_key(new_msg.net.toapp_wifi_iot_status.productkey)
346
346
 
347
- return
348
-
349
347
  await self._state_manager.notification(new_msg)
350
- # may or may not be correct, some work could be done here to correctly match responses
351
- if self._notify_future and not self._notify_future.done():
352
- self._notify_future.set_result(data)
353
348
 
354
349
  if self._execute_timed_disconnect is None:
355
350
  await self._execute_forced_disconnect()
@@ -361,30 +356,12 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
361
356
  _LOGGER.debug("%s: Subscribe to notifications; RSSI: %s", self.name, self.rssi)
362
357
  await self._client.start_notify(self._read_char, self._notification_handler)
363
358
 
364
- async def _execute_command_locked(self, key: str, command: bytes) -> bytes:
359
+ async def _execute_command_locked(self, key: str, command: bytes) -> None:
365
360
  """Execute command and read response."""
366
361
  assert self._client is not None
367
- self._notify_future = self.loop.create_future()
368
- self._key = key
369
362
  _LOGGER.debug("%s: Sending command: %s", self.name, key)
370
363
  await self._message.post_custom_data_bytes(command)
371
364
 
372
- timeout = 1
373
- timeout_handle = self.loop.call_at(self.loop.time() + timeout, _handle_timeout, self._notify_future)
374
- timeout_expired = False
375
- try:
376
- notify_msg = await self._notify_future
377
- except asyncio.TimeoutError:
378
- timeout_expired = True
379
- notify_msg = b""
380
- finally:
381
- if not timeout_expired:
382
- timeout_handle.cancel()
383
- self._notify_future = None
384
-
385
- _LOGGER.debug("%s: Notification received: %s", self.name, notify_msg.hex())
386
- return notify_msg
387
-
388
365
  def get_address(self) -> str:
389
366
  """Return address of device."""
390
367
  return self.ble_device.address
@@ -275,10 +275,10 @@ class DeviceType(Enum):
275
275
  device_type = DeviceType.value_of_str(device_name, product_key)
276
276
 
277
277
  return (
278
- DeviceType.RTK.get_value() != device_type.get_value()
279
- and DeviceType.RTK3A0.get_value() != device_type.get_value()
280
- and DeviceType.RTK3A1.get_value() != device_type.get_value()
281
- and DeviceType.RTK3A2.get_value() != device_type.get_value()
278
+ DeviceType.RTK.get_value() == device_type.get_value()
279
+ or DeviceType.RTK3A0.get_value() == device_type.get_value()
280
+ or DeviceType.RTK3A1.get_value() == device_type.get_value()
281
+ or DeviceType.RTK3A2.get_value() == device_type.get_value()
282
282
  )
283
283
 
284
284
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymammotion
3
- Version: 0.4.30
3
+ Version: 0.4.32
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: Michael Arthur
@@ -26,7 +26,7 @@ pymammotion/const.py,sha256=lWRxvTVdXnNHuxqvRkjO5ziK0Ic-fZMM6J2dbe5M6Nc,385
26
26
  pymammotion/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  pymammotion/data/model/__init__.py,sha256=aSyroxYQQS-WMRi6WmWm2js4wLa9nmsi160gx9tts4o,323
28
28
  pymammotion/data/model/account.py,sha256=vJM-KTf2q6eBfVC-UlNHBSmJvqHiCawZ40vnuhXhaz8,140
29
- pymammotion/data/model/device.py,sha256=GRKaXPocoetyekHo4DQtPKmJQH9v7ksZvGxe0XgmnLc,6892
29
+ pymammotion/data/model/device.py,sha256=oWwvnqb45tqErPgDu2P9OX8HRuN-NV6bYNTotU5ofRY,7027
30
30
  pymammotion/data/model/device_config.py,sha256=1kFkztZk3_DXHaEUZN-j_4s0HT83m4qLVAg2uHCyzFg,2638
31
31
  pymammotion/data/model/device_info.py,sha256=Q0qJ6BflQycH_VFugwaFFXcvM69q2v9JAe2wWOcCggE,904
32
32
  pymammotion/data/model/device_limits.py,sha256=m8HdxD-RaAkPm7jHYb9GLxMEH9IfzBPz0ZypmsLnId4,1946
@@ -46,7 +46,7 @@ pymammotion/data/mqtt/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdr
46
46
  pymammotion/data/mqtt/event.py,sha256=r14gzZVxmlGVAwFdZQ1CUsMZFHHwRKnbt2VHnjugP28,5123
47
47
  pymammotion/data/mqtt/properties.py,sha256=pX5JRVmmpVO04CSPm5xAGcSWA_OeLd0JnBagLsfiSEc,3755
48
48
  pymammotion/data/mqtt/status.py,sha256=SgdrpE1Uldb01hybO6hYhgU1Sp1eILghC0UhMZMHrdQ,1091
49
- pymammotion/data/state_manager.py,sha256=m0goRLZXJwZ8pDi_Rt8HIyVNE3O4sLSprfjzycauk-s,9361
49
+ pymammotion/data/state_manager.py,sha256=eL92Ul2L-qfF1tfz5gx4jewMkMMfbIGoYzAQY3jCyxc,9704
50
50
  pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
51
51
  pymammotion/event/event.py,sha256=bj2RirSIRyBs0QvkcrOtwZWUX_8F3m1sySuHVyKmZLs,2143
52
52
  pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -68,9 +68,9 @@ pymammotion/mammotion/commands/messages/video.py,sha256=Vn5F65ojr3chePBtfYjOg90E
68
68
  pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
69
  pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
70
70
  pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
71
- pymammotion/mammotion/devices/base.py,sha256=FeESaqNcHqQ_4Ew8Hq2BCQQZQeS9M8lOvw8zBJLka2k,12435
71
+ pymammotion/mammotion/devices/base.py,sha256=LwwzRlf6vE8x6khIBDIlJU2y7_k1tTITLFU74uMP7mg,12306
72
72
  pymammotion/mammotion/devices/mammotion.py,sha256=ffzwsQqO9zDwMElWYMsxi-J5_rGaOOOHdAm5D3DXprc,13671
73
- pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=nIuOW22Une1Zk1tN691jGUv_eqQJA8K2LuC9ohPUHAk,19612
73
+ pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=VnFlZMQhGrpsNe5TYhOyGnGrZSoLIMWTLJ8asPLy19c,18725
74
74
  pymammotion/mammotion/devices/mammotion_cloud.py,sha256=pQiwL9MT9q4guay2sY4-v2TtiQMAEpmsPUTnBJvMDvI,14053
75
75
  pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
76
76
  pymammotion/mqtt/linkkit/__init__.py,sha256=ENgc3ynd2kd9gMQR3-kgmCu6Ed9Y6XCIzU0zFReUlkk,80
@@ -115,12 +115,12 @@ pymammotion/utility/constant/device_constant.py,sha256=g6QWBaP85h6PNxmk1cOqtP7Hv
115
115
  pymammotion/utility/conversions.py,sha256=v3YICy0zZwwBBzrUZgabI7GRfiDBnkiAX2qdtk3NxOY,89
116
116
  pymammotion/utility/datatype_converter.py,sha256=SPM_HuaaD_XOawlqEnA8qlRRZXGba3WjA8kGOZgeBlQ,4284
117
117
  pymammotion/utility/device_config.py,sha256=65Jl73-dQDs4yMXwYXZW_bsgSvnwpFBZDu8OQPEIgx8,27877
118
- pymammotion/utility/device_type.py,sha256=A8EV1MJayc9vm00ceDV35_K-nCOY_LgkFqWzzufoURM,12585
118
+ pymammotion/utility/device_type.py,sha256=Lhvi8CLY8qr1EghZFlFK85hhzsmyE0LHVZO0qAmYod4,12582
119
119
  pymammotion/utility/map.py,sha256=GYscVMg2cX3IPlNpCBNHDW0S55yS1WGRf1iHnNZ7TfQ,2227
120
120
  pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tpfI,615
121
121
  pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
122
122
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
123
- pymammotion-0.4.30.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
124
- pymammotion-0.4.30.dist-info/METADATA,sha256=jLexrxTaRKDn8rZ1ruVAfQtNWS4t_cI4p66S3o6Pey8,3878
125
- pymammotion-0.4.30.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
126
- pymammotion-0.4.30.dist-info/RECORD,,
123
+ pymammotion-0.4.32.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
124
+ pymammotion-0.4.32.dist-info/METADATA,sha256=4D-uF3c0qwmbXqu_JKITQsHo03e_NEba3OIjnytXFsg,3878
125
+ pymammotion-0.4.32.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
126
+ pymammotion-0.4.32.dist-info/RECORD,,