pymammotion 0.5.14__tar.gz → 0.5.16__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 (134) hide show
  1. {pymammotion-0.5.14 → pymammotion-0.5.16}/PKG-INFO +1 -1
  2. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/cloud_gateway.py +45 -1
  3. pymammotion-0.5.16/pymammotion/aliyun/model/thing_response.py +12 -0
  4. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/device.py +17 -0
  5. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/mqtt/status.py +1 -1
  6. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/http.py +24 -7
  7. pymammotion-0.5.16/pymammotion/http/model/rtk.py +16 -0
  8. pymammotion-0.5.16/pymammotion/mammotion/commands/messages/basestation.py +43 -0
  9. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/media.py +1 -1
  10. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/__init__.py +1 -0
  11. {pymammotion-0.5.14 → pymammotion-0.5.16}/pyproject.toml +2 -2
  12. {pymammotion-0.5.14 → pymammotion-0.5.16}/LICENSE +0 -0
  13. {pymammotion-0.5.14 → pymammotion-0.5.16}/README.md +0 -0
  14. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/__init__.py +0 -0
  15. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/__init__.py +0 -0
  16. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/client.py +0 -0
  17. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/model/aep_response.py +0 -0
  18. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/model/connect_response.py +0 -0
  19. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/model/dev_by_account_response.py +0 -0
  20. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/model/login_by_oauth_response.py +0 -0
  21. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/model/regions_response.py +0 -0
  22. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/model/session_by_authcode_response.py +0 -0
  23. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/regions.py +0 -0
  24. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/tea/core.py +0 -0
  25. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/aliyun/tmp_constant.py +0 -0
  26. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/__init__.py +0 -0
  27. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/ble.py +0 -0
  28. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/ble_message.py +0 -0
  29. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/const.py +0 -0
  30. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/data/__init__.py +0 -0
  31. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/data/convert.py +0 -0
  32. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/data/framectrldata.py +0 -0
  33. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/data/notifydata.py +0 -0
  34. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/model/__init__.py +0 -0
  35. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/bluetooth/model/atomic_integer.py +0 -0
  36. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/const.py +0 -0
  37. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/__init__.py +0 -0
  38. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/__init__.py +0 -0
  39. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/account.py +0 -0
  40. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/device_config.py +0 -0
  41. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/device_info.py +0 -0
  42. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/device_limits.py +0 -0
  43. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/enums.py +0 -0
  44. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/errors.py +0 -0
  45. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/excute_boarder_params.py +0 -0
  46. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/execute_boarder.py +0 -0
  47. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/generate_route_information.py +0 -0
  48. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/hash_list.py +0 -0
  49. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/location.py +0 -0
  50. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/mowing_modes.py +0 -0
  51. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/rapid_state.py +0 -0
  52. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/raw_data.py +0 -0
  53. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/region_data.py +0 -0
  54. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/report_info.py +0 -0
  55. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/model/work.py +0 -0
  56. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/mqtt/__init__.py +0 -0
  57. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/mqtt/event.py +0 -0
  58. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/mqtt/properties.py +0 -0
  59. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/data/state_manager.py +0 -0
  60. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/event/__init__.py +0 -0
  61. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/event/event.py +0 -0
  62. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/__init__.py +0 -0
  63. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/_init_.py +0 -0
  64. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/encryption.py +0 -0
  65. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/model/__init__.py +0 -0
  66. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/model/camera_stream.py +0 -0
  67. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/model/http.py +0 -0
  68. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/http/model/response_factory.py +0 -0
  69. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/__init__.py +0 -0
  70. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/__init__.py +0 -0
  71. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/abstract_message.py +0 -0
  72. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/mammotion_command.py +0 -0
  73. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/__init__.py +0 -0
  74. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/driver.py +0 -0
  75. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/navigation.py +0 -0
  76. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/network.py +0 -0
  77. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/ota.py +0 -0
  78. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/system.py +0 -0
  79. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/commands/messages/video.py +0 -0
  80. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/control/__init__.py +0 -0
  81. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/control/joystick.py +0 -0
  82. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/devices/__init__.py +0 -0
  83. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/devices/base.py +0 -0
  84. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/devices/mammotion.py +0 -0
  85. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/devices/mammotion_bluetooth.py +0 -0
  86. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mammotion/devices/mammotion_cloud.py +0 -0
  87. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mqtt/__init__.py +0 -0
  88. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mqtt/linkkit/__init__.py +0 -0
  89. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mqtt/linkkit/h2client.py +0 -0
  90. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mqtt/linkkit/linkkit.py +0 -0
  91. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mqtt/mammotion_future.py +0 -0
  92. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/mqtt/mammotion_mqtt.py +0 -0
  93. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/basestation.proto +0 -0
  94. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/basestation_pb2.py +0 -0
  95. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/basestation_pb2.pyi +0 -0
  96. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/common.proto +0 -0
  97. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/common_pb2.py +0 -0
  98. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/common_pb2.pyi +0 -0
  99. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/dev_net.proto +0 -0
  100. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/dev_net_pb2.py +0 -0
  101. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/dev_net_pb2.pyi +0 -0
  102. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/luba_msg.proto +0 -0
  103. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/luba_msg_pb2.py +0 -0
  104. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/luba_msg_pb2.pyi +0 -0
  105. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/luba_mul.proto +0 -0
  106. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/luba_mul_pb2.py +0 -0
  107. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/luba_mul_pb2.pyi +0 -0
  108. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_driver.proto +0 -0
  109. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_driver_pb2.py +0 -0
  110. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_driver_pb2.pyi +0 -0
  111. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_nav.proto +0 -0
  112. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_nav_pb2.py +0 -0
  113. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_nav_pb2.pyi +0 -0
  114. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_ota.proto +0 -0
  115. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_ota_pb2.py +0 -0
  116. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_ota_pb2.pyi +0 -0
  117. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_pept.proto +0 -0
  118. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_pept_pb2.py +0 -0
  119. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_pept_pb2.pyi +0 -0
  120. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_sys.proto +0 -0
  121. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_sys_pb2.py +0 -0
  122. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/proto/mctrl_sys_pb2.pyi +0 -0
  123. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/py.typed +0 -0
  124. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/constant/__init__.py +0 -0
  125. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/constant/device_constant.py +0 -0
  126. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/conversions.py +0 -0
  127. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/datatype_converter.py +0 -0
  128. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/device_config.py +0 -0
  129. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/device_type.py +0 -0
  130. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/map.py +0 -0
  131. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/movement.py +0 -0
  132. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/mur_mur_hash.py +0 -0
  133. {pymammotion-0.5.14 → pymammotion-0.5.16}/pymammotion/utility/periodic.py +0 -0
  134. {pymammotion-0.5.14 → pymammotion-0.5.16}/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.14
3
+ Version: 0.5.16
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: Michael Arthur
@@ -25,6 +25,7 @@ from pymammotion.aliyun.model.dev_by_account_response import ListingDevByAccount
25
25
  from pymammotion.aliyun.model.login_by_oauth_response import LoginByOAuthResponse
26
26
  from pymammotion.aliyun.model.regions_response import RegionResponse
27
27
  from pymammotion.aliyun.model.session_by_authcode_response import SessionByAuthCodeResponse
28
+ from pymammotion.aliyun.model.thing_response import ThingPropertiesResponse
28
29
  from pymammotion.aliyun.regions import region_mappings
29
30
  from pymammotion.const import ALIYUN_DOMAIN, APP_KEY, APP_SECRET, APP_VERSION
30
31
  from pymammotion.http.http import MammotionHTTP
@@ -771,7 +772,7 @@ class CloudIOTGateway:
771
772
  str(response_body_dict.get("message")),
772
773
  )
773
774
  if response_body_dict.get("code") == 22000:
774
- logger.error(response)
775
+ logger.error(response.body)
775
776
  raise FailedRequestException(iot_id)
776
777
  if response_body_dict.get("code") == 20056:
777
778
  logger.debug("Gateway timeout.")
@@ -786,6 +787,49 @@ class CloudIOTGateway:
786
787
 
787
788
  return message_id
788
789
 
790
+ async def get_device_properties(self, iot_id: str) -> ThingPropertiesResponse:
791
+ """List bindings by account."""
792
+ config = Config(
793
+ app_key=self._app_key,
794
+ app_secret=self._app_secret,
795
+ domain=self._region_response.data.apiGatewayEndpoint,
796
+ )
797
+
798
+ client = Client(config)
799
+
800
+ # build request
801
+ request = CommonParams(
802
+ api_ver="1.0.0",
803
+ language="en-US",
804
+ iot_token=self._session_by_authcode_response.data.iotToken,
805
+ )
806
+ body = IoTApiRequest(
807
+ id=str(uuid.uuid4()),
808
+ params={
809
+ "iotId": f"{iot_id}",
810
+ },
811
+ request=request,
812
+ version="1.0",
813
+ )
814
+
815
+ # send request
816
+ response = await client.async_do_request("/thing/properties/get", "https", "POST", None, body, RuntimeOptions())
817
+ logger.debug(response.status_message)
818
+ logger.debug(response.headers)
819
+ logger.debug(response.status_code)
820
+ logger.debug(response.body)
821
+
822
+ # Decode the response body
823
+ response_body_str = response.body.decode("utf-8")
824
+
825
+ # Load the JSON string into a dictionary
826
+ response_body_dict = self.parse_json_response(response_body_str)
827
+
828
+ if int(response_body_dict.get("code")) != 200:
829
+ raise Exception("Error in getting properties: " + response_body_dict["msg"])
830
+
831
+ return ThingPropertiesResponse.from_dict(response_body_dict)
832
+
789
833
  @property
790
834
  def devices_by_account_response(self):
791
835
  return self._devices_by_account_response
@@ -0,0 +1,12 @@
1
+ from dataclasses import dataclass
2
+
3
+ from mashumaro.mixins.orjson import DataClassORJSONMixin
4
+
5
+ from pymammotion.data.mqtt.properties import Items
6
+
7
+
8
+ @dataclass
9
+ class ThingPropertiesResponse(DataClassORJSONMixin):
10
+ code: int
11
+ data: Items | None
12
+ id: str | None = None
@@ -151,3 +151,20 @@ class MowingDevice(DataClassORJSONMixin):
151
151
  self.device_firmwares.rtk_version = mod.version
152
152
  case 103:
153
153
  self.device_firmwares.lora_version = mod.version
154
+
155
+
156
+ @dataclass
157
+ class RTKDevice(DataClassORJSONMixin):
158
+ name: str
159
+ iot_id: str
160
+ product_key: str
161
+ online: bool = True
162
+ lat: float = 0.0
163
+ lon: float = 0.0
164
+ lora: str = ""
165
+ wifi_rssi: int = 0
166
+ device_version: str = ""
167
+ lora_version: str = ""
168
+ wifi_sta_mac: str = ""
169
+ bt_mac: str = ""
170
+ update_check: CheckDeviceVersion = field(default_factory=CheckDeviceVersion)
@@ -30,7 +30,7 @@ class Params(DataClassORJSONMixin):
30
30
  activeTime: int
31
31
  ip: str
32
32
  aliyunCommodityCode: Literal["iothub_senior"]
33
- categoryKey: Literal["LawnMower"]
33
+ categoryKey: Literal["LawnMower", "Tracker"]
34
34
  nodeType: Literal["DEVICE"]
35
35
  productKey: str
36
36
  statusLast: int
@@ -8,6 +8,7 @@ from pymammotion.http.encryption import EncryptionUtils
8
8
  from pymammotion.http.model.camera_stream import StreamSubscriptionResponse, VideoResourceResponse
9
9
  from pymammotion.http.model.http import CheckDeviceVersion, ErrorInfo, LoginResponseData, Response
10
10
  from pymammotion.http.model.response_factory import response_factory
11
+ from pymammotion.http.model.rtk import RTK
11
12
 
12
13
 
13
14
  class MammotionHTTP:
@@ -209,6 +210,22 @@ class MammotionHTTP:
209
210
  # Assuming the data format matches the expected structure
210
211
  return response_factory(Response[str], data)
211
212
 
213
+ async def get_rtk_devices(self) -> Response[list[RTK]]:
214
+ """Fetches stream subscription data from agora.io for a given IoT device."""
215
+ async with ClientSession(MAMMOTION_API_DOMAIN) as session:
216
+ async with session.get(
217
+ "/device-server/v1/rtk/devices",
218
+ headers={
219
+ **self._headers,
220
+ "Authorization": f"Bearer {self.login_info.access_token}",
221
+ "Content-Type": "application/json",
222
+ "User-Agent": "okhttp/4.9.3",
223
+ },
224
+ ) as resp:
225
+ data = await resp.json()
226
+
227
+ return response_factory(Response[list[RTK]], data)
228
+
212
229
  async def refresh_login(self, account: str, password: str | None = None) -> Response[LoginResponseData]:
213
230
  if self._password is None and password is not None:
214
231
  self._password = password
@@ -229,13 +246,13 @@ class MammotionHTTP:
229
246
  "Decrypt-Type": "3",
230
247
  "Ec-Version": "v1",
231
248
  },
232
- params=dict(
233
- username=self.encryption_utils.encryption_by_aes(account),
234
- password=self.encryption_utils.encryption_by_aes(password),
235
- client_id=self.encryption_utils.encryption_by_aes(MAMMOTION_CLIENT_ID),
236
- client_secret=self.encryption_utils.encryption_by_aes(MAMMOTION_CLIENT_SECRET),
237
- grant_type=self.encryption_utils.encryption_by_aes("password"),
238
- ),
249
+ params={
250
+ "username": self.encryption_utils.encryption_by_aes(account),
251
+ "password": self.encryption_utils.encryption_by_aes(password),
252
+ "client_id": self.encryption_utils.encryption_by_aes(MAMMOTION_CLIENT_ID),
253
+ "client_secret": self.encryption_utils.encryption_by_aes(MAMMOTION_CLIENT_SECRET),
254
+ "grant_type": self.encryption_utils.encryption_by_aes("password"),
255
+ },
239
256
  ) as resp:
240
257
  if resp.status != 200:
241
258
  print(resp.json())
@@ -0,0 +1,16 @@
1
+ """RTK device information."""
2
+ from dataclasses import dataclass, field
3
+
4
+ from mashumaro import field_options
5
+ from mashumaro.mixins.orjson import DataClassORJSONMixin
6
+
7
+
8
+ @dataclass
9
+ class RTK(DataClassORJSONMixin):
10
+ """RTK device information."""
11
+
12
+ device_id: str = field(metadata=field_options(alias="deviceId"))
13
+ device_name: str = field(metadata=field_options(alias="deviceName"))
14
+ product_key: str = field(metadata=field_options(alias="productKey"))
15
+ status: int
16
+ lora: str
@@ -0,0 +1,43 @@
1
+ """RTK protobuf commands."""
2
+
3
+ from abc import ABC
4
+ from logging import getLogger
5
+ import time
6
+
7
+ from pymammotion.mammotion.commands.abstract_message import AbstractMessage
8
+ from pymammotion.proto import (
9
+ AppToBaseMqttRtkT,
10
+ BaseStation,
11
+ LubaMsg,
12
+ MsgAttr,
13
+ MsgCmdType,
14
+ MsgDevice,
15
+ RequestBasestationInfoT,
16
+ )
17
+
18
+ logger = getLogger(__name__)
19
+
20
+
21
+ class MessageBasestation(AbstractMessage, ABC):
22
+ def send_order_msg_basestation(self, driver) -> bytes:
23
+ return LubaMsg(
24
+ msgtype=MsgCmdType.BASESTATION,
25
+ sender=MsgDevice.DEV_MOBILEAPP,
26
+ rcver=self.get_msg_device(MsgCmdType.BASESTATION, MsgDevice.DEV_MAINCTL),
27
+ msgattr=MsgAttr.REQ,
28
+ timestamp=round(time.time() * 1000),
29
+ seqs=self.seqs.increment_and_get() & 255,
30
+ version=1,
31
+ subtype=self.user_account,
32
+ driver=driver,
33
+ ).SerializeToString()
34
+
35
+ def basestation_info(self) -> bytes:
36
+ """Build and send a request to get basestation info (request_type=1)."""
37
+ base = BaseStation(to_dev=RequestBasestationInfoT(request_type=1))
38
+ return self.send_order_msg_basestation(base)
39
+
40
+ def set_base_net_rtk_switch(self, rtk_switch: int) -> bytes:
41
+ """Set RTK switch via app_to_base_mqtt_rtk_t."""
42
+ base = BaseStation(app_to_base_mqtt_rtk_msg=AppToBaseMqttRtkT(rtk_switch=rtk_switch))
43
+ return self.send_order_msg_basestation(base)
@@ -81,7 +81,7 @@ class MessageMedia(AbstractMessage, ABC):
81
81
  manual off: false, id=1127, power_ctrl=2
82
82
  """
83
83
  ids = 1125 if manual_ctrl else 1127
84
- manual_light_ctrl = LampManualCtrlSta.manual_power_off if manual_ctrl else LampManualCtrlSta.manual_power_on
84
+ manual_light_ctrl = LampManualCtrlSta.manual_power_on if manual_ctrl else LampManualCtrlSta.manual_power_off
85
85
  return self.send_order_msg_media(
86
86
  SocMul(set_lamp=SetHeadlamp(set_ids=ids, lamp_power_ctrl=2, lamp_manual_ctrl=manual_light_ctrl))
87
87
  )
@@ -235,6 +235,7 @@ class MsgCmdType(betterproto.Enum):
235
235
  ESP = 248
236
236
  MUL = 249
237
237
  PEPT = 250
238
+ BASESTATION = 251
238
239
 
239
240
 
240
241
 
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [project]
6
6
  name = "pymammotion"
7
- version = "0.5.14"
7
+ version = "0.5.16"
8
8
  license = "GPL-3.0"
9
9
  description = ""
10
10
  readme = "README.md"
@@ -66,7 +66,7 @@ autotyping = "^24.3.0"
66
66
  ipython = "^9.0.2"
67
67
 
68
68
  [tool.bumpver]
69
- current_version = "0.5.14"
69
+ current_version = "0.5.16"
70
70
  version_pattern = "MAJOR.MINOR.PATCH"
71
71
  commit_message = "Bump version {old_version} -> {new_version}"
72
72
  commit = true
File without changes
File without changes