pymammotion 0.5.18__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.
- {pymammotion-0.5.18 → pymammotion-0.5.19}/PKG-INFO +2 -2
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/device.py +2 -2
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/state_manager.py +15 -18
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/devices/base.py +21 -22
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/devices/mammotion_bluetooth.py +2 -2
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/devices/mammotion_cloud.py +8 -6
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mqtt/mammotion_mqtt.py +3 -6
- pymammotion-0.5.19/pymammotion/proto/__init__.py +4841 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_driver_pb2.py +1 -1
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pyproject.toml +4 -4
- pymammotion-0.5.18/pymammotion/proto/__init__.py +0 -2224
- {pymammotion-0.5.18 → pymammotion-0.5.19}/LICENSE +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/README.md +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/client.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/cloud_gateway.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/model/aep_response.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/model/connect_response.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/model/dev_by_account_response.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/model/login_by_oauth_response.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/model/regions_response.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/model/session_by_authcode_response.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/model/thing_response.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/regions.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/tea/core.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/aliyun/tmp_constant.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/ble.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/ble_message.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/const.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/data/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/data/convert.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/data/framectrldata.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/data/notifydata.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/model/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/bluetooth/model/atomic_integer.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/const.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/account.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/device_config.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/device_info.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/device_limits.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/enums.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/errors.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/excute_boarder_params.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/execute_boarder.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/generate_route_information.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/hash_list.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/location.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/mowing_modes.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/rapid_state.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/raw_data.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/region_data.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/report_info.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/model/work.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/mqtt/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/mqtt/event.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/mqtt/properties.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/data/mqtt/status.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/event/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/event/event.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/_init_.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/encryption.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/http.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/model/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/model/camera_stream.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/model/http.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/model/response_factory.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/http/model/rtk.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/abstract_message.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/mammotion_command.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/basestation.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/driver.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/media.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/navigation.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/network.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/ota.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/system.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/commands/messages/video.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/control/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/control/joystick.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/devices/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/devices/mammotion.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mqtt/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mqtt/linkkit/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mqtt/linkkit/h2client.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mqtt/linkkit/linkkit.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mqtt/mammotion_future.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/basestation.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/basestation_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/basestation_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/common.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/common_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/common_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/dev_net.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/dev_net_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/dev_net_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/luba_msg.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/luba_msg_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/luba_msg_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/luba_mul.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/luba_mul_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/luba_mul_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_driver.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_driver_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_nav.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_nav_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_nav_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_ota.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_ota_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_ota_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_pept.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_pept_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_pept_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_sys.proto +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_sys_pb2.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/proto/mctrl_sys_pb2.pyi +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/py.typed +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/constant/__init__.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/constant/device_constant.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/conversions.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/datatype_converter.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/device_config.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/device_type.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/map.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/movement.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/mur_mur_hash.py +0 -0
- {pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/utility/periodic.py +0 -0
- {pymammotion-0.5.18 → 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.
|
|
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:
|
|
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
|
|
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=
|
|
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
|
|
7
|
+
import betterproto2
|
|
9
8
|
|
|
10
9
|
from pymammotion.data.model.device import MowingDevice
|
|
11
10
|
from pymammotion.data.model.device_info import SideLight
|
|
@@ -142,7 +141,7 @@ class StateManager:
|
|
|
142
141
|
|
|
143
142
|
async def notification(self, message: LubaMsg) -> None:
|
|
144
143
|
"""Handle protobuf notifications."""
|
|
145
|
-
res =
|
|
144
|
+
res = betterproto2.which_one_of(message, "LubaSubMsg")
|
|
146
145
|
self.last_updated_at = datetime.now(UTC)
|
|
147
146
|
# additional catch all if we don't get a status update
|
|
148
147
|
if not self._device.online:
|
|
@@ -166,30 +165,30 @@ class StateManager:
|
|
|
166
165
|
|
|
167
166
|
async def _update_nav_data(self, message) -> None:
|
|
168
167
|
"""Update nav data."""
|
|
169
|
-
nav_msg =
|
|
168
|
+
nav_msg = betterproto2.which_one_of(message.nav, "SubNavMsg")
|
|
170
169
|
match nav_msg[0]:
|
|
171
170
|
case "toapp_gethash_ack":
|
|
172
171
|
hashlist_ack: NavGetHashListAck = nav_msg[1]
|
|
173
172
|
self._device.map.update_root_hash_list(
|
|
174
|
-
NavGetHashListData.from_dict(hashlist_ack.to_dict(casing=
|
|
173
|
+
NavGetHashListData.from_dict(hashlist_ack.to_dict(casing=betterproto2.Casing.SNAKE))
|
|
175
174
|
)
|
|
176
175
|
await self.gethash_ack_callback(nav_msg[1])
|
|
177
176
|
case "toapp_get_commondata_ack":
|
|
178
177
|
common_data: NavGetCommDataAck = nav_msg[1]
|
|
179
178
|
updated = self._device.map.update(
|
|
180
|
-
NavGetCommData.from_dict(common_data.to_dict(casing=
|
|
179
|
+
NavGetCommData.from_dict(common_data.to_dict(casing=betterproto2.Casing.SNAKE))
|
|
181
180
|
)
|
|
182
181
|
if updated:
|
|
183
182
|
await self.get_commondata_ack_callback(common_data)
|
|
184
183
|
case "todev_planjob_set":
|
|
185
184
|
planjob: NavPlanJobSet = nav_msg[1]
|
|
186
|
-
self._device.map.update_plan(Plan.from_dict(planjob.to_dict(casing=
|
|
185
|
+
self._device.map.update_plan(Plan.from_dict(planjob.to_dict(casing=betterproto2.Casing.SNAKE)))
|
|
187
186
|
await self.get_plan_callback(planjob)
|
|
188
187
|
|
|
189
188
|
case "toapp_svg_msg":
|
|
190
189
|
common_svg_data: SvgMessageAckT = nav_msg[1]
|
|
191
190
|
updated = self._device.map.update(
|
|
192
|
-
SvgMessage.from_dict(common_svg_data.to_dict(casing=
|
|
191
|
+
SvgMessage.from_dict(common_svg_data.to_dict(casing=betterproto2.Casing.SNAKE))
|
|
193
192
|
)
|
|
194
193
|
if updated:
|
|
195
194
|
await self.get_commondata_ack_callback(common_svg_data)
|
|
@@ -202,7 +201,7 @@ class StateManager:
|
|
|
202
201
|
case "bidire_reqconver_path":
|
|
203
202
|
work_settings: NavReqCoverPath = nav_msg[1]
|
|
204
203
|
self._device.work = CurrentTaskSettings.from_dict(
|
|
205
|
-
work_settings.to_dict(casing=
|
|
204
|
+
work_settings.to_dict(casing=betterproto2.Casing.SNAKE)
|
|
206
205
|
)
|
|
207
206
|
case "nav_sys_param_cmd":
|
|
208
207
|
settings: NavSysParamMsg = nav_msg[1]
|
|
@@ -220,7 +219,7 @@ class StateManager:
|
|
|
220
219
|
|
|
221
220
|
def _update_sys_data(self, message) -> None:
|
|
222
221
|
"""Update system."""
|
|
223
|
-
sys_msg =
|
|
222
|
+
sys_msg = betterproto2.which_one_of(message.sys, "SubSysMsg")
|
|
224
223
|
match sys_msg[0]:
|
|
225
224
|
case "system_update_buf":
|
|
226
225
|
self._device.buffer(sys_msg[1])
|
|
@@ -232,7 +231,7 @@ class StateManager:
|
|
|
232
231
|
self._device.run_state_update(sys_msg[1])
|
|
233
232
|
case "todev_time_ctrl_light":
|
|
234
233
|
ctrl_light: TimeCtrlLight = sys_msg[1]
|
|
235
|
-
side_led: SideLight = SideLight.from_dict(ctrl_light.to_dict(casing=
|
|
234
|
+
side_led: SideLight = SideLight.from_dict(ctrl_light.to_dict(casing=betterproto2.Casing.SNAKE))
|
|
236
235
|
self._device.mower_state.side_led = side_led
|
|
237
236
|
case "device_product_type_info":
|
|
238
237
|
device_product_type: DeviceProductTypeInfoT = sys_msg[1]
|
|
@@ -248,7 +247,7 @@ class StateManager:
|
|
|
248
247
|
pass
|
|
249
248
|
|
|
250
249
|
def _update_net_data(self, message) -> None:
|
|
251
|
-
net_msg =
|
|
250
|
+
net_msg = betterproto2.which_one_of(message.net, "NetSubType")
|
|
252
251
|
match net_msg[0]:
|
|
253
252
|
case "toapp_wifi_iot_status":
|
|
254
253
|
wifi_iot_status: WifiIotStatusReport = net_msg[1]
|
|
@@ -265,17 +264,15 @@ class StateManager:
|
|
|
265
264
|
|
|
266
265
|
def _update_mul_data(self, message) -> None:
|
|
267
266
|
"""Media and video states."""
|
|
268
|
-
mul_msg =
|
|
267
|
+
mul_msg = betterproto2.which_one_of(message.net, "SubMul")
|
|
269
268
|
match mul_msg[0]:
|
|
270
269
|
case "Getlamprsp":
|
|
271
270
|
lamp_resp: Getlamprsp = mul_msg[1]
|
|
272
271
|
self._device.mower_state.lamp_info.lamp_bright = lamp_resp.lamp_bright
|
|
273
272
|
if lamp_resp.get_ids == 1126:
|
|
274
|
-
self._device.mower_state.lamp_info.manual_light = (
|
|
275
|
-
True if lamp_resp.lamp_manual_ctrl.value > 0 else False
|
|
276
|
-
)
|
|
273
|
+
self._device.mower_state.lamp_info.manual_light = bool(lamp_resp.lamp_manual_ctrl.value)
|
|
277
274
|
if lamp_resp.get_ids == 1123:
|
|
278
|
-
self._device.mower_state.lamp_info.night_light =
|
|
275
|
+
self._device.mower_state.lamp_info.night_light = bool(lamp_resp.lamp_ctrl.value)
|
|
279
276
|
|
|
280
277
|
def _update_ota_data(self, message) -> None:
|
|
281
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
|
|
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:
|
|
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 =
|
|
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 =
|
|
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=
|
|
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 =
|
|
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=
|
|
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 =
|
|
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=
|
|
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 =
|
|
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=
|
|
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 =
|
|
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=
|
|
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 =
|
|
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=
|
|
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
|
|
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[
|
|
234
|
+
del self.mower.map.area[hash_id]
|
|
236
235
|
|
|
237
|
-
for
|
|
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[
|
|
239
|
+
del self.mower.map.path[hash_id]
|
|
241
240
|
|
|
242
|
-
for
|
|
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[
|
|
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():
|
{pymammotion-0.5.18 → pymammotion-0.5.19}/pymammotion/mammotion/devices/mammotion_bluetooth.py
RENAMED
|
@@ -5,7 +5,7 @@ import time
|
|
|
5
5
|
from typing import Any
|
|
6
6
|
from uuid import UUID
|
|
7
7
|
|
|
8
|
-
import
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
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",
|
|
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:
|