pymammotion 0.5.23__tar.gz → 0.5.24__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.
- {pymammotion-0.5.23 → pymammotion-0.5.24}/PKG-INFO +1 -1
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/client.py +2 -2
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/cloud_gateway.py +21 -2
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/state_manager.py +22 -6
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/driver.py +25 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pyproject.toml +2 -2
- {pymammotion-0.5.23 → pymammotion-0.5.24}/LICENSE +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/README.md +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/aep_response.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/connect_response.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/dev_by_account_response.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/login_by_oauth_response.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/regions_response.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/session_by_authcode_response.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/thing_response.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/regions.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/tea/core.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/tmp_constant.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/ble.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/ble_message.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/const.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/data/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/data/convert.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/data/framectrldata.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/data/notifydata.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/model/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/bluetooth/model/atomic_integer.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/const.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/account.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/device.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/device_config.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/device_info.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/device_limits.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/enums.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/errors.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/excute_boarder_params.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/execute_boarder.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/generate_route_information.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/hash_list.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/location.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/mowing_modes.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/rapid_state.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/raw_data.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/region_data.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/report_info.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/work.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/mqtt/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/mqtt/event.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/mqtt/properties.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/mqtt/status.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/event/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/event/event.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/_init_.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/encryption.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/http.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/model/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/model/camera_stream.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/model/http.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/model/response_factory.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/http/model/rtk.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/abstract_message.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/mammotion_command.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/basestation.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/media.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/navigation.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/network.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/ota.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/system.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/video.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/control/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/control/joystick.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/devices/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/devices/base.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/devices/mammotion.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/devices/mammotion_bluetooth.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/devices/mammotion_cloud.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mqtt/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mqtt/linkkit/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mqtt/linkkit/h2client.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mqtt/linkkit/linkkit.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mqtt/mammotion_future.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mqtt/mammotion_mqtt.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/basestation.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/basestation_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/basestation_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/common.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/common_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/common_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/dev_net.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/dev_net_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/dev_net_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/luba_msg.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/luba_msg_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/luba_msg_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/luba_mul.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/luba_mul_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/luba_mul_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_driver.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_driver_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_driver_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_nav.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_nav_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_nav_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_ota.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_ota_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_ota_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_pept.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_pept_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_pept_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_sys.proto +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_sys_pb2.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/mctrl_sys_pb2.pyi +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/message_pool.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/proto/py.typed +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/py.typed +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/constant/__init__.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/constant/device_constant.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/conversions.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/datatype_converter.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/device_config.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/device_type.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/map.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/movement.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/mur_mur_hash.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/periodic.py +0 -0
- {pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/utility/rocker_util.py +0 -0
|
@@ -81,7 +81,7 @@ class Client:
|
|
|
81
81
|
"maxAttempts": UtilClient.default_number(runtime.max_attempts, 3),
|
|
82
82
|
},
|
|
83
83
|
"backoff": {
|
|
84
|
-
"policy": UtilClient.default_string(runtime.backoff_policy, "
|
|
84
|
+
"policy": UtilClient.default_string(runtime.backoff_policy, "yes"),
|
|
85
85
|
"period": UtilClient.default_number(runtime.backoff_period, 1),
|
|
86
86
|
},
|
|
87
87
|
"ignoreSSL": runtime.ignore_ssl,
|
|
@@ -171,7 +171,7 @@ class Client:
|
|
|
171
171
|
"maxAttempts": UtilClient.default_number(runtime.max_attempts, 3),
|
|
172
172
|
},
|
|
173
173
|
"backoff": {
|
|
174
|
-
"policy": UtilClient.default_string(runtime.backoff_policy, "
|
|
174
|
+
"policy": UtilClient.default_string(runtime.backoff_policy, "yes"),
|
|
175
175
|
"period": UtilClient.default_number(runtime.backoff_period, 1),
|
|
176
176
|
},
|
|
177
177
|
"ignoreSSL": runtime.ignore_ssl,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Module for interacting with Aliyun Cloud IoT Gateway."""
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
3
4
|
import base64
|
|
4
5
|
import hashlib
|
|
5
6
|
import hmac
|
|
@@ -86,6 +87,14 @@ class GatewayTimeoutException(Exception):
|
|
|
86
87
|
self.iot_id = args[1]
|
|
87
88
|
|
|
88
89
|
|
|
90
|
+
class TooManyRequestsException(Exception):
|
|
91
|
+
"""Raise exception when the gateway times out."""
|
|
92
|
+
|
|
93
|
+
def __init__(self, *args: object) -> None:
|
|
94
|
+
super().__init__(args)
|
|
95
|
+
self.iot_id = args[1]
|
|
96
|
+
|
|
97
|
+
|
|
89
98
|
class LoginException(Exception):
|
|
90
99
|
"""Raise exception when library cannot log in."""
|
|
91
100
|
|
|
@@ -118,7 +127,7 @@ class CloudIOTGateway:
|
|
|
118
127
|
self._app_key = APP_KEY
|
|
119
128
|
self._app_secret = APP_SECRET
|
|
120
129
|
self.domain = ALIYUN_DOMAIN
|
|
121
|
-
|
|
130
|
+
self.message_delay = 1
|
|
122
131
|
self._client_id = self.generate_hardware_string(8) # 8 characters
|
|
123
132
|
self._device_sn = self.generate_hardware_string(32) # 32 characters
|
|
124
133
|
self._utdid = self.generate_hardware_string(32) # 32 characters
|
|
@@ -730,7 +739,6 @@ class CloudIOTGateway:
|
|
|
730
739
|
)
|
|
731
740
|
|
|
732
741
|
client = Client(config)
|
|
733
|
-
|
|
734
742
|
# build request
|
|
735
743
|
request = CommonParams(
|
|
736
744
|
api_ver="1.0.5",
|
|
@@ -762,6 +770,14 @@ class CloudIOTGateway:
|
|
|
762
770
|
logger.debug(response.body)
|
|
763
771
|
logger.debug(iot_id)
|
|
764
772
|
|
|
773
|
+
if response.status_code == 429:
|
|
774
|
+
logger.debug("too many requests.")
|
|
775
|
+
if self.message_delay > 8:
|
|
776
|
+
raise TooManyRequestsException(response.status_message, iot_id)
|
|
777
|
+
asyncio.get_event_loop().call_later(self.message_delay, self.send_cloud_command, iot_id, command)
|
|
778
|
+
self.message_delay = self.message_delay * 2
|
|
779
|
+
return message_id
|
|
780
|
+
|
|
765
781
|
response_body_str = response.body.decode("utf-8")
|
|
766
782
|
response_body_dict = self.parse_json_response(response_body_str)
|
|
767
783
|
|
|
@@ -785,6 +801,9 @@ class CloudIOTGateway:
|
|
|
785
801
|
if response_body_dict.get("code") == 6205:
|
|
786
802
|
raise DeviceOfflineException(response_body_dict.get("code"), iot_id)
|
|
787
803
|
|
|
804
|
+
if self.message_delay != 1:
|
|
805
|
+
self.message_delay = 1
|
|
806
|
+
|
|
788
807
|
return message_id
|
|
789
808
|
|
|
790
809
|
async def get_device_properties(self, iot_id: str) -> ThingPropertiesResponse:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""Manage state from notifications into MowingDevice."""
|
|
2
2
|
|
|
3
|
+
from collections.abc import Awaitable, Callable
|
|
3
4
|
from datetime import UTC, datetime
|
|
4
5
|
import logging
|
|
5
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
6
7
|
|
|
7
8
|
import betterproto2
|
|
8
9
|
|
|
@@ -42,6 +43,7 @@ class StateManager:
|
|
|
42
43
|
"""Manage state."""
|
|
43
44
|
|
|
44
45
|
def __init__(self, device: MowingDevice) -> None:
|
|
46
|
+
"""Initialize state manager with a device."""
|
|
45
47
|
self._device: MowingDevice = device
|
|
46
48
|
self.last_updated_at = datetime.now(UTC)
|
|
47
49
|
self.preference = ConnectionPreference.WIFI
|
|
@@ -74,11 +76,13 @@ class StateManager:
|
|
|
74
76
|
self._device = device
|
|
75
77
|
|
|
76
78
|
async def properties(self, thing_properties: ThingPropertiesMessage) -> None:
|
|
79
|
+
"""Update device properties and invoke callback."""
|
|
77
80
|
# TODO update device based off thing properties
|
|
78
81
|
self._device.mqtt_properties = thing_properties
|
|
79
82
|
await self.on_properties_callback(thing_properties)
|
|
80
83
|
|
|
81
84
|
async def status(self, thing_status: ThingStatusMessage) -> None:
|
|
85
|
+
"""Update device status and invoke callback."""
|
|
82
86
|
if not self._device.online:
|
|
83
87
|
self._device.online = True
|
|
84
88
|
self._device.status_properties = thing_status
|
|
@@ -93,19 +97,23 @@ class StateManager:
|
|
|
93
97
|
|
|
94
98
|
@property
|
|
95
99
|
def online(self) -> bool:
|
|
100
|
+
"""Return online status."""
|
|
96
101
|
return self._device.online
|
|
97
102
|
|
|
98
103
|
@online.setter
|
|
99
104
|
def online(self, value: bool) -> None:
|
|
105
|
+
"""Set online status."""
|
|
100
106
|
self._device.online = value
|
|
101
107
|
|
|
102
108
|
async def gethash_ack_callback(self, msg: NavGetHashListAck) -> None:
|
|
109
|
+
"""Dispatch hash list acknowledgment to available callback."""
|
|
103
110
|
if self.cloud_gethash_ack_callback:
|
|
104
111
|
await self.cloud_gethash_ack_callback(msg)
|
|
105
112
|
elif self.ble_gethash_ack_callback:
|
|
106
113
|
await self.ble_gethash_ack_callback(msg)
|
|
107
114
|
|
|
108
115
|
async def on_notification_callback(self, res: tuple[str, Any | None]) -> None:
|
|
116
|
+
"""Dispatch notification to available callback."""
|
|
109
117
|
if self.cloud_on_notification_callback:
|
|
110
118
|
await self.cloud_on_notification_callback.data_event(res)
|
|
111
119
|
elif self.ble_on_notification_callback:
|
|
@@ -134,6 +142,7 @@ class StateManager:
|
|
|
134
142
|
await self.ble_get_commondata_ack_callback(comm_data)
|
|
135
143
|
|
|
136
144
|
async def get_plan_callback(self, planjob: NavPlanJobSet) -> None:
|
|
145
|
+
"""Dispatch plan job to available callback."""
|
|
137
146
|
if self.cloud_get_plan_callback:
|
|
138
147
|
await self.cloud_get_plan_callback(planjob)
|
|
139
148
|
elif self.ble_get_plan_callback:
|
|
@@ -244,9 +253,10 @@ class StateManager:
|
|
|
244
253
|
self._device.mower_state.swversion = device_fw_info.version
|
|
245
254
|
|
|
246
255
|
def _update_driver_data(self, message) -> None:
|
|
247
|
-
|
|
256
|
+
"""Update driver data."""
|
|
248
257
|
|
|
249
258
|
def _update_net_data(self, message) -> None:
|
|
259
|
+
"""Update network data."""
|
|
250
260
|
net_msg = betterproto2.which_one_of(message.net, "NetSubType")
|
|
251
261
|
match net_msg[0]:
|
|
252
262
|
case "toapp_wifi_iot_status":
|
|
@@ -269,10 +279,16 @@ class StateManager:
|
|
|
269
279
|
case "Getlamprsp":
|
|
270
280
|
lamp_resp: Getlamprsp = mul_msg[1]
|
|
271
281
|
self._device.mower_state.lamp_info.lamp_bright = lamp_resp.lamp_bright
|
|
272
|
-
if lamp_resp.get_ids
|
|
273
|
-
self._device.mower_state.lamp_info.
|
|
282
|
+
if lamp_resp.get_ids in (1126, 1127):
|
|
283
|
+
self._device.mower_state.lamp_info.lamp_bright = lamp_resp.lamp_bright
|
|
284
|
+
self._device.mower_state.lamp_info.manual_light = bool(lamp_resp.lamp_manual_ctrl.value) or bool(
|
|
285
|
+
lamp_resp.lamp_bright
|
|
286
|
+
)
|
|
274
287
|
if lamp_resp.get_ids == 1123:
|
|
275
|
-
self._device.mower_state.lamp_info.
|
|
288
|
+
self._device.mower_state.lamp_info.lamp_bright = lamp_resp.lamp_bright
|
|
289
|
+
self._device.mower_state.lamp_info.night_light = bool(lamp_resp.lamp_ctrl.value) or bool(
|
|
290
|
+
lamp_resp.lamp_bright
|
|
291
|
+
)
|
|
276
292
|
|
|
277
293
|
def _update_ota_data(self, message) -> None:
|
|
278
|
-
|
|
294
|
+
"""Update OTA data."""
|
|
@@ -5,6 +5,8 @@ import time
|
|
|
5
5
|
|
|
6
6
|
from pymammotion.mammotion.commands.abstract_message import AbstractMessage
|
|
7
7
|
from pymammotion.proto import (
|
|
8
|
+
AppGetCutterWorkMode,
|
|
9
|
+
AppSetCutterWorkMode,
|
|
8
10
|
DrvKnifeHeight,
|
|
9
11
|
DrvMotionCtrl,
|
|
10
12
|
DrvMowCtrlByHand,
|
|
@@ -23,6 +25,7 @@ logger = getLogger(__name__)
|
|
|
23
25
|
|
|
24
26
|
class MessageDriver(AbstractMessage, ABC):
|
|
25
27
|
def send_order_msg_driver(self, driver) -> bytes:
|
|
28
|
+
"""Build and serialize a driver command message."""
|
|
26
29
|
return LubaMsg(
|
|
27
30
|
msgtype=MsgCmdType.EMBED_DRIVER,
|
|
28
31
|
sender=MsgDevice.DEV_MOBILEAPP,
|
|
@@ -36,23 +39,42 @@ class MessageDriver(AbstractMessage, ABC):
|
|
|
36
39
|
).SerializeToString()
|
|
37
40
|
|
|
38
41
|
def set_blade_height(self, height: int) -> bytes:
|
|
42
|
+
"""Set mower blade height."""
|
|
39
43
|
logger.debug(f"Send knife height height={height}")
|
|
40
44
|
build = MctlDriver(todev_knife_height_set=DrvKnifeHeight(knife_height=height))
|
|
41
45
|
logger.debug(f"Send command--Knife motor height setting height={height}")
|
|
42
46
|
return self.send_order_msg_driver(build)
|
|
43
47
|
|
|
44
48
|
def set_speed(self, speed: float) -> bytes:
|
|
49
|
+
"""Set the device speed."""
|
|
45
50
|
logger.debug(f"{self.get_device_name()} set speed, {speed}")
|
|
46
51
|
build = MctlDriver(bidire_speed_read_set=DrvSrSpeed(speed=speed, rw=1))
|
|
47
52
|
logger.debug(f"Send command--Speed setting speed={speed}")
|
|
48
53
|
return self.send_order_msg_driver(build)
|
|
49
54
|
|
|
55
|
+
def get_cutter_mode(self) -> bytes:
|
|
56
|
+
"""Request the current cutter mode."""
|
|
57
|
+
build = MctlDriver(current_cutter_mode=AppGetCutterWorkMode())
|
|
58
|
+
return self.send_order_msg_driver(build)
|
|
59
|
+
|
|
60
|
+
def set_cutter_mode(self, cutter_mode: int) -> bytes:
|
|
61
|
+
"""Set blade speed."""
|
|
62
|
+
"""
|
|
63
|
+
1 slow
|
|
64
|
+
0 normal
|
|
65
|
+
2 fast
|
|
66
|
+
"""
|
|
67
|
+
build = MctlDriver(cutter_mode_ctrl_by_hand=AppSetCutterWorkMode(cutter_mode=cutter_mode))
|
|
68
|
+
return self.send_order_msg_driver(build)
|
|
69
|
+
|
|
50
70
|
def syn_nav_star_point_data(self, sat_system: int) -> bytes:
|
|
71
|
+
"""Synchronize navigation satellite frequency points."""
|
|
51
72
|
build = MctlDriver(rtk_sys_mask_query=RtkSysMaskQueryT(sat_system=sat_system))
|
|
52
73
|
logger.debug(f"Send command--Navigation satellite frequency point synchronization={sat_system}")
|
|
53
74
|
return self.send_order_msg_driver(build)
|
|
54
75
|
|
|
55
76
|
def set_nav_star_point(self, cmd_req: str) -> bytes:
|
|
77
|
+
"""Configure navigation satellite frequency points."""
|
|
56
78
|
build = MctlDriver(rtk_cfg_req=RtkCfgReqT(cmd_req=cmd_req, cmd_length=len(cmd_req) - 1))
|
|
57
79
|
logger.debug(f"Send command--Navigation satellite frequency point setting={cmd_req}")
|
|
58
80
|
logger.debug(
|
|
@@ -61,6 +83,7 @@ class MessageDriver(AbstractMessage, ABC):
|
|
|
61
83
|
return self.send_order_msg_driver(build)
|
|
62
84
|
|
|
63
85
|
def get_speed(self) -> bytes:
|
|
86
|
+
"""Request the current speed value."""
|
|
64
87
|
build = MctlDriver(bidire_speed_read_set=DrvSrSpeed(rw=0))
|
|
65
88
|
logger.debug("Send command--Get speed value")
|
|
66
89
|
return self.send_order_msg_driver(build)
|
|
@@ -72,6 +95,7 @@ class MessageDriver(AbstractMessage, ABC):
|
|
|
72
95
|
cut_knife_height: int,
|
|
73
96
|
max_run_speed: float,
|
|
74
97
|
) -> bytes:
|
|
98
|
+
"""Send manual mowing control command."""
|
|
75
99
|
build = MctlDriver(
|
|
76
100
|
mow_ctrl_by_hand=DrvMowCtrlByHand(
|
|
77
101
|
main_ctrl=main_ctrl,
|
|
@@ -88,6 +112,7 @@ class MessageDriver(AbstractMessage, ABC):
|
|
|
88
112
|
return self.send_order_msg_driver(build)
|
|
89
113
|
|
|
90
114
|
def send_movement(self, linear_speed: int, angular_speed: int) -> bytes:
|
|
115
|
+
"""Send motion command with linear and angular speeds."""
|
|
91
116
|
logger.debug(f"Control command print, linearSpeed={
|
|
92
117
|
linear_speed} // angularSpeed={angular_speed}")
|
|
93
118
|
return self.send_order_msg_driver(
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pymammotion"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.24"
|
|
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.
|
|
69
|
+
current_version = "0.5.24"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/dev_by_account_response.py
RENAMED
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/login_by_oauth_response.py
RENAMED
|
File without changes
|
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/aliyun/model/session_by_authcode_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/data/model/generate_route_information.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/abstract_message.py
RENAMED
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/mammotion_command.py
RENAMED
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/__init__.py
RENAMED
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/basestation.py
RENAMED
|
File without changes
|
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/navigation.py
RENAMED
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/commands/messages/network.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymammotion-0.5.23 → pymammotion-0.5.24}/pymammotion/mammotion/devices/mammotion_bluetooth.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|