pymammotion 0.2.31__tar.gz → 0.2.32__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 (123) hide show
  1. {pymammotion-0.2.31 → pymammotion-0.2.32}/PKG-INFO +1 -1
  2. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/cloud_gateway.py +2 -1
  3. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/device_config.py +3 -2
  4. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/hash_list.py +6 -3
  5. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/mowing_modes.py +1 -1
  6. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/mqtt/event.py +10 -7
  7. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/state_manager.py +5 -1
  8. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/event/event.py +6 -2
  9. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/navigation.py +19 -18
  10. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/devices/base.py +22 -8
  11. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/devices/mammotion.py +7 -0
  12. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/devices/mammotion_cloud.py +11 -10
  13. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mqtt/mammotion_mqtt.py +1 -1
  14. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_nav.py +24 -24
  15. {pymammotion-0.2.31 → pymammotion-0.2.32}/pyproject.toml +3 -3
  16. {pymammotion-0.2.31 → pymammotion-0.2.32}/LICENSE +0 -0
  17. {pymammotion-0.2.31 → pymammotion-0.2.32}/README.md +0 -0
  18. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/__init__.py +0 -0
  19. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/__init__.py +0 -0
  20. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/cloud_service.py +0 -0
  21. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/dataclass/aep_response.py +0 -0
  22. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/dataclass/connect_response.py +0 -0
  23. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/dataclass/dev_by_account_response.py +0 -0
  24. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/dataclass/login_by_oauth_response.py +0 -0
  25. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/dataclass/regions_response.py +0 -0
  26. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/dataclass/session_by_authcode_response.py +0 -0
  27. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/aliyun/tmp_constant.py +0 -0
  28. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/__init__.py +0 -0
  29. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/ble.py +0 -0
  30. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/ble_message.py +0 -0
  31. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/const.py +0 -0
  32. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/data/__init__.py +0 -0
  33. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/data/convert.py +0 -0
  34. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/data/framectrldata.py +0 -0
  35. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/bluetooth/data/notifydata.py +0 -0
  36. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/const.py +0 -0
  37. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/__init__.py +0 -0
  38. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/__init__.py +0 -0
  39. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/account.py +0 -0
  40. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/device.py +0 -0
  41. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/enums.py +0 -0
  42. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/excute_boarder_params.py +0 -0
  43. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/execute_boarder.py +0 -0
  44. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/generate_route_information.py +0 -0
  45. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/location.py +0 -0
  46. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/plan.py +0 -0
  47. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/rapid_state.py +0 -0
  48. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/region_data.py +0 -0
  49. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/model/report_info.py +0 -0
  50. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/mqtt/__init__.py +0 -0
  51. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/mqtt/properties.py +0 -0
  52. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/data/mqtt/status.py +0 -0
  53. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/event/__init__.py +0 -0
  54. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/http/_init_.py +0 -0
  55. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/http/http.py +0 -0
  56. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/http/model/http.py +0 -0
  57. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/__init__.py +0 -0
  58. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/__init__.py +0 -0
  59. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/abstract_message.py +0 -0
  60. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/mammotion_command.py +0 -0
  61. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/__init__.py +0 -0
  62. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/driver.py +0 -0
  63. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/media.py +0 -0
  64. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/network.py +0 -0
  65. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/ota.py +0 -0
  66. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/system.py +0 -0
  67. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/commands/messages/video.py +0 -0
  68. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/control/__init__.py +0 -0
  69. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/control/joystick.py +0 -0
  70. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/devices/__init__.py +0 -0
  71. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mammotion/devices/mammotion_bluetooth.py +0 -0
  72. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mqtt/__init__.py +0 -0
  73. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/mqtt/mammotion_future.py +0 -0
  74. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/__init__.py +0 -0
  75. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/basestation.proto +0 -0
  76. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/basestation.py +0 -0
  77. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/basestation_pb2.py +0 -0
  78. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/basestation_pb2.pyi +0 -0
  79. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/common.proto +0 -0
  80. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/common.py +0 -0
  81. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/common_pb2.py +0 -0
  82. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/common_pb2.pyi +0 -0
  83. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/dev_net.proto +0 -0
  84. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/dev_net.py +0 -0
  85. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/dev_net_pb2.py +0 -0
  86. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/dev_net_pb2.pyi +0 -0
  87. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_msg.proto +0 -0
  88. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_msg.py +0 -0
  89. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_msg_pb2.py +0 -0
  90. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_msg_pb2.pyi +0 -0
  91. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_mul.proto +0 -0
  92. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_mul.py +0 -0
  93. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_mul_pb2.py +0 -0
  94. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/luba_mul_pb2.pyi +0 -0
  95. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_driver.proto +0 -0
  96. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_driver.py +0 -0
  97. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_driver_pb2.py +0 -0
  98. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_driver_pb2.pyi +0 -0
  99. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_nav.proto +0 -0
  100. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_nav_pb2.py +0 -0
  101. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_nav_pb2.pyi +0 -0
  102. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_ota.proto +0 -0
  103. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_ota.py +0 -0
  104. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_ota_pb2.py +0 -0
  105. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_ota_pb2.pyi +0 -0
  106. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_pept.proto +0 -0
  107. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_pept.py +0 -0
  108. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_pept_pb2.py +0 -0
  109. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_pept_pb2.pyi +0 -0
  110. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_sys.proto +0 -0
  111. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_sys.py +0 -0
  112. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_sys_pb2.py +0 -0
  113. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/proto/mctrl_sys_pb2.pyi +0 -0
  114. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/py.typed +0 -0
  115. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/constant/__init__.py +0 -0
  116. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/constant/device_constant.py +0 -0
  117. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/conversions.py +0 -0
  118. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/datatype_converter.py +0 -0
  119. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/device_type.py +0 -0
  120. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/map.py +0 -0
  121. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/movement.py +0 -0
  122. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/periodic.py +0 -0
  123. {pymammotion-0.2.31 → pymammotion-0.2.32}/pymammotion/utility/rocker_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymammotion
3
- Version: 0.2.31
3
+ Version: 0.2.32
4
4
  Summary:
5
5
  License: GNU-3.0
6
6
  Author: Michael Arthur
@@ -593,6 +593,7 @@ class CloudIOTGateway:
593
593
  logger.debug(response.headers)
594
594
  logger.debug(response.status_code)
595
595
  logger.debug(response.body)
596
+ logger.debug(iot_id)
596
597
 
597
598
  response_body_str = response.body.decode("utf-8")
598
599
  response_body_dict = json.loads(response_body_str)
@@ -635,5 +636,5 @@ class CloudIOTGateway:
635
636
  return self._client_id
636
637
 
637
638
  @property
638
- def login_by_oath_response(self):
639
+ def login_by_oauth_response(self):
639
640
  return self._login_by_oauth_response
@@ -1,4 +1,4 @@
1
- from dataclasses import dataclass
1
+ from dataclasses import dataclass, field
2
2
 
3
3
  from pymammotion.utility.device_type import DeviceType
4
4
 
@@ -35,6 +35,7 @@ class OperationSettings:
35
35
  border_mode: int = 1 # border laps
36
36
  obstacle_laps: int = 1
37
37
  start_progress: int = 0
38
+ areas: list[int] = field(default_factory=list)
38
39
 
39
40
 
40
41
  def create_path_order(operation_mode: OperationSettings, device_name: str) -> str:
@@ -59,7 +60,7 @@ def create_path_order(operation_mode: OperationSettings, device_name: str) -> st
59
60
  bArr[6] = b
60
61
  if DeviceType.is_luba1(device_name):
61
62
  bArr[4] = operation_mode.toward_mode
62
- return str(bArr, "UTF-8")
63
+ return bArr.decode()
63
64
 
64
65
 
65
66
  def calculate_yuka_mode(operation_mode: OperationSettings) -> int:
@@ -1,7 +1,7 @@
1
- from dataclasses import dataclass
1
+ from dataclasses import dataclass, field
2
2
  from enum import IntEnum
3
3
 
4
- from pymammotion.proto.mctrl_nav import NavGetCommDataAck
4
+ from pymammotion.proto.mctrl_nav import NavGetCommDataAck, AreaHashName
5
5
 
6
6
 
7
7
  class PathType(IntEnum):
@@ -24,11 +24,11 @@ class HashList:
24
24
  [hashID, FrameList].
25
25
  hashlist for all our hashIDs for verification
26
26
  """
27
-
28
27
  area: dict # type 0
29
28
  path: dict # type 2
30
29
  obstacle: dict # type 1
31
30
  hashlist: list[int]
31
+ area_name: list[AreaHashName] = field(default_factory=list)
32
32
 
33
33
  def set_hashlist(self, hashlist: list[int]) -> None:
34
34
  self.hashlist = hashlist
@@ -49,6 +49,9 @@ class HashList:
49
49
  def update(self, hash_data: NavGetCommDataAck) -> bool:
50
50
  """Update the map data."""
51
51
  if hash_data.type == PathType.AREA:
52
+ existing_name = next((area for area in self.area_name if area.hash == hash_data.hash), None)
53
+ if not existing_name:
54
+ self.area_name.append(AreaHashName(name=f"area {len(self.area_name)+1}", hash=hash_data.hash))
52
55
  return self._add_hash_data(self.area, hash_data)
53
56
 
54
57
  if hash_data.type == PathType.OBSTACLE:
@@ -43,7 +43,7 @@ class BypassStrategy(IntEnum):
43
43
  direct_touch = 0
44
44
  slow_touch = 1
45
45
  less_touch = 2
46
- no_touch = 3 # luba 2 yuka only or possibly value of 10
46
+ no_touch = 10 # luba 2 yuka only or possibly value of 10
47
47
 
48
48
 
49
49
  class PathAngleSetting(IntEnum):
@@ -1,6 +1,7 @@
1
+ import base64
1
2
  from base64 import b64decode
2
3
  from dataclasses import dataclass
3
- from typing import Any, Literal, Optional, Union
4
+ from typing import Any, Literal, Optional, Union, Mapping
4
5
 
5
6
  from google.protobuf import json_format
6
7
  from mashumaro.mixins.orjson import DataClassORJSONMixin
@@ -36,7 +37,9 @@ class Base64EncodedProtobuf(SerializableType):
36
37
 
37
38
  @dataclass
38
39
  class DeviceProtobufMsgEventValue(DataClassORJSONMixin):
39
- content: Base64EncodedProtobuf
40
+ content: str
41
+
42
+
40
43
 
41
44
 
42
45
  @dataclass
@@ -61,7 +64,7 @@ class DeviceNotificationEventCode(DataClassORJSONMixin):
61
64
 
62
65
  @dataclass
63
66
  class DeviceNotificationEventValue(DataClassORJSONMixin):
64
- data: DeviceNotificationEventCode
67
+ data: str # parsed to DeviceNotificationEventCode
65
68
 
66
69
 
67
70
  @dataclass
@@ -147,15 +150,15 @@ class ThingEventMessage(DataClassORJSONMixin):
147
150
  identifier = params_dict.get("identifier")
148
151
  if identifier is None:
149
152
  """Request configuration event."""
150
- params_obj = DeviceConfigurationRequestEvent(**params_dict)
153
+ params_obj = DeviceConfigurationRequestEvent.from_dict(params_dict)
151
154
  elif identifier == "device_protobuf_msg_event":
152
- params_obj = DeviceProtobufMsgEventParams(**params_dict)
155
+ params_obj = DeviceProtobufMsgEventParams.from_dict(params_dict)
153
156
  elif identifier == "device_warning_event":
154
- params_obj = DeviceWarningEventParams(**params_dict)
157
+ params_obj = DeviceWarningEventParams.from_dict(params_dict)
155
158
  elif identifier == "device_config_req_event":
156
159
  params_obj = payload.get("params", {})
157
160
  elif identifier == "device_notification_event":
158
- params_obj = DeviceNotificationEventParams(**params_dict)
161
+ params_obj = DeviceNotificationEventParams.from_dict(params_dict)
159
162
  else:
160
163
  raise ValueError(f"Unknown identifier: {identifier} {params_dict}")
161
164
 
@@ -6,7 +6,7 @@ import betterproto
6
6
 
7
7
  from pymammotion.data.model.device import MowingDevice
8
8
  from pymammotion.proto.luba_msg import LubaMsg
9
- from pymammotion.proto.mctrl_nav import NavGetCommDataAck, NavGetHashListAck
9
+ from pymammotion.proto.mctrl_nav import NavGetCommDataAck, NavGetHashListAck, AppGetAllAreaHashName
10
10
 
11
11
 
12
12
  class StateManager:
@@ -62,6 +62,10 @@ class StateManager:
62
62
  updated = self._device.map.update(common_data)
63
63
  if updated:
64
64
  await self.get_commondata_ack_callback(common_data)
65
+ case "toapp_all_hash_name":
66
+ hash_names: AppGetAllAreaHashName = nav_msg[1]
67
+ self._device.map.area_name = hash_names.hashnames
68
+
65
69
 
66
70
  def _update_sys_data(self, message) -> None:
67
71
  """Update system."""
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ from typing import Any
2
3
 
3
4
 
4
5
  class Event:
@@ -54,9 +55,12 @@ class DataEvent:
54
55
  def __init__(self) -> None:
55
56
  self.on_data_event = Event()
56
57
 
57
- async def data_event(self, data) -> None:
58
+ async def data_event(self, data: Any) -> None:
58
59
  # This function will be executed when data is received.
59
- await self.on_data_event(data)
60
+ if data:
61
+ await self.on_data_event(data)
62
+ else:
63
+ await self.on_data_event(None)
60
64
 
61
65
  def add_subscribers(self, obj_method) -> None:
62
66
  self.on_data_event += obj_method
@@ -375,20 +375,21 @@ class MessageNavigation(AbstractMessage, ABC):
375
375
 
376
376
  def generate_route_information(self, generate_route_information: GenerateRouteInformation) -> bytes:
377
377
  logger.debug(f"Generate route data source:{generate_route_information}")
378
+
378
379
  build = NavReqCoverPath(
379
380
  pver=1,
380
381
  sub_cmd=0,
381
382
  zone_hashs=generate_route_information.one_hashs,
382
- job_mode=generate_route_information.job_mode,
383
- edge_mode=generate_route_information.edge_mode,
384
- knife_height=generate_route_information.blade_height,
385
- speed=generate_route_information.speed,
386
- ultra_wave=generate_route_information.ultra_wave,
387
- channel_width=generate_route_information.channel_width,
388
- channel_mode=generate_route_information.channel_mode,
389
- toward=generate_route_information.toward,
390
- toward_included_angle=generate_route_information.toward_included_angle, # luba 2 yuka only
391
- toward_mode=generate_route_information.toward_mode, # luba 2 yuka only
383
+ job_mode=int(generate_route_information.job_mode),
384
+ edge_mode=int(generate_route_information.edge_mode),
385
+ knife_height=int(generate_route_information.blade_height),
386
+ speed=float(generate_route_information.speed),
387
+ ultra_wave=int(generate_route_information.ultra_wave),
388
+ channel_width=int(generate_route_information.channel_width),
389
+ channel_mode=int(generate_route_information.channel_mode),
390
+ toward=int(generate_route_information.toward),
391
+ toward_included_angle=int(generate_route_information.toward_included_angle), # luba 2 yuka only
392
+ toward_mode=int(generate_route_information.toward_mode), # luba 2 yuka only
392
393
  reserved=generate_route_information.path_order,
393
394
  )
394
395
  logger.debug(f"{self.get_device_name()}Generate route====={build}")
@@ -402,14 +403,14 @@ class MessageNavigation(AbstractMessage, ABC):
402
403
  pver=1,
403
404
  sub_cmd=3,
404
405
  zone_hashs=generate_route_information.one_hashs,
405
- job_mode=generate_route_information.job_mode,
406
- edge_mode=generate_route_information.edge_mode,
407
- knife_height=generate_route_information.blade_height,
408
- speed=generate_route_information.speed,
409
- ultra_wave=generate_route_information.ultra_wave,
410
- channel_width=generate_route_information.channel_width,
411
- channel_mode=generate_route_information.channel_mode,
412
- toward=generate_route_information.toward,
406
+ job_mode=int(generate_route_information.job_mode),
407
+ edge_mode=int(generate_route_information.edge_mode),
408
+ knife_height=int(generate_route_information.blade_height),
409
+ speed=float(generate_route_information.speed),
410
+ ultra_wave=int(generate_route_information.ultra_wave),
411
+ channel_width=int(generate_route_information.channel_width),
412
+ channel_mode=int(generate_route_information.channel_mode),
413
+ toward=int(generate_route_information.toward),
413
414
  reserved=generate_route_information.path_order,
414
415
  )
415
416
  logger.debug(f"{self.get_device_name()} Generate route ===== {build}")
@@ -5,13 +5,14 @@ from typing import Any, Awaitable, Callable
5
5
 
6
6
  import betterproto
7
7
 
8
- from pymammotion.aliyun.dataclass.connect_response import Device
8
+ from pymammotion.aliyun.dataclass.dev_by_account_response import Device
9
9
  from pymammotion.data.model import RegionData
10
10
  from pymammotion.data.model.device import MowingDevice
11
11
  from pymammotion.data.state_manager import StateManager
12
12
  from pymammotion.proto import has_field
13
13
  from pymammotion.proto.luba_msg import LubaMsg
14
14
  from pymammotion.proto.mctrl_nav import NavGetCommDataAck, NavGetHashListAck
15
+ from pymammotion.utility.device_type import DeviceType
15
16
  from pymammotion.utility.movement import get_percent, transform_both_speeds
16
17
 
17
18
  _LOGGER = logging.getLogger(__name__)
@@ -197,17 +198,30 @@ class MammotionBaseDevice:
197
198
 
198
199
  async def start_map_sync(self) -> None:
199
200
  """Start sync of map data."""
201
+ try:
202
+ # work out why this crashes sometimes for better proto
203
+
204
+ if self._cloud_device:
205
+ if not DeviceType.is_luba1(self._cloud_device.deviceName, self._cloud_device.productKey):
206
+ await self.queue_command("get_area_name_list", device_id=self._cloud_device.deviceName)
207
+ if has_field(self._mower.net.toapp_wifi_iot_status):
208
+ if not DeviceType.is_luba1(self._mower.net.toapp_wifi_iot_status.devicename):
209
+ await self.queue_command("get_area_name_list",
210
+ device_id=self._mower.net.toapp_wifi_iot_status.devicename)
211
+ except Exception:
212
+ """Do nothing for now."""
213
+
200
214
  await self.queue_command("read_plan", sub_cmd=2, plan_index=0)
201
215
 
202
- await self.queue_command("get_all_boundary_hash_list", sub_cmd=0)
216
+ if not has_field(self.mower.nav.toapp_gethash_ack):
217
+ await self.queue_command("get_all_boundary_hash_list", sub_cmd=0)
218
+ await self.queue_command("get_hash_response", total_frame=1, current_frame=1)
219
+ else:
220
+ for data_hash in self.mower.nav.toapp_gethash_ack.data_couple:
221
+ await self.queue_command("synchronize_hash_data", hash_num=data_hash)
222
+
203
223
 
204
- await self.queue_command("get_hash_response", total_frame=1, current_frame=1)
205
224
 
206
- # work out why this crashes sometimes for better proto
207
- if self._cloud_device:
208
- await self.queue_command("get_area_name_list", device_id=self._cloud_device.deviceName)
209
- if has_field(self._mower.net.toapp_wifi_iot_status):
210
- await self.queue_command("get_area_name_list", device_id=self._mower.net.toapp_wifi_iot_status.devicename)
211
225
 
212
226
  # sub_cmd 3 is job hashes??
213
227
  # sub_cmd 4 is dump location (yuka)
@@ -75,6 +75,9 @@ class MammotionMixedDeviceManager:
75
75
  def replace_ble(self, ble_device: MammotionBaseBLEDevice) -> None:
76
76
  self._ble_device = ble_device
77
77
 
78
+ def replace_mqtt(self, mqtt: MammotionCloud) -> None:
79
+ self._cloud_device._mqtt = mqtt
80
+
78
81
  def has_cloud(self) -> bool:
79
82
  return self._cloud_device is not None
80
83
 
@@ -159,6 +162,10 @@ class Mammotion:
159
162
  self.devices.add_device(
160
163
  MammotionMixedDeviceManager(name=device.deviceName, cloud_device=device, mqtt=self.mqtt)
161
164
  )
165
+ elif device.deviceName.startswith(("Luba-", "Yuka-")) and self.devices.get_device(device.deviceName):
166
+ device = self.devices.get_device(device.deviceName)
167
+ device.replace_mqtt(self.mqtt)
168
+
162
169
 
163
170
  def set_disconnect_strategy(self, disconnect: bool) -> None:
164
171
  for device_name, device in self.devices.devices:
@@ -42,8 +42,10 @@ class MammotionCloud:
42
42
  # temporary for testing only
43
43
  # self._start_sync_task = self.loop.call_later(30, lambda: asyncio.ensure_future(self.start_sync(0)))
44
44
 
45
- def on_ready(self) -> None:
46
- self.on_ready_event.data_event(None)
45
+ async def on_ready(self) -> None:
46
+ loop = asyncio.get_event_loop()
47
+ loop.create_task(self.process_queue())
48
+ await self.on_ready_event.data_event(None)
47
49
 
48
50
  def is_connected(self) -> bool:
49
51
  return self._mqtt_client.is_connected
@@ -63,7 +65,7 @@ class MammotionCloud:
63
65
  async def on_disconnected(self) -> None:
64
66
  """Callback for when MQTT disconnects."""
65
67
 
66
- async def _process_queue(self) -> None:
68
+ async def process_queue(self) -> None:
67
69
  while True:
68
70
  # Get the next item from the queue
69
71
  iot_id, key, command, future = await self.command_queue.get()
@@ -113,7 +115,8 @@ class MammotionCloud:
113
115
  _LOGGER.debug("Thing event received")
114
116
  event = ThingEventMessage.from_dicts(payload)
115
117
  params = event.params
116
- if params.get("identifier", None) is None:
118
+ if isinstance(params, dict) or params.identifier is None:
119
+ _LOGGER.debug("Received dict params: %s", params)
117
120
  return
118
121
  if params.identifier == "device_protobuf_msg_event" and event.method == "thing.events":
119
122
  _LOGGER.debug("Protobuf event")
@@ -158,11 +161,8 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
158
161
 
159
162
  async def on_ready(self) -> None:
160
163
  """Callback for when MQTT is subscribed to events."""
161
- loop = asyncio.get_event_loop()
162
-
163
164
  await self._ble_sync()
164
165
  await self.run_periodic_sync_task()
165
- loop.create_task(self._process_queue())
166
166
  if self.on_ready_callback:
167
167
  await self.on_ready_callback()
168
168
 
@@ -186,6 +186,7 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
186
186
  160, lambda: asyncio.ensure_future(self.run_periodic_sync_task())
187
187
  )
188
188
 
189
+
189
190
  async def queue_command(self, key: str, **kwargs: Any) -> bytes:
190
191
  # Create a future to hold the result
191
192
  _LOGGER.debug("Queueing command: %s", key)
@@ -221,9 +222,9 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
221
222
  params = event.params
222
223
  if event.params.iotId != self.iot_id:
223
224
  return
224
- binary_data = base64.b64decode(params.value.content.proto)
225
- self._update_raw_data(cast(bytes, binary_data))
226
- new_msg = LubaMsg().parse(cast(bytes, binary_data))
225
+ binary_data = base64.b64decode(params.value.content)
226
+ self._update_raw_data(binary_data)
227
+ new_msg = LubaMsg().parse(binary_data)
227
228
 
228
229
  if (
229
230
  self._commands.get_device_product_key() == ""
@@ -175,7 +175,7 @@ class MammotionMQTT:
175
175
  event = ThingEventMessage(**payload)
176
176
  params = event.params
177
177
  if params.identifier == "device_protobuf_msg_event":
178
- content = LubaMsg().parse(base64.b64decode(params.value.content.proto))
178
+ content = LubaMsg().parse(base64.b64decode(params.value.content))
179
179
 
180
180
  logger.info("Unhandled protobuf event: %s", betterproto.which_one_of(content, "LubaSubMsg"))
181
181
  elif params.identifier == "device_warning_event":
@@ -142,7 +142,7 @@ class NavGetHashList(betterproto.Message):
142
142
  sub_cmd: int = betterproto.int32_field(2)
143
143
  total_frame: int = betterproto.int32_field(3)
144
144
  current_frame: int = betterproto.int32_field(4)
145
- data_hash: float = betterproto.fixed64_field(5)
145
+ data_hash: int = betterproto.fixed64_field(5)
146
146
  reserved: str = betterproto.string_field(6)
147
147
 
148
148
 
@@ -152,7 +152,7 @@ class NavGetHashListAck(betterproto.Message):
152
152
  sub_cmd: int = betterproto.int32_field(2)
153
153
  total_frame: int = betterproto.int32_field(3)
154
154
  current_frame: int = betterproto.int32_field(4)
155
- data_hash: float = betterproto.fixed64_field(5)
155
+ data_hash: int = betterproto.fixed64_field(5)
156
156
  hash_len: int = betterproto.int32_field(6)
157
157
  reserved: str = betterproto.string_field(7)
158
158
  result: int = betterproto.int32_field(8)
@@ -170,7 +170,7 @@ class NavGetCommData(betterproto.Message):
170
170
  paternal_hash_b: int = betterproto.int64_field(7)
171
171
  total_frame: int = betterproto.int32_field(8)
172
172
  current_frame: int = betterproto.int32_field(9)
173
- data_hash: float = betterproto.fixed64_field(10)
173
+ data_hash: int = betterproto.fixed64_field(10)
174
174
  reserved: str = betterproto.string_field(11)
175
175
 
176
176
 
@@ -181,12 +181,12 @@ class NavGetCommDataAck(betterproto.Message):
181
181
  result: int = betterproto.int32_field(3)
182
182
  action: int = betterproto.int32_field(4)
183
183
  type: int = betterproto.int32_field(5)
184
- hash: float = betterproto.fixed64_field(6)
185
- paternal_hash_a: float = betterproto.fixed64_field(7)
186
- paternal_hash_b: float = betterproto.fixed64_field(8)
184
+ hash: int = betterproto.fixed64_field(6)
185
+ paternal_hash_a: int = betterproto.fixed64_field(7)
186
+ paternal_hash_b: int = betterproto.fixed64_field(8)
187
187
  total_frame: int = betterproto.int32_field(9)
188
188
  current_frame: int = betterproto.int32_field(10)
189
- data_hash: float = betterproto.fixed64_field(11)
189
+ data_hash: int = betterproto.fixed64_field(11)
190
190
  data_len: int = betterproto.int32_field(12)
191
191
  data_couple: list["CommDataCouple"] = betterproto.message_field(13)
192
192
  reserved: str = betterproto.string_field(14)
@@ -206,8 +206,8 @@ class NavReqCoverPath(betterproto.Message):
206
206
  channel_mode: int = betterproto.int32_field(10)
207
207
  toward: int = betterproto.int32_field(11)
208
208
  speed: float = betterproto.float_field(12)
209
- zone_hashs: list[float] = betterproto.fixed64_field(13)
210
- path_hash: float = betterproto.fixed64_field(14)
209
+ zone_hashs: list[int] = betterproto.fixed64_field(13)
210
+ path_hash: int = betterproto.fixed64_field(14)
211
211
  reserved: str = betterproto.string_field(15)
212
212
  result: int = betterproto.int32_field(16)
213
213
  toward_mode: int = betterproto.int32_field(17)
@@ -226,12 +226,12 @@ class NavUploadZigZagResult(betterproto.Message):
226
226
  current_zone_path_num: int = betterproto.int32_field(8)
227
227
  current_zone_path_id: int = betterproto.int32_field(9)
228
228
  current_zone: int = betterproto.int32_field(10)
229
- current_hash: float = betterproto.fixed64_field(11)
229
+ current_hash: int = betterproto.fixed64_field(11)
230
230
  total_frame: int = betterproto.int32_field(12)
231
231
  current_frame: int = betterproto.int32_field(13)
232
232
  channel_mode: int = betterproto.int32_field(14)
233
233
  channel_mode_id: int = betterproto.int32_field(15)
234
- data_hash: float = betterproto.fixed64_field(16)
234
+ data_hash: int = betterproto.fixed64_field(16)
235
235
  data_len: int = betterproto.int32_field(17)
236
236
  reserved: str = betterproto.string_field(18)
237
237
  data_couple: list["CommDataCouple"] = betterproto.message_field(19)
@@ -242,10 +242,10 @@ class NavUploadZigZagResult(betterproto.Message):
242
242
  class NavUploadZigZagResultAck(betterproto.Message):
243
243
  pver: int = betterproto.int32_field(1)
244
244
  current_zone: int = betterproto.int32_field(2)
245
- current_hash: float = betterproto.fixed64_field(3)
245
+ current_hash: int = betterproto.fixed64_field(3)
246
246
  total_frame: int = betterproto.int32_field(4)
247
247
  current_frame: int = betterproto.int32_field(5)
248
- data_hash: float = betterproto.fixed64_field(6)
248
+ data_hash: int = betterproto.fixed64_field(6)
249
249
  reserved: str = betterproto.string_field(7)
250
250
  sub_cmd: int = betterproto.int32_field(8)
251
251
 
@@ -270,8 +270,8 @@ class NavTaskIdRw(betterproto.Message):
270
270
 
271
271
  @dataclass
272
272
  class NavSysHashOverview(betterproto.Message):
273
- commonhash_overview: float = betterproto.fixed64_field(1)
274
- path_hash_overview: float = betterproto.fixed64_field(2)
273
+ commonhash_overview: int = betterproto.fixed64_field(1)
274
+ path_hash_overview: int = betterproto.fixed64_field(2)
275
275
 
276
276
 
277
277
  @dataclass
@@ -281,7 +281,7 @@ class NavTaskBreakPoint(betterproto.Message):
281
281
  toward: int = betterproto.int32_field(3)
282
282
  flag: int = betterproto.int32_field(4)
283
283
  action: int = betterproto.int32_field(5)
284
- zone_hash: float = betterproto.fixed64_field(6)
284
+ zone_hash: int = betterproto.fixed64_field(6)
285
285
 
286
286
 
287
287
  @dataclass
@@ -314,13 +314,13 @@ class NavPlanJobSet(betterproto.Message):
314
314
  speed: float = betterproto.float_field(26)
315
315
  task_name: str = betterproto.string_field(27)
316
316
  job_name: str = betterproto.string_field(28)
317
- zone_hashs: list[float] = betterproto.fixed64_field(29)
317
+ zone_hashs: list[int] = betterproto.fixed64_field(29)
318
318
  reserved: str = betterproto.string_field(30)
319
319
  start_date: str = betterproto.string_field(31)
320
320
  end_date: str = betterproto.string_field(32)
321
321
  trigger_type: int = betterproto.int32_field(33)
322
322
  day: int = betterproto.int32_field(34)
323
- weeks: list[float] = betterproto.fixed32_field(35)
323
+ weeks: list[int] = betterproto.fixed32_field(35)
324
324
  remained_seconds: int = betterproto.int64_field(36)
325
325
  toward_mode: int = betterproto.int32_field(37)
326
326
  toward_included_angle: int = betterproto.int32_field(38)
@@ -388,19 +388,19 @@ class AppRequestCoverPathsT(betterproto.Message):
388
388
  sub_cmd: int = betterproto.int32_field(2)
389
389
  total_frame: int = betterproto.int32_field(3)
390
390
  current_frame: int = betterproto.int32_field(4)
391
- data_hash: float = betterproto.fixed64_field(5)
391
+ data_hash: int = betterproto.fixed64_field(5)
392
392
  transaction_id: int = betterproto.int64_field(6)
393
393
  reserved: list[int] = betterproto.int64_field(7)
394
- hash_list: list[float] = betterproto.fixed64_field(8)
394
+ hash_list: list[int] = betterproto.fixed64_field(8)
395
395
 
396
396
 
397
397
  @dataclass
398
398
  class CoverPathPacketT(betterproto.Message):
399
- path_hash: float = betterproto.fixed64_field(1)
399
+ path_hash: int = betterproto.fixed64_field(1)
400
400
  path_type: int = betterproto.int32_field(2)
401
401
  path_total: int = betterproto.int32_field(3)
402
402
  path_cur: int = betterproto.int32_field(4)
403
- zone_hash: float = betterproto.fixed64_field(5)
403
+ zone_hash: int = betterproto.fixed64_field(5)
404
404
  data_couple: list["CommDataCouple"] = betterproto.message_field(6)
405
405
 
406
406
 
@@ -415,7 +415,7 @@ class CoverPathUploadT(betterproto.Message):
415
415
  current_frame: int = betterproto.int32_field(7)
416
416
  total_path_num: int = betterproto.int32_field(8)
417
417
  vaild_path_num: int = betterproto.int32_field(9)
418
- data_hash: float = betterproto.fixed64_field(10)
418
+ data_hash: int = betterproto.fixed64_field(10)
419
419
  transaction_id: int = betterproto.int64_field(11)
420
420
  reserved: list[int] = betterproto.int64_field(12)
421
421
  data_len: int = betterproto.int32_field(13)
@@ -424,7 +424,7 @@ class CoverPathUploadT(betterproto.Message):
424
424
 
425
425
  @dataclass
426
426
  class ZoneStartPrecentT(betterproto.Message):
427
- data_hash: float = betterproto.fixed64_field(1)
427
+ data_hash: int = betterproto.fixed64_field(1)
428
428
  x: float = betterproto.float_field(2)
429
429
  y: float = betterproto.float_field(3)
430
430
  index: int = betterproto.int32_field(4)
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "pymammotion"
3
- version = "0.2.31"
3
+ version = "0.2.32"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "pymammotion"
7
- version = "0.2.31"
7
+ version = "0.2.32"
8
8
  license = "GNU-3.0"
9
9
  description = ""
10
10
  readme = "README.md"
@@ -55,7 +55,7 @@ mypy = "^1.10.0"
55
55
  pre-commit = "^3.8.0"
56
56
 
57
57
  [tool.bumpver]
58
- current_version = "0.2.31"
58
+ current_version = "0.2.32"
59
59
  version_pattern = "MAJOR.MINOR.PATCH"
60
60
  commit_message = "Bump version {old_version} -> {new_version}"
61
61
  commit = true
File without changes
File without changes