pymammotion 0.5.17__tar.gz → 0.5.19__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.

Potentially problematic release.


This version of pymammotion might be problematic. Click here for more details.

Files changed (135) hide show
  1. {pymammotion-0.5.17 → pymammotion-0.5.19}/PKG-INFO +2 -2
  2. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/device.py +2 -2
  3. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/state_manager.py +19 -17
  4. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/devices/base.py +21 -22
  5. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/devices/mammotion_bluetooth.py +2 -2
  6. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/devices/mammotion_cloud.py +8 -6
  7. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mqtt/mammotion_mqtt.py +3 -6
  8. pymammotion-0.5.19/pymammotion/proto/__init__.py +4841 -0
  9. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_driver_pb2.py +1 -1
  10. {pymammotion-0.5.17 → pymammotion-0.5.19}/pyproject.toml +4 -4
  11. pymammotion-0.5.17/pymammotion/proto/__init__.py +0 -2224
  12. {pymammotion-0.5.17 → pymammotion-0.5.19}/LICENSE +0 -0
  13. {pymammotion-0.5.17 → pymammotion-0.5.19}/README.md +0 -0
  14. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/__init__.py +0 -0
  15. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/__init__.py +0 -0
  16. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/client.py +0 -0
  17. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/cloud_gateway.py +0 -0
  18. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/model/aep_response.py +0 -0
  19. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/model/connect_response.py +0 -0
  20. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/model/dev_by_account_response.py +0 -0
  21. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/model/login_by_oauth_response.py +0 -0
  22. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/model/regions_response.py +0 -0
  23. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/model/session_by_authcode_response.py +0 -0
  24. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/model/thing_response.py +0 -0
  25. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/regions.py +0 -0
  26. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/tea/core.py +0 -0
  27. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/aliyun/tmp_constant.py +0 -0
  28. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/__init__.py +0 -0
  29. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/ble.py +0 -0
  30. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/ble_message.py +0 -0
  31. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/const.py +0 -0
  32. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/data/__init__.py +0 -0
  33. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/data/convert.py +0 -0
  34. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/data/framectrldata.py +0 -0
  35. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/data/notifydata.py +0 -0
  36. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/model/__init__.py +0 -0
  37. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/bluetooth/model/atomic_integer.py +0 -0
  38. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/const.py +0 -0
  39. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/__init__.py +0 -0
  40. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/__init__.py +0 -0
  41. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/account.py +0 -0
  42. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/device_config.py +0 -0
  43. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/device_info.py +0 -0
  44. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/device_limits.py +0 -0
  45. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/enums.py +0 -0
  46. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/errors.py +0 -0
  47. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/excute_boarder_params.py +0 -0
  48. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/execute_boarder.py +0 -0
  49. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/generate_route_information.py +0 -0
  50. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/hash_list.py +0 -0
  51. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/location.py +0 -0
  52. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/mowing_modes.py +0 -0
  53. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/rapid_state.py +0 -0
  54. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/raw_data.py +0 -0
  55. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/region_data.py +0 -0
  56. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/report_info.py +0 -0
  57. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/model/work.py +0 -0
  58. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/mqtt/__init__.py +0 -0
  59. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/mqtt/event.py +0 -0
  60. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/mqtt/properties.py +0 -0
  61. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/data/mqtt/status.py +0 -0
  62. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/event/__init__.py +0 -0
  63. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/event/event.py +0 -0
  64. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/__init__.py +0 -0
  65. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/_init_.py +0 -0
  66. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/encryption.py +0 -0
  67. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/http.py +0 -0
  68. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/model/__init__.py +0 -0
  69. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/model/camera_stream.py +0 -0
  70. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/model/http.py +0 -0
  71. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/model/response_factory.py +0 -0
  72. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/http/model/rtk.py +0 -0
  73. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/__init__.py +0 -0
  74. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/__init__.py +0 -0
  75. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/abstract_message.py +0 -0
  76. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/mammotion_command.py +0 -0
  77. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/__init__.py +0 -0
  78. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/basestation.py +0 -0
  79. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/driver.py +0 -0
  80. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/media.py +0 -0
  81. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/navigation.py +0 -0
  82. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/network.py +0 -0
  83. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/ota.py +0 -0
  84. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/system.py +0 -0
  85. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/video.py +0 -0
  86. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/control/__init__.py +0 -0
  87. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/control/joystick.py +0 -0
  88. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/devices/__init__.py +0 -0
  89. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mammotion/devices/mammotion.py +0 -0
  90. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mqtt/__init__.py +0 -0
  91. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mqtt/linkkit/__init__.py +0 -0
  92. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mqtt/linkkit/h2client.py +0 -0
  93. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mqtt/linkkit/linkkit.py +0 -0
  94. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/mqtt/mammotion_future.py +0 -0
  95. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/basestation.proto +0 -0
  96. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/basestation_pb2.py +0 -0
  97. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/basestation_pb2.pyi +0 -0
  98. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/common.proto +0 -0
  99. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/common_pb2.py +0 -0
  100. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/common_pb2.pyi +0 -0
  101. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/dev_net.proto +0 -0
  102. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/dev_net_pb2.py +0 -0
  103. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/dev_net_pb2.pyi +0 -0
  104. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/luba_msg.proto +0 -0
  105. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/luba_msg_pb2.py +0 -0
  106. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/luba_msg_pb2.pyi +0 -0
  107. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/luba_mul.proto +0 -0
  108. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/luba_mul_pb2.py +0 -0
  109. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/luba_mul_pb2.pyi +0 -0
  110. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_driver.proto +0 -0
  111. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_driver_pb2.pyi +0 -0
  112. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_nav.proto +0 -0
  113. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_nav_pb2.py +0 -0
  114. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_nav_pb2.pyi +0 -0
  115. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_ota.proto +0 -0
  116. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_ota_pb2.py +0 -0
  117. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_ota_pb2.pyi +0 -0
  118. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_pept.proto +0 -0
  119. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_pept_pb2.py +0 -0
  120. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_pept_pb2.pyi +0 -0
  121. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_sys.proto +0 -0
  122. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_sys_pb2.py +0 -0
  123. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/proto/mctrl_sys_pb2.pyi +0 -0
  124. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/py.typed +0 -0
  125. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/constant/__init__.py +0 -0
  126. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/constant/device_constant.py +0 -0
  127. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/conversions.py +0 -0
  128. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/datatype_converter.py +0 -0
  129. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/device_config.py +0 -0
  130. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/device_type.py +0 -0
  131. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/map.py +0 -0
  132. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/movement.py +0 -0
  133. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/mur_mur_hash.py +0 -0
  134. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/periodic.py +0 -0
  135. {pymammotion-0.5.17 → pymammotion-0.5.19}/pymammotion/utility/rocker_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymammotion
3
- Version: 0.5.17
3
+ Version: 0.5.19
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: Michael Arthur
@@ -16,7 +16,7 @@ Requires-Dist: alibabacloud-apigateway-util (>=0.0.2,<0.0.3)
16
16
  Requires-Dist: alibabacloud-iot-api-gateway (>=0.0.4,<0.0.5)
17
17
  Requires-Dist: alicloud-gateway-iot (>=1.0.0,<2.0.0)
18
18
  Requires-Dist: async-timeout (>=4.0.3,<5.0.0)
19
- Requires-Dist: betterproto (>=1.2.5,<2.0.0)
19
+ Requires-Dist: betterproto2 (>=0.8.0,<0.9.0)
20
20
  Requires-Dist: bleak (>=0.21.0)
21
21
  Requires-Dist: bleak-retry-connector (>=3.5.0)
22
22
  Requires-Dist: crcmod (>=1.7,<2.0)
@@ -2,7 +2,7 @@
2
2
 
3
3
  from dataclasses import dataclass, field
4
4
 
5
- import betterproto
5
+ import betterproto2
6
6
  from mashumaro.mixins.orjson import DataClassORJSONMixin
7
7
 
8
8
  from pymammotion.data.model import HashList, RapidState
@@ -110,7 +110,7 @@ class MowingDevice(DataClassORJSONMixin):
110
110
  if toapp_report_data.fw_info:
111
111
  self.update_device_firmwares(toapp_report_data.fw_info)
112
112
 
113
- self.report_data.update(toapp_report_data.to_dict(casing=betterproto.Casing.SNAKE))
113
+ self.report_data.update(toapp_report_data.to_dict(casing=betterproto2.Casing.SNAKE))
114
114
 
115
115
  def run_state_update(self, rapid_state: SystemRapidStateTunnelMsg) -> None:
116
116
  """Set lat long, work zone of RTK and robot."""
@@ -1,11 +1,10 @@
1
1
  """Manage state from notifications into MowingDevice."""
2
2
 
3
- from collections.abc import Awaitable, Callable
4
3
  from datetime import UTC, datetime
5
4
  import logging
6
- from typing import Any
5
+ from typing import Any, Awaitable, Callable
7
6
 
8
- import betterproto
7
+ import betterproto2
9
8
 
10
9
  from pymammotion.data.model.device import MowingDevice
11
10
  from pymammotion.data.model.device_info import SideLight
@@ -22,6 +21,7 @@ from pymammotion.proto import (
22
21
  DeviceProductTypeInfoT,
23
22
  DrvDevInfoResp,
24
23
  DrvDevInfoResult,
24
+ Getlamprsp,
25
25
  GetNetworkInfoRsp,
26
26
  LubaMsg,
27
27
  NavGetCommDataAck,
@@ -32,7 +32,7 @@ from pymammotion.proto import (
32
32
  NavUnableTimeSet,
33
33
  SvgMessageAckT,
34
34
  TimeCtrlLight,
35
- WifiIotStatusReport, Getlamprsp,
35
+ WifiIotStatusReport,
36
36
  )
37
37
 
38
38
  logger = logging.getLogger(__name__)
@@ -141,7 +141,7 @@ class StateManager:
141
141
 
142
142
  async def notification(self, message: LubaMsg) -> None:
143
143
  """Handle protobuf notifications."""
144
- res = betterproto.which_one_of(message, "LubaSubMsg")
144
+ res = betterproto2.which_one_of(message, "LubaSubMsg")
145
145
  self.last_updated_at = datetime.now(UTC)
146
146
  # additional catch all if we don't get a status update
147
147
  if not self._device.online:
@@ -165,30 +165,30 @@ class StateManager:
165
165
 
166
166
  async def _update_nav_data(self, message) -> None:
167
167
  """Update nav data."""
168
- nav_msg = betterproto.which_one_of(message.nav, "SubNavMsg")
168
+ nav_msg = betterproto2.which_one_of(message.nav, "SubNavMsg")
169
169
  match nav_msg[0]:
170
170
  case "toapp_gethash_ack":
171
171
  hashlist_ack: NavGetHashListAck = nav_msg[1]
172
172
  self._device.map.update_root_hash_list(
173
- NavGetHashListData.from_dict(hashlist_ack.to_dict(casing=betterproto.Casing.SNAKE))
173
+ NavGetHashListData.from_dict(hashlist_ack.to_dict(casing=betterproto2.Casing.SNAKE))
174
174
  )
175
175
  await self.gethash_ack_callback(nav_msg[1])
176
176
  case "toapp_get_commondata_ack":
177
177
  common_data: NavGetCommDataAck = nav_msg[1]
178
178
  updated = self._device.map.update(
179
- NavGetCommData.from_dict(common_data.to_dict(casing=betterproto.Casing.SNAKE))
179
+ NavGetCommData.from_dict(common_data.to_dict(casing=betterproto2.Casing.SNAKE))
180
180
  )
181
181
  if updated:
182
182
  await self.get_commondata_ack_callback(common_data)
183
183
  case "todev_planjob_set":
184
184
  planjob: NavPlanJobSet = nav_msg[1]
185
- self._device.map.update_plan(Plan.from_dict(planjob.to_dict(casing=betterproto.Casing.SNAKE)))
185
+ self._device.map.update_plan(Plan.from_dict(planjob.to_dict(casing=betterproto2.Casing.SNAKE)))
186
186
  await self.get_plan_callback(planjob)
187
187
 
188
188
  case "toapp_svg_msg":
189
189
  common_svg_data: SvgMessageAckT = nav_msg[1]
190
190
  updated = self._device.map.update(
191
- SvgMessage.from_dict(common_svg_data.to_dict(casing=betterproto.Casing.SNAKE))
191
+ SvgMessage.from_dict(common_svg_data.to_dict(casing=betterproto2.Casing.SNAKE))
192
192
  )
193
193
  if updated:
194
194
  await self.get_commondata_ack_callback(common_svg_data)
@@ -201,7 +201,7 @@ class StateManager:
201
201
  case "bidire_reqconver_path":
202
202
  work_settings: NavReqCoverPath = nav_msg[1]
203
203
  self._device.work = CurrentTaskSettings.from_dict(
204
- work_settings.to_dict(casing=betterproto.Casing.SNAKE)
204
+ work_settings.to_dict(casing=betterproto2.Casing.SNAKE)
205
205
  )
206
206
  case "nav_sys_param_cmd":
207
207
  settings: NavSysParamMsg = nav_msg[1]
@@ -219,7 +219,7 @@ class StateManager:
219
219
 
220
220
  def _update_sys_data(self, message) -> None:
221
221
  """Update system."""
222
- sys_msg = betterproto.which_one_of(message.sys, "SubSysMsg")
222
+ sys_msg = betterproto2.which_one_of(message.sys, "SubSysMsg")
223
223
  match sys_msg[0]:
224
224
  case "system_update_buf":
225
225
  self._device.buffer(sys_msg[1])
@@ -231,7 +231,7 @@ class StateManager:
231
231
  self._device.run_state_update(sys_msg[1])
232
232
  case "todev_time_ctrl_light":
233
233
  ctrl_light: TimeCtrlLight = sys_msg[1]
234
- side_led: SideLight = SideLight.from_dict(ctrl_light.to_dict(casing=betterproto.Casing.SNAKE))
234
+ side_led: SideLight = SideLight.from_dict(ctrl_light.to_dict(casing=betterproto2.Casing.SNAKE))
235
235
  self._device.mower_state.side_led = side_led
236
236
  case "device_product_type_info":
237
237
  device_product_type: DeviceProductTypeInfoT = sys_msg[1]
@@ -247,7 +247,7 @@ class StateManager:
247
247
  pass
248
248
 
249
249
  def _update_net_data(self, message) -> None:
250
- net_msg = betterproto.which_one_of(message.net, "NetSubType")
250
+ net_msg = betterproto2.which_one_of(message.net, "NetSubType")
251
251
  match net_msg[0]:
252
252
  case "toapp_wifi_iot_status":
253
253
  wifi_iot_status: WifiIotStatusReport = net_msg[1]
@@ -264,13 +264,15 @@ class StateManager:
264
264
 
265
265
  def _update_mul_data(self, message) -> None:
266
266
  """Media and video states."""
267
- mul_msg = betterproto.which_one_of(message.net, "SubMul")
267
+ mul_msg = betterproto2.which_one_of(message.net, "SubMul")
268
268
  match mul_msg[0]:
269
269
  case "Getlamprsp":
270
270
  lamp_resp: Getlamprsp = mul_msg[1]
271
271
  self._device.mower_state.lamp_info.lamp_bright = lamp_resp.lamp_bright
272
- self._device.mower_state.lamp_info.night_light = True if lamp_resp.lamp_ctrl.value > 0 else False
273
- self._device.mower_state.lamp_info.manual_light = True if lamp_resp.lamp_manual_ctrl.value > 0 else False
272
+ if lamp_resp.get_ids == 1126:
273
+ self._device.mower_state.lamp_info.manual_light = bool(lamp_resp.lamp_manual_ctrl.value)
274
+ if lamp_resp.get_ids == 1123:
275
+ self._device.mower_state.lamp_info.night_light = bool(lamp_resp.lamp_ctrl.value)
274
276
 
275
277
  def _update_ota_data(self, message) -> None:
276
278
  pass
@@ -1,11 +1,10 @@
1
1
  from abc import abstractmethod
2
2
  import asyncio
3
- import datetime
4
3
  import logging
5
4
  import time
6
5
  from typing import Any
7
6
 
8
- import betterproto
7
+ import betterproto2
9
8
 
10
9
  from pymammotion.aliyun.model.dev_by_account_response import Device
11
10
  from pymammotion.data.model import RegionData
@@ -44,7 +43,7 @@ class MammotionBaseDevice:
44
43
  self._raw_mower_data: RawMowerData = RawMowerData()
45
44
  self._notify_future: asyncio.Future[bytes] | None = None
46
45
  self._cloud_device = cloud_device
47
- self.command_sent_time: datetime = time.time()
46
+ self.command_sent_time: float = time.time()
48
47
 
49
48
  async def datahash_response(self, hash_ack: NavGetHashListAck) -> None:
50
49
  """Handle datahash responses for root level hashs."""
@@ -100,7 +99,7 @@ class MammotionBaseDevice:
100
99
  def _update_raw_data(self, data: bytes) -> None:
101
100
  """Update raw and model data from notifications."""
102
101
  tmp_msg = LubaMsg().parse(data)
103
- res = betterproto.which_one_of(tmp_msg, "LubaSubMsg")
102
+ res = betterproto2.which_one_of(tmp_msg, "LubaSubMsg")
104
103
  match res[0]:
105
104
  case "nav":
106
105
  self._update_nav_data(tmp_msg)
@@ -119,7 +118,7 @@ class MammotionBaseDevice:
119
118
 
120
119
  def _update_nav_data(self, tmp_msg) -> None:
121
120
  """Update navigation data."""
122
- nav_sub_msg = betterproto.which_one_of(tmp_msg.nav, "SubNavMsg")
121
+ nav_sub_msg = betterproto2.which_one_of(tmp_msg.nav, "SubNavMsg")
123
122
  if nav_sub_msg[1] is None:
124
123
  _LOGGER.debug("Sub message was NoneType %s", nav_sub_msg[0])
125
124
  return
@@ -127,32 +126,32 @@ class MammotionBaseDevice:
127
126
  if isinstance(nav_sub_msg[1], int):
128
127
  nav[nav_sub_msg[0]] = nav_sub_msg[1]
129
128
  else:
130
- nav[nav_sub_msg[0]] = nav_sub_msg[1].to_dict(casing=betterproto.Casing.SNAKE)
129
+ nav[nav_sub_msg[0]] = nav_sub_msg[1].to_dict(casing=betterproto2.Casing.SNAKE)
131
130
  self._raw_data["nav"] = nav
132
131
 
133
132
  def _update_sys_data(self, tmp_msg) -> None:
134
133
  """Update system data."""
135
- sys_sub_msg = betterproto.which_one_of(tmp_msg.sys, "SubSysMsg")
134
+ sys_sub_msg = betterproto2.which_one_of(tmp_msg.sys, "SubSysMsg")
136
135
  if sys_sub_msg[1] is None:
137
136
  _LOGGER.debug("Sub message was NoneType %s", sys_sub_msg[0])
138
137
  return
139
138
  sys = self._raw_data.get("sys", {})
140
- sys[sys_sub_msg[0]] = sys_sub_msg[1].to_dict(casing=betterproto.Casing.SNAKE)
139
+ sys[sys_sub_msg[0]] = sys_sub_msg[1].to_dict(casing=betterproto2.Casing.SNAKE)
141
140
  self._raw_data["sys"] = sys
142
141
 
143
142
  def _update_driver_data(self, tmp_msg) -> None:
144
143
  """Update driver data."""
145
- drv_sub_msg = betterproto.which_one_of(tmp_msg.driver, "SubDrvMsg")
144
+ drv_sub_msg = betterproto2.which_one_of(tmp_msg.driver, "SubDrvMsg")
146
145
  if drv_sub_msg[1] is None:
147
146
  _LOGGER.debug("Sub message was NoneType %s", drv_sub_msg[0])
148
147
  return
149
148
  drv = self._raw_data.get("driver", {})
150
- drv[drv_sub_msg[0]] = drv_sub_msg[1].to_dict(casing=betterproto.Casing.SNAKE)
149
+ drv[drv_sub_msg[0]] = drv_sub_msg[1].to_dict(casing=betterproto2.Casing.SNAKE)
151
150
  self._raw_data["driver"] = drv
152
151
 
153
152
  def _update_net_data(self, tmp_msg) -> None:
154
153
  """Update network data."""
155
- net_sub_msg = betterproto.which_one_of(tmp_msg.net, "NetSubType")
154
+ net_sub_msg = betterproto2.which_one_of(tmp_msg.net, "NetSubType")
156
155
  if net_sub_msg[1] is None:
157
156
  _LOGGER.debug("Sub message was NoneType %s", net_sub_msg[0])
158
157
  return
@@ -160,27 +159,27 @@ class MammotionBaseDevice:
160
159
  if isinstance(net_sub_msg[1], int):
161
160
  net[net_sub_msg[0]] = net_sub_msg[1]
162
161
  else:
163
- net[net_sub_msg[0]] = net_sub_msg[1].to_dict(casing=betterproto.Casing.SNAKE)
162
+ net[net_sub_msg[0]] = net_sub_msg[1].to_dict(casing=betterproto2.Casing.SNAKE)
164
163
  self._raw_data["net"] = net
165
164
 
166
165
  def _update_mul_data(self, tmp_msg) -> None:
167
166
  """Update mul data."""
168
- mul_sub_msg = betterproto.which_one_of(tmp_msg.mul, "SubMul")
167
+ mul_sub_msg = betterproto2.which_one_of(tmp_msg.mul, "SubMul")
169
168
  if mul_sub_msg[1] is None:
170
169
  _LOGGER.debug("Sub message was NoneType %s", mul_sub_msg[0])
171
170
  return
172
171
  mul = self._raw_data.get("mul", {})
173
- mul[mul_sub_msg[0]] = mul_sub_msg[1].to_dict(casing=betterproto.Casing.SNAKE)
172
+ mul[mul_sub_msg[0]] = mul_sub_msg[1].to_dict(casing=betterproto2.Casing.SNAKE)
174
173
  self._raw_data["mul"] = mul
175
174
 
176
175
  def _update_ota_data(self, tmp_msg) -> None:
177
176
  """Update OTA data."""
178
- ota_sub_msg = betterproto.which_one_of(tmp_msg.ota, "SubOtaMsg")
177
+ ota_sub_msg = betterproto2.which_one_of(tmp_msg.ota, "SubOtaMsg")
179
178
  if ota_sub_msg[1] is None:
180
179
  _LOGGER.debug("Sub message was NoneType %s", ota_sub_msg[0])
181
180
  return
182
181
  ota = self._raw_data.get("ota", {})
183
- ota[ota_sub_msg[0]] = ota_sub_msg[1].to_dict(casing=betterproto.Casing.SNAKE)
182
+ ota[ota_sub_msg[0]] = ota_sub_msg[1].to_dict(casing=betterproto2.Casing.SNAKE)
184
183
  self._raw_data["ota"] = ota
185
184
 
186
185
  @property
@@ -229,20 +228,20 @@ class MammotionBaseDevice:
229
228
  ):
230
229
  await self.queue_command("read_plan", sub_cmd=2, plan_index=0)
231
230
 
232
- for hash, frame in list(self.mower.map.area.items()):
231
+ for hash_id, frame in list(self.mower.map.area.items()):
233
232
  missing_frames = self.mower.map.find_missing_frames(frame)
234
233
  if len(missing_frames) > 0:
235
- del self.mower.map.area[hash]
234
+ del self.mower.map.area[hash_id]
236
235
 
237
- for hash, frame in list(self.mower.map.path.items()):
236
+ for hash_id, frame in list(self.mower.map.path.items()):
238
237
  missing_frames = self.mower.map.find_missing_frames(frame)
239
238
  if len(missing_frames) > 0:
240
- del self.mower.map.path[hash]
239
+ del self.mower.map.path[hash_id]
241
240
 
242
- for hash, frame in list(self.mower.map.obstacle.items()):
241
+ for hash_id, frame in list(self.mower.map.obstacle.items()):
243
242
  missing_frames = self.mower.map.find_missing_frames(frame)
244
243
  if len(missing_frames) > 0:
245
- del self.mower.map.obstacle[hash]
244
+ del self.mower.map.obstacle[hash_id]
246
245
 
247
246
  # don't know why but total frame on svg is wrong
248
247
  # for hash, frame in self.mower.map.svg.items():
@@ -5,7 +5,7 @@ import time
5
5
  from typing import Any
6
6
  from uuid import UUID
7
7
 
8
- import betterproto
8
+ import betterproto2
9
9
  from bleak import BleakGATTCharacteristic, BleakGATTServiceCollection, BLEDevice
10
10
  from bleak.exc import BleakDBusError
11
11
  from bleak_retry_connector import (
@@ -356,7 +356,7 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
356
356
  return
357
357
 
358
358
  new_msg = LubaMsg().parse(data)
359
- res = betterproto.which_one_of(new_msg, "LubaSubMsg")
359
+ res = betterproto2.which_one_of(new_msg, "LubaSubMsg")
360
360
  if res[0] == "net":
361
361
  if new_msg.net.todev_ble_sync != 0 or has_field(new_msg.net.toapp_wifi_iot_status):
362
362
  if has_field(new_msg.net.toapp_wifi_iot_status) and self._commands.get_device_product_key() == "":
@@ -8,7 +8,7 @@ import logging
8
8
  import time
9
9
  from typing import Any
10
10
 
11
- import betterproto
11
+ import betterproto2
12
12
  from Tea.exceptions import UnretryableException
13
13
 
14
14
  from pymammotion import CloudIOTGateway, MammotionMQTT
@@ -118,14 +118,15 @@ class MammotionCloud:
118
118
 
119
119
  async def _parse_mqtt_response(self, topic: str, payload: dict) -> None:
120
120
  """Parse and handle MQTT responses based on the topic.
121
-
121
+
122
122
  This function processes different types of MQTT messages received from various
123
123
  topics. It logs debug information and calls appropriate callback methods for
124
124
  each event type.
125
-
125
+
126
126
  Args:
127
127
  topic (str): The MQTT topic from which the message was received.
128
128
  payload (dict): The payload data of the MQTT message.
129
+
129
130
  """
130
131
  if topic.endswith("/app/down/thing/events"):
131
132
  _LOGGER.debug("Thing event received")
@@ -340,15 +341,16 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
340
341
 
341
342
  async def _parse_message_for_device(self, event: ThingEventMessage) -> None:
342
343
  """Parses a message received from a device and updates internal state.
343
-
344
+
344
345
  This function processes an incoming `ThingEventMessage`, checks if the message
345
346
  is intended for this device, decodes the binary data, and updates raw data. It
346
347
  then attempts to parse the binary data into a `LubaMsg`. If parsing fails, it
347
348
  logs the exception. The function also handles setting the device product key if
348
349
  not already set and processes specific sub-messages based on their types.
349
-
350
+
350
351
  Args:
351
352
  event (ThingEventMessage): The event message received from the device.
353
+
352
354
  """
353
355
  params = event.params
354
356
  new_msg = LubaMsg()
@@ -367,7 +369,7 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
367
369
  ):
368
370
  self._commands.set_device_product_key(event.params.productKey)
369
371
 
370
- res = betterproto.which_one_of(new_msg, "LubaSubMsg")
372
+ res = betterproto2.which_one_of(new_msg, "LubaSubMsg")
371
373
  if res[0] == "net":
372
374
  if new_msg.net.todev_ble_sync != 0 or has_field(new_msg.net.toapp_wifi_iot_status):
373
375
  return
@@ -2,14 +2,14 @@
2
2
 
3
3
  import asyncio
4
4
  import base64
5
- from collections.abc import Awaitable, Callable
5
+ from typing import Awaitable, Callable
6
6
  import hashlib
7
7
  import hmac
8
8
  import json
9
9
  import logging
10
10
  from logging import getLogger
11
11
 
12
- import betterproto
12
+ import betterproto2
13
13
  from paho.mqtt.client import MQTTMessage
14
14
 
15
15
  from pymammotion.aliyun.cloud_gateway import CloudIOTGateway
@@ -138,7 +138,6 @@ class MammotionMQTT:
138
138
  self.is_ready = True
139
139
  future = asyncio.run_coroutine_threadsafe(self.on_ready(), self.loop)
140
140
  asyncio.wrap_future(future, loop=self.loop)
141
- # self._linkkit_client.query_ota_firmware()
142
141
 
143
142
  def unsubscribe(self) -> None:
144
143
  self._linkkit_client.unsubscribe_topic(
@@ -188,8 +187,6 @@ class MammotionMQTT:
188
187
 
189
188
  logger.debug("on_connect, session_flag:%d, rc:%d", session_flag, rc)
190
189
 
191
- # self._linkkit_client.subscribe_topic(f"/sys/{self._product_key}/{self._device_name}/#")
192
-
193
190
  def _on_disconnect(self, _client, _userdata) -> None:
194
191
  """Is called on disconnect."""
195
192
  if self._linkkit_client.check_state() is LinkKit.LinkKitState.DISCONNECTED:
@@ -211,7 +208,7 @@ class MammotionMQTT:
211
208
  if params.identifier == "device_protobuf_msg_event":
212
209
  content = LubaMsg().parse(base64.b64decode(params.value.content))
213
210
 
214
- logger.info("Unhandled protobuf event: %s", betterproto.which_one_of(content, "LubaSubMsg"))
211
+ logger.info("Unhandled protobuf event: %s", betterproto2.which_one_of(content, "LubaSubMsg"))
215
212
  elif params.identifier == "device_warning_event":
216
213
  logger.debug("identifier event: %s", params.identifier)
217
214
  else: