pymammotion 0.4.12b1__py3-none-any.whl → 0.4.13__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.
@@ -36,12 +36,10 @@ class MammotionBLE:
36
36
  return await self.connect()
37
37
 
38
38
  async def connect(self) -> bool:
39
- if self.client is not None:
40
- return await self.client.connect()
39
+ return await self.client.connect() if self.client is not None else False
41
40
 
42
41
  async def disconnect(self) -> bool:
43
- if self.client is not None:
44
- return await self.client.disconnect()
42
+ return await self.client.disconnect() if self.client is not None else False
45
43
 
46
44
  async def notification_handler(self, _characteristic: BleakGATTCharacteristic, data: bytearray) -> None:
47
45
  """Simple notification handler which prints the data received."""
@@ -92,8 +92,6 @@ class MowingDevice(DataClassORJSONMixin):
92
92
  self.location.work_zone = (
93
93
  location.zone_hash if self.report_data.dev.sys_status == WorkMode.MODE_WORKING else 0
94
94
  )
95
- if location.bol_hash:
96
- self.map.bol_hash = location.bol_hash
97
95
 
98
96
  if toapp_report_data.fw_info:
99
97
  self.update_device_firmwares(toapp_report_data.fw_info)
@@ -120,7 +120,6 @@ class HashList(DataClassORJSONMixin):
120
120
  hashlist for all our hashIDs for verification
121
121
  """
122
122
 
123
- bol_hash: str = ""
124
123
  root_hash_lists: list[RootHashList] = field(default_factory=list)
125
124
  area: dict[int, FrameList] = field(default_factory=dict) # type 0
126
125
  path: dict[int, FrameList] = field(default_factory=dict) # type 2
@@ -135,6 +134,11 @@ class HashList(DataClassORJSONMixin):
135
134
  self.obstacle = {hash_id: frames for hash_id, frames in self.obstacle.items() if hash_id in hashlist}
136
135
  self.dump = {hash_id: frames for hash_id, frames in self.dump.items() if hash_id in hashlist}
137
136
  self.svg = {hash_id: frames for hash_id, frames in self.svg.items() if hash_id in hashlist}
137
+ self.area_name = [
138
+ area_item
139
+ for area_item in self.area_name
140
+ if area_item.hash in self.area.keys() or area_item.hash in hashlist
141
+ ]
138
142
 
139
143
  @property
140
144
  def hashlist(self) -> list[int]:
@@ -143,8 +147,7 @@ class HashList(DataClassORJSONMixin):
143
147
  # Combine data_couple from all RootHashLists
144
148
  return [i for root_list in self.root_hash_lists for obj in root_list.data for i in obj.data_couple]
145
149
 
146
- @property
147
- def missing_hashlist(self) -> list[int]:
150
+ def missing_hashlist(self, sub_cmd: int = 0) -> list[int]:
148
151
  """Return missing hashlist."""
149
152
  all_hash_ids = set(self.area.keys()).union(
150
153
  self.path.keys(), self.obstacle.keys(), self.dump.keys(), self.svg.keys()
@@ -153,6 +156,7 @@ class HashList(DataClassORJSONMixin):
153
156
  i
154
157
  for root_list in self.root_hash_lists
155
158
  for obj in root_list.data
159
+ if root_list.sub_cmd == sub_cmd
156
160
  for i in obj.data_couple
157
161
  if i not in all_hash_ids
158
162
  ]
@@ -167,6 +171,9 @@ class HashList(DataClassORJSONMixin):
167
171
  ),
168
172
  None,
169
173
  )
174
+ if target_root_list is None:
175
+ return []
176
+
170
177
  return self._find_missing_frames(target_root_list)
171
178
 
172
179
  def update_root_hash_list(self, hash_list: NavGetHashListData) -> None:
@@ -224,12 +231,15 @@ class HashList(DataClassORJSONMixin):
224
231
 
225
232
  def update(self, hash_data: NavGetCommData | SvgMessage) -> bool:
226
233
  """Update the map data."""
234
+
227
235
  if hash_data.type == PathType.AREA:
228
236
  existing_name = next((area for area in self.area_name if area.hash == hash_data.hash), None)
229
237
  if not existing_name:
230
238
  name = f"area {len(self.area_name)+1}" if hash_data.area_label is None else hash_data.area_label.label
231
239
  self.area_name.append(AreaHashNameList(name=name, hash=hash_data.hash))
232
- return self._add_hash_data(self.area, hash_data)
240
+ result = self._add_hash_data(self.area, hash_data)
241
+ self.update_hash_lists(self.hashlist)
242
+ return result
233
243
 
234
244
  if hash_data.type == PathType.OBSTACLE:
235
245
  return self._add_hash_data(self.obstacle, hash_data)
@@ -48,8 +48,8 @@ class MammotionBaseDevice:
48
48
 
49
49
  missing_frames = self.mower.map.missing_root_hash_frame(hash_ack)
50
50
  if len(missing_frames) == 0:
51
- if len(self.mower.map.missing_hashlist) > 0:
52
- data_hash = self.mower.map.missing_hashlist.pop()
51
+ if len(self.mower.map.missing_hashlist(hash_ack.sub_cmd)) > 0:
52
+ data_hash = self.mower.map.missing_hashlist(hash_ack.sub_cmd).pop()
53
53
  return await self.queue_command("synchronize_hash_data", hash_num=data_hash)
54
54
  return
55
55
 
@@ -67,7 +67,11 @@ class MammotionBaseDevice:
67
67
  if len(missing_frames) == 0:
68
68
  # get next in hash ack list
69
69
 
70
- data_hash = self.mower.map.missing_hashlist.pop() if len(self.mower.map.missing_hashlist) > 0 else None
70
+ data_hash = (
71
+ self.mower.map.missing_hashlist(common_data.sub_cmd).pop()
72
+ if len(self.mower.map.missing_hashlist(common_data.sub_cmd)) > 0
73
+ else None
74
+ )
71
75
  if data_hash is None:
72
76
  return
73
77
 
@@ -205,14 +209,16 @@ class MammotionBaseDevice:
205
209
  async def start_map_sync(self) -> None:
206
210
  """Start sync of map data."""
207
211
 
212
+ self.mower.map.update_hash_lists(self.mower.map.hashlist)
213
+
208
214
  if self._cloud_device and len(self.mower.map.area_name) == 0 and not DeviceType.is_luba1(self.mower.name):
209
215
  await self.queue_command("get_area_name_list", device_id=self._cloud_device.iotId)
210
216
 
211
217
  await self.queue_command("read_plan", sub_cmd=2, plan_index=0)
212
218
 
213
219
  await self.queue_command("get_all_boundary_hash_list", sub_cmd=0)
214
- if len(self.mower.map.missing_hashlist) > 0:
215
- data_hash = self.mower.map.missing_hashlist.pop()
220
+ if len(self.mower.map.missing_hashlist()) > 0:
221
+ data_hash = self.mower.map.missing_hashlist().pop()
216
222
  await self.queue_command("synchronize_hash_data", hash_num=data_hash)
217
223
 
218
224
  # sub_cmd 3 is job hashes??
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymammotion
3
- Version: 0.4.12b1
3
+ Version: 0.4.13
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: Michael Arthur
@@ -10,7 +10,7 @@ pymammotion/aliyun/model/session_by_authcode_response.py,sha256=naMDigtvmpf-Ikf5
10
10
  pymammotion/aliyun/model/stream_subscription_response.py,sha256=7d0i8cNMAMX7aQjd2yebMDdqQkugcCzk-SD6oVtf18M,333
11
11
  pymammotion/aliyun/tmp_constant.py,sha256=M4Hq_lrGB3LZdX6R2XohRPFoK1NDnNV-pTJwJcJ9838,6650
12
12
  pymammotion/bluetooth/__init__.py,sha256=LAl8jqZ1fPh-3mLmViNQsP3s814C1vsocYUa6oSaXt0,36
13
- pymammotion/bluetooth/ble.py,sha256=k5o2BVXSF2vLZ75U3PsUE8NomWFirJkYDVWfQQs_P1I,2484
13
+ pymammotion/bluetooth/ble.py,sha256=XQWJBpSzeIawCrLTsVrq9LI6jmM_ALVTttUkosK2BRM,2480
14
14
  pymammotion/bluetooth/ble_message.py,sha256=47xoj22Kw5XF9VT965J_BxpvTdOgSXy4opqkbsojvDo,18795
15
15
  pymammotion/bluetooth/const.py,sha256=CCqyHsYbB0BAYjwdhXt_n6eWWxmhlUrAFjvVv57mbvE,1749
16
16
  pymammotion/bluetooth/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -23,7 +23,7 @@ pymammotion/const.py,sha256=lWRxvTVdXnNHuxqvRkjO5ziK0Ic-fZMM6J2dbe5M6Nc,385
23
23
  pymammotion/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  pymammotion/data/model/__init__.py,sha256=aSyroxYQQS-WMRi6WmWm2js4wLa9nmsi160gx9tts4o,323
25
25
  pymammotion/data/model/account.py,sha256=vJM-KTf2q6eBfVC-UlNHBSmJvqHiCawZ40vnuhXhaz8,140
26
- pymammotion/data/model/device.py,sha256=iyTqtWkpd6SCC-Y99z9mOdbQQtj7pROkfNdtKiUY2Jo,6988
26
+ pymammotion/data/model/device.py,sha256=GRKaXPocoetyekHo4DQtPKmJQH9v7ksZvGxe0XgmnLc,6892
27
27
  pymammotion/data/model/device_config.py,sha256=dfva6mErOepLaen1CrjGaEVbEPrxRTSWXJh-yIn5iMI,2636
28
28
  pymammotion/data/model/device_info.py,sha256=Q0qJ6BflQycH_VFugwaFFXcvM69q2v9JAe2wWOcCggE,904
29
29
  pymammotion/data/model/device_limits.py,sha256=m8HdxD-RaAkPm7jHYb9GLxMEH9IfzBPz0ZypmsLnId4,1946
@@ -31,7 +31,7 @@ pymammotion/data/model/enums.py,sha256=EpKmO8yVUZyEnTY4yH0DMMVKYNQM42zpW1maUu0i3
31
31
  pymammotion/data/model/excute_boarder_params.py,sha256=9CpUqrygcle1C_1hDW-riLmm4map4ZbE842NXjcomEI,1394
32
32
  pymammotion/data/model/execute_boarder.py,sha256=9rd_h4fbcsXxgnLOd2rO2hWyD1abnTGc47QTEpp8DD0,1103
33
33
  pymammotion/data/model/generate_route_information.py,sha256=pgjqURwmEIzjCMbl4Z5JDDkfxyUAdry1KhPfyir3-mU,777
34
- pymammotion/data/model/hash_list.py,sha256=Paztwh7ZetmDtbS9sDNpdaDB1bZKWUqJY06O3pkBuAw,9574
34
+ pymammotion/data/model/hash_list.py,sha256=nN_FndIkPK61EaQEY8c3bC1DyGoQmuoAENOOOcc2IdY,9921
35
35
  pymammotion/data/model/location.py,sha256=PwmITejfI4pm7PI4rzqSuuHetwle6IJr_CV95435s2M,871
36
36
  pymammotion/data/model/mowing_modes.py,sha256=bBbRhDe-imZsXDR0TN0emQv6BiIkAlXJFb5isPEjgDk,1078
37
37
  pymammotion/data/model/plan.py,sha256=wGlcJT-w0EdbWK9jI838TCOm_MABFg7WoR664VB8RWg,2880
@@ -65,7 +65,7 @@ pymammotion/mammotion/commands/messages/video.py,sha256=YQGIxKx2prA0X01ovNmMkX6Y
65
65
  pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
66
  pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
67
67
  pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
68
- pymammotion/mammotion/devices/base.py,sha256=hmZZkhTtPyqvpEwN4jwsLCDztUL7w-F5vuZLjBWCIZ8,10269
68
+ pymammotion/mammotion/devices/base.py,sha256=urFR2c_kZGoUJ6e0KPY7I5OU-sfrINxuLAIyML_jGAY,10482
69
69
  pymammotion/mammotion/devices/mammotion.py,sha256=Zz2tUIdGA-jFSHLM3aO8tBMvVl7sBIBiqC9Kg7f-lm8,13190
70
70
  pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=0c-HXawLQVHz28s0HKaSCNq4wmLWJZZ3ATDVnCXdSrc,19579
71
71
  pymammotion/mammotion/devices/mammotion_cloud.py,sha256=gLdxaD759QphR10LsQchTTOHZi6jvnI2EHlbhMfsXvE,14373
@@ -117,7 +117,7 @@ pymammotion/utility/map.py,sha256=GYscVMg2cX3IPlNpCBNHDW0S55yS1WGRf1iHnNZ7TfQ,22
117
117
  pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tpfI,615
118
118
  pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
119
119
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
120
- pymammotion-0.4.12b1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
121
- pymammotion-0.4.12b1.dist-info/METADATA,sha256=nSFLyzHNqCmfX-cGjMdjWGADYmlxbRl1OQn0R8mYpA0,3836
122
- pymammotion-0.4.12b1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
123
- pymammotion-0.4.12b1.dist-info/RECORD,,
120
+ pymammotion-0.4.13.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
121
+ pymammotion-0.4.13.dist-info/METADATA,sha256=x2JSRmpE4CObFCpGzuUC_zEydlAZwBUpZfzTSgFnafg,3834
122
+ pymammotion-0.4.13.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
123
+ pymammotion-0.4.13.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.1
2
+ Generator: poetry-core 2.1.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any