pymammotion 0.2.58__py3-none-any.whl → 0.2.60__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.
@@ -664,6 +664,7 @@ class CloudIOTGateway:
664
664
  "args": {"content": self.converter.printBase64Binary(command)},
665
665
  "identifier": "device_protobuf_sync_service",
666
666
  "iotId": f"{iot_id}",
667
+ "identityId": f"{self._session_by_authcode_response.data.identityId}"
667
668
  },
668
669
  request=request,
669
670
  version="1.0",
@@ -687,6 +688,7 @@ class CloudIOTGateway:
687
688
  str(response_body_dict.get("msg")),
688
689
  )
689
690
  if response_body_dict.get("code") == 29003:
691
+ logger.debug(self._session_by_authcode_response.data.identityId)
690
692
  self.sign_out()
691
693
  raise SetupException(response_body_dict.get("code"))
692
694
  if response_body_dict.get("code") == 6205:
@@ -34,7 +34,7 @@ class OperationSettings(DataClassORJSONMixin):
34
34
  blade_height: int = 0
35
35
  path_order: str = ""
36
36
  toward: int = 0 # is just angle
37
- toward_included_angle: int = 0
37
+ toward_included_angle: int = 90
38
38
  toward_mode: int = 0 # angle type relative etc
39
39
  border_mode: int = 1 # border laps
40
40
  obstacle_laps: int = 1
@@ -64,6 +64,13 @@ class DeviceNotificationEventValue(DataClassORJSONMixin):
64
64
  data: str # parsed to DeviceNotificationEventCode
65
65
 
66
66
 
67
+ @dataclass
68
+ class DeviceBizReqEventValue(DataClassORJSONMixin):
69
+ bizType: str
70
+ bizId: str
71
+ params: str
72
+
73
+
67
74
  @dataclass
68
75
  class GeneralParams(DataClassORJSONMixin):
69
76
  groupIdList: list[str]
@@ -115,6 +122,13 @@ class DeviceNotificationEventParams(GeneralParams):
115
122
  value: DeviceNotificationEventValue
116
123
 
117
124
 
125
+ @dataclass
126
+ class DeviceBizReqEventParams(GeneralParams):
127
+ identifier: Literal["device_biz_req_event"]
128
+ type: Literal["info"]
129
+ value: DeviceBizReqEventValue
130
+
131
+
118
132
  @dataclass
119
133
  class DeviceWarningEventParams(GeneralParams):
120
134
  identifier: Literal["device_warning_event"]
@@ -152,6 +166,8 @@ class ThingEventMessage(DataClassORJSONMixin):
152
166
  params_obj = DeviceProtobufMsgEventParams.from_dict(params_dict)
153
167
  elif identifier == "device_warning_event":
154
168
  params_obj = DeviceWarningEventParams.from_dict(params_dict)
169
+ elif identifier == "device_biz_req_event":
170
+ params_obj = DeviceBizReqEventParams.from_dict(params_dict)
155
171
  elif identifier == "device_config_req_event":
156
172
  params_obj = payload.get("params", {})
157
173
  elif identifier == "device_notification_event" or identifier == "device_warning_code_event":
@@ -1,10 +1,12 @@
1
1
  """Manage state from notifications into MowingDevice."""
2
2
 
3
+ import logging
3
4
  from datetime import datetime
4
5
  from typing import Any, Awaitable, Callable, Optional
5
6
 
6
7
  import betterproto
7
8
 
9
+ from pymammotion.aliyun.cloud_gateway import SetupException
8
10
  from pymammotion.data.model.device import MowingDevice
9
11
  from pymammotion.data.model.hash_list import AreaHashNameList
10
12
  from pymammotion.data.mqtt.properties import ThingPropertiesMessage
@@ -12,6 +14,8 @@ from pymammotion.proto.luba_msg import LubaMsg
12
14
  from pymammotion.proto.mctrl_nav import AppGetAllAreaHashName, NavGetCommDataAck, NavGetHashListAck
13
15
  from pymammotion.utility.constant import WorkMode
14
16
 
17
+ logger = logging.getLogger(__name__)
18
+
15
19
 
16
20
  class StateManager:
17
21
  """Manage state."""
@@ -89,7 +93,11 @@ class StateManager:
89
93
  self._device.update_report_data(sys_msg[1])
90
94
  if self.queue_command_callback:
91
95
  if self._device.sys.toapp_report_data.dev.sys_status != WorkMode.MODE_WORKING:
92
- await self.queue_command_callback("get_report_cfg_stop")
96
+ try:
97
+ await self.queue_command_callback("get_report_cfg_stop")
98
+ except SetupException as exc:
99
+ # can't do anything about it yet
100
+ logger.debug(exc)
93
101
  case "mow_to_app_info":
94
102
  self._device.mow_info(sys_msg[1])
95
103
  case "system_tard_state_tunnel":
@@ -217,8 +217,9 @@ class MammotionBaseDevice:
217
217
 
218
218
  await self.queue_command("get_all_boundary_hash_list", sub_cmd=0)
219
219
  await self.queue_command("get_hash_response", total_frame=1, current_frame=1)
220
- data_hash = self.mower.map.missing_hashlist.pop()
221
- await self.queue_command("synchronize_hash_data", hash_num=data_hash)
220
+ if len(self.mower.map.missing_hashlist) > 0:
221
+ data_hash = self.mower.map.missing_hashlist.pop()
222
+ await self.queue_command("synchronize_hash_data", hash_num=data_hash)
222
223
 
223
224
  # sub_cmd 3 is job hashes??
224
225
  # sub_cmd 4 is dump location (yuka)
@@ -182,11 +182,10 @@ class Mammotion:
182
182
  await self.initiate_cloud_connection(account, cloud_client)
183
183
 
184
184
  async def initiate_cloud_connection(self, account: str, cloud_client: CloudIOTGateway) -> None:
185
+ loop = asyncio.get_running_loop()
185
186
  if self.mqtt_list.get(account) is not None:
186
- if self.mqtt_list.get(account).is_connected:
187
- # we might have removed a device so readd
188
- self.add_cloud_devices(self.mqtt_list.get(account))
189
- return
187
+ if self.mqtt_list.get(account).is_connected():
188
+ await loop.run_in_executor(None, self.mqtt_list.get(account).disconnect)
190
189
 
191
190
  mammotion_cloud = MammotionCloud(
192
191
  MammotionMQTT(
@@ -203,7 +202,6 @@ class Mammotion:
203
202
  self.mqtt_list[account] = mammotion_cloud
204
203
  self.add_cloud_devices(mammotion_cloud)
205
204
 
206
- loop = asyncio.get_running_loop()
207
205
  await loop.run_in_executor(None, self.mqtt_list[account].connect_async)
208
206
 
209
207
  def add_cloud_devices(self, mqtt_client: MammotionCloud) -> None:
@@ -258,11 +258,15 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
258
258
 
259
259
  async def _parse_message_for_device(self, event: ThingEventMessage) -> None:
260
260
  params = event.params
261
+ new_msg = LubaMsg()
261
262
  if event.params.iotId != self.iot_id:
262
263
  return
263
264
  binary_data = base64.b64decode(params.value.content)
264
- self._update_raw_data(binary_data)
265
- new_msg = LubaMsg().parse(binary_data)
265
+ try:
266
+ self._update_raw_data(binary_data)
267
+ new_msg = LubaMsg().parse(binary_data)
268
+ except (KeyError, ValueError, IndexError):
269
+ _LOGGER.exception("Error parsing message %s", binary_data)
266
270
 
267
271
  if (
268
272
  self._commands.get_device_product_key() == ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymammotion
3
- Version: 0.2.58
3
+ Version: 0.2.60
4
4
  Summary:
5
5
  License: GNU-3.0
6
6
  Author: Michael Arthur
@@ -1,6 +1,6 @@
1
1
  pymammotion/__init__.py,sha256=jHCQrpJaG1jAoID9T4RT3g4JsZc0JpJqIcqjnA7cXd0,1605
2
2
  pymammotion/aliyun/__init__.py,sha256=T1lkX7TRYiL4nqYanG4l4MImV-SlavSbuooC-W-uUGw,29
3
- pymammotion/aliyun/cloud_gateway.py,sha256=GC125Vjz5Z5h_o9NYoBwJRkTOY6qSWoC6fdBKIPleJ0,25576
3
+ pymammotion/aliyun/cloud_gateway.py,sha256=81el3sCj7bS02PnY3krOlwnlDvQiAr2G0nHsRJLN0tk,25743
4
4
  pymammotion/aliyun/cloud_service.py,sha256=px7dUKow5Z7VyebjYzuKkzkm77XbUXYiFiYO_2e-UQ0,2207
5
5
  pymammotion/aliyun/model/aep_response.py,sha256=8f6GIP58ve8gd6AL3HBoXxsy0n2q4ygWvjELGnoOnVc,452
6
6
  pymammotion/aliyun/model/connect_response.py,sha256=Yz-fEbDzgGPTo5Of2oAjmFkSv08T7ze80pQU4k-gKIU,824
@@ -23,7 +23,7 @@ pymammotion/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
23
23
  pymammotion/data/model/__init__.py,sha256=aSyroxYQQS-WMRi6WmWm2js4wLa9nmsi160gx9tts4o,323
24
24
  pymammotion/data/model/account.py,sha256=vJM-KTf2q6eBfVC-UlNHBSmJvqHiCawZ40vnuhXhaz8,140
25
25
  pymammotion/data/model/device.py,sha256=hsN_NrrM_Kg1gbxcmSL3sVubGmeMxWHwnPiUN1-d8Eo,12196
26
- pymammotion/data/model/device_config.py,sha256=GtWR9SOXlwEwWsg7-UtoVuBmd-i8wXI4LnJ-cL5fh1o,2827
26
+ pymammotion/data/model/device_config.py,sha256=SMBrG-rjN58Z59V-ok3wQ0721BQxM9zSdYXI3Q8GFdY,2828
27
27
  pymammotion/data/model/enums.py,sha256=EpKmO8yVUZyEnTY4yH0DMMVKYNQM42zpW1maUu0i3IE,1582
28
28
  pymammotion/data/model/excute_boarder_params.py,sha256=9CpUqrygcle1C_1hDW-riLmm4map4ZbE842NXjcomEI,1394
29
29
  pymammotion/data/model/execute_boarder.py,sha256=9rd_h4fbcsXxgnLOd2rO2hWyD1abnTGc47QTEpp8DD0,1103
@@ -36,10 +36,10 @@ pymammotion/data/model/rapid_state.py,sha256=mIdhAG_LZXpVcybxqTLgLXkNOmVmDTn04B9
36
36
  pymammotion/data/model/region_data.py,sha256=OTV15vRyn9JORXsQPjWMNF1ZujuNhsOKl25KeqwMObA,3007
37
37
  pymammotion/data/model/report_info.py,sha256=AE2u64uKgcJtVooldJcxXBsEHfDyCvH5DnQFUQ5qWmk,2226
38
38
  pymammotion/data/mqtt/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
39
- pymammotion/data/mqtt/event.py,sha256=ciXqLRD1IQfMImVCifO5Dkm433LvkUwVhe2QqEdHP5E,4641
39
+ pymammotion/data/mqtt/event.py,sha256=z6j8t-ZOjEeKjFt7S0wV8vV5L0-iHD3RbwI9hCfzGTY,5044
40
40
  pymammotion/data/mqtt/properties.py,sha256=kvphcjrDuJHuX8Az98-wKeFv_rSmu2Fz9YKLGodGSj0,3759
41
41
  pymammotion/data/mqtt/status.py,sha256=zqnlo-MzejEQZszl0i0Wucoc3E76x6UtI9JLxoBnu54,1067
42
- pymammotion/data/state_manager.py,sha256=tH1dI5uH8qiIeJjHXR8FhGiWPEcOz-f3D4TyAhCiz-I,4327
42
+ pymammotion/data/state_manager.py,sha256=DjWi_ojheZFB_KfdMnOJgxMTQ46HpbwtATK2ebgwRHE,4634
43
43
  pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
44
44
  pymammotion/event/event.py,sha256=UzYnxV5DfvMDK3E06UvSzvzuBbaXOOUwO6xYt_zn9To,2034
45
45
  pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -60,10 +60,10 @@ pymammotion/mammotion/commands/messages/video.py,sha256=ne1YSuQChaDFfmHgMO5Jc9_O
60
60
  pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
62
62
  pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
63
- pymammotion/mammotion/devices/base.py,sha256=MXAuJ9sGnf9QqBeNxGbOkdtqwVpPocVdxw0uT0DgSks,9800
64
- pymammotion/mammotion/devices/mammotion.py,sha256=ckGN6wjIB3rfXkk__0jUt7Jw6_02ZffhPTldw5fnvU8,12431
63
+ pymammotion/mammotion/devices/base.py,sha256=Q5acOJEevJji_fI09R6qbupzvkxGsteJxcWsfTjqLXc,9861
64
+ pymammotion/mammotion/devices/mammotion.py,sha256=KRtGSoDY9FxeehOZAlzasmk0fO-2Ru1fkw6McFEovzA,12373
65
65
  pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=nyO7pkKgAoRPs-28ESf6ee-y3G5JTYRO-MCp4wKPMlE,17476
66
- pymammotion/mammotion/devices/mammotion_cloud.py,sha256=VuXuYlvi-HRbfRlgIV3KraVtbu2EM3QxP-JWWAYj_E0,11774
66
+ pymammotion/mammotion/devices/mammotion_cloud.py,sha256=EbIdtOYOZS6E0RoIDgHJmGBOTjGIKx77ZDtA9BerF-M,11945
67
67
  pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
68
68
  pymammotion/mqtt/mammotion_future.py,sha256=_OWqKOlUGl2yT1xOsXFQYpGd-1zQ63OxqXgy7KRQgYc,710
69
69
  pymammotion/mqtt/mammotion_mqtt.py,sha256=LaySave_hf0gU3crUTLqzpdQtxIwK8vu5DM8F8fbU2Y,8748
@@ -118,7 +118,7 @@ pymammotion/utility/map.py,sha256=GYscVMg2cX3IPlNpCBNHDW0S55yS1WGRf1iHnNZ7TfQ,22
118
118
  pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tpfI,615
119
119
  pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
120
120
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
121
- pymammotion-0.2.58.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
122
- pymammotion-0.2.58.dist-info/METADATA,sha256=VuOMlzTsHVYCqTzog6HnR9HkMfz--WWxE8yIeoXouvY,3874
123
- pymammotion-0.2.58.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
124
- pymammotion-0.2.58.dist-info/RECORD,,
121
+ pymammotion-0.2.60.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
122
+ pymammotion-0.2.60.dist-info/METADATA,sha256=j7Wek8S1oT8yaIKyoK6aKbqaLiboeMm1J--yDMwMyX0,3874
123
+ pymammotion-0.2.60.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
124
+ pymammotion-0.2.60.dist-info/RECORD,,