pymammotion 0.2.24__py3-none-any.whl → 0.2.26__py3-none-any.whl
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.
- pymammotion/aliyun/cloud_gateway.py +6 -3
- pymammotion/data/mqtt/event.py +1 -1
- pymammotion/mammotion/commands/mammotion_command.py +0 -15
- pymammotion/mammotion/commands/messages/network.py +4 -0
- pymammotion/mammotion/devices/mammotion.py +8 -4
- {pymammotion-0.2.24.dist-info → pymammotion-0.2.26.dist-info}/METADATA +1 -1
- {pymammotion-0.2.24.dist-info → pymammotion-0.2.26.dist-info}/RECORD +9 -9
- {pymammotion-0.2.24.dist-info → pymammotion-0.2.26.dist-info}/LICENSE +0 -0
- {pymammotion-0.2.24.dist-info → pymammotion-0.2.26.dist-info}/WHEEL +0 -0
@@ -9,9 +9,7 @@ import random
|
|
9
9
|
import string
|
10
10
|
import time
|
11
11
|
import uuid
|
12
|
-
from logging import getLogger
|
13
|
-
from datetime import datetime
|
14
|
-
from urllib.parse import urlencode
|
12
|
+
from logging import getLogger
|
15
13
|
|
16
14
|
from aiohttp import ClientSession
|
17
15
|
from alibabacloud_iot_api_gateway.client import Client
|
@@ -19,6 +17,7 @@ from alibabacloud_iot_api_gateway.models import CommonParams, Config, IoTApiRequ
|
|
19
17
|
from alibabacloud_tea_util.client import Client as UtilClient
|
20
18
|
from alibabacloud_tea_util.models import RuntimeOptions
|
21
19
|
|
20
|
+
from pymammotion.http.http import MammotionHTTP
|
22
21
|
from pymammotion.aliyun.dataclass.aep_response import AepResponse
|
23
22
|
from pymammotion.aliyun.dataclass.connect_response import ConnectResponse
|
24
23
|
from pymammotion.aliyun.dataclass.dev_by_account_response import (
|
@@ -79,6 +78,7 @@ class CloudIOTGateway:
|
|
79
78
|
|
80
79
|
def __init__(self, connect_response: ConnectResponse | None = None, login_by_oauth_response: LoginByOAuthResponse | None = None, aep_response: AepResponse | None = None, session_by_authcode_response: SessionByAuthCodeResponse | None = None, region_response: RegionResponse | None = None, dev_by_account: ListingDevByAccountResponse | None = None):
|
81
80
|
"""Initialize the CloudIOTGateway."""
|
81
|
+
self.mammotion_http: MammotionHTTP | None = None
|
82
82
|
self._app_key = APP_KEY
|
83
83
|
self._app_secret = APP_SECRET
|
84
84
|
self.domain = ALIYUN_DOMAIN
|
@@ -616,3 +616,6 @@ class CloudIOTGateway:
|
|
616
616
|
@property
|
617
617
|
def listing_dev_by_account_response(self):
|
618
618
|
return self._devices_by_account_response
|
619
|
+
|
620
|
+
def set_http(self, mammotion_http):
|
621
|
+
self.mammotion_http = mammotion_http
|
pymammotion/data/mqtt/event.py
CHANGED
@@ -148,7 +148,7 @@ class ThingEventMessage(DataClassORJSONMixin):
|
|
148
148
|
elif identifier == "device_warning_event":
|
149
149
|
params_obj = DeviceWarningEventParams(**params_dict)
|
150
150
|
elif identifier == "device_config_req_event":
|
151
|
-
params_obj = payload.get("params",
|
151
|
+
params_obj = payload.get("params", {})
|
152
152
|
elif identifier == "device_notification_event":
|
153
153
|
params_obj = DeviceNotificationEventParams(**params_dict)
|
154
154
|
else:
|
@@ -23,18 +23,3 @@ class MammotionCommand(MessageSystem, MessageNavigation, MessageNetwork, Message
|
|
23
23
|
|
24
24
|
def set_device_product_key(self, product_key: str) -> None:
|
25
25
|
self._product_key = product_key
|
26
|
-
|
27
|
-
"""BLE commands for Luba."""
|
28
|
-
|
29
|
-
def send_todev_ble_sync(self, sync_type: int) -> bytes:
|
30
|
-
commEsp = dev_net_pb2.DevNet(todev_ble_sync=sync_type)
|
31
|
-
|
32
|
-
lubaMsg = luba_msg_pb2.LubaMsg()
|
33
|
-
lubaMsg.msgtype = luba_msg_pb2.MSG_CMD_TYPE_ESP
|
34
|
-
lubaMsg.sender = luba_msg_pb2.DEV_MOBILEAPP
|
35
|
-
lubaMsg.msgattr = luba_msg_pb2.MSG_ATTR_REQ
|
36
|
-
lubaMsg.seqs = 1
|
37
|
-
lubaMsg.version = 1
|
38
|
-
lubaMsg.subtype = 1
|
39
|
-
lubaMsg.net.CopyFrom(commEsp)
|
40
|
-
return lubaMsg.SerializeToString()
|
@@ -26,6 +26,10 @@ class MessageNetwork:
|
|
26
26
|
|
27
27
|
return luba_msg.SerializeToString()
|
28
28
|
|
29
|
+
def send_todev_ble_sync(self, sync_type: int) -> bytes:
|
30
|
+
comm_esp = dev_net_pb2.DevNet(todev_ble_sync=sync_type)
|
31
|
+
return self.send_order_msg_net(comm_esp)
|
32
|
+
|
29
33
|
def get_device_base_info(self):
|
30
34
|
net = dev_net_pb2.DevNet(todev_devinfo_req=dev_net_pb2.DrvDevInfoReq())
|
31
35
|
net.todev_devinfo_req.req_ids.add(id=1, type=6)
|
@@ -266,6 +266,7 @@ class Mammotion(object):
|
|
266
266
|
_LOGGER.debug("CountryCode: " + country_code)
|
267
267
|
_LOGGER.debug("AuthCode: " + mammotion_http.login_info.authorization_code)
|
268
268
|
loop = asyncio.get_running_loop()
|
269
|
+
cloud_client.set_http(mammotion_http)
|
269
270
|
await loop.run_in_executor(None, cloud_client.get_region, country_code, mammotion_http.login_info.authorization_code)
|
270
271
|
await cloud_client.connect()
|
271
272
|
await cloud_client.login_by_oauth(country_code, mammotion_http.login_info.authorization_code)
|
@@ -299,7 +300,7 @@ class Mammotion(object):
|
|
299
300
|
return await device.cloud().command(key, **kwargs)
|
300
301
|
# TODO work with both with EITHER
|
301
302
|
|
302
|
-
async def start_sync(self,name:str, retry: int):
|
303
|
+
async def start_sync(self, name:str, retry: int):
|
303
304
|
device = self.get_device_by_name(name)
|
304
305
|
if device:
|
305
306
|
if self._preference is ConnectionPreference.BLUETOOTH:
|
@@ -815,7 +816,6 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
|
|
815
816
|
except asyncio.TimeoutError:
|
816
817
|
timeout_expired = True
|
817
818
|
notify_msg = b''
|
818
|
-
self._notify_future.set_result(notify_msg)
|
819
819
|
finally:
|
820
820
|
if not timeout_expired:
|
821
821
|
timeout_handle.cancel()
|
@@ -1015,11 +1015,12 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
|
|
1015
1015
|
"""Callback for when MQTT is subscribed to events."""
|
1016
1016
|
loop = asyncio.get_event_loop()
|
1017
1017
|
|
1018
|
-
|
1019
|
-
self.loop.create_task(self.on_ready_callback)
|
1018
|
+
|
1020
1019
|
await self._ble_sync()
|
1021
1020
|
await self.run_periodic_sync_task()
|
1022
1021
|
loop.create_task(self._process_queue())
|
1022
|
+
if self.on_ready_callback:
|
1023
|
+
await self.on_ready_callback()
|
1023
1024
|
|
1024
1025
|
async def on_connected(self):
|
1025
1026
|
"""Callback for when MQTT connects."""
|
@@ -1219,3 +1220,6 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
|
|
1219
1220
|
def _disconnect(self):
|
1220
1221
|
"""Disconnect the MQTT client."""
|
1221
1222
|
self._mqtt_client.disconnect()
|
1223
|
+
|
1224
|
+
|
1225
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
pymammotion/__init__.py,sha256=kmnjdt3AEMejIz5JK7h1tTJj5ZriAgKwZBa3ScA4-Ao,1516
|
2
2
|
pymammotion/aliyun/__init__.py,sha256=T1lkX7TRYiL4nqYanG4l4MImV-SlavSbuooC-W-uUGw,29
|
3
|
-
pymammotion/aliyun/cloud_gateway.py,sha256=
|
3
|
+
pymammotion/aliyun/cloud_gateway.py,sha256=L3efICH21kHNz2eXpReGoTBoTQU-PERX5RTyS7J6eDA,22576
|
4
4
|
pymammotion/aliyun/cloud_service.py,sha256=YWcKuKK6iRWy5mTnBYgHxcCusiRGGzQt3spSf7dGDss,2183
|
5
5
|
pymammotion/aliyun/dataclass/aep_response.py,sha256=8f6GIP58ve8gd6AL3HBoXxsy0n2q4ygWvjELGnoOnVc,452
|
6
6
|
pymammotion/aliyun/dataclass/connect_response.py,sha256=Yz-fEbDzgGPTo5Of2oAjmFkSv08T7ze80pQU4k-gKIU,824
|
@@ -35,7 +35,7 @@ pymammotion/data/model/rapid_state.py,sha256=BdJFD_DlhrVneg-PqEruqCoMty-CR7q_9Qn
|
|
35
35
|
pymammotion/data/model/region_data.py,sha256=75xOTM1qeRbSROp53eIczw3yCmYM9DgMjMh8qE9xkKo,2880
|
36
36
|
pymammotion/data/model/report_info.py,sha256=1Rj_yRZ9apWX296QHae5prdObDbs32bsQf9rzMz2KEQ,4458
|
37
37
|
pymammotion/data/mqtt/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
38
|
-
pymammotion/data/mqtt/event.py,sha256=
|
38
|
+
pymammotion/data/mqtt/event.py,sha256=ec5TfIBaPZefTKTM3SBweM758hYR3ocjb7rNUMpttn0,4522
|
39
39
|
pymammotion/data/mqtt/properties.py,sha256=HkBPghr26L9_b4QaOi1DtPgb0UoPIOGSe9wb3kgnM6Y,2815
|
40
40
|
pymammotion/data/mqtt/status.py,sha256=zqnlo-MzejEQZszl0i0Wucoc3E76x6UtI9JLxoBnu54,1067
|
41
41
|
pymammotion/data/state_manager.py,sha256=T6slACOpbnhWVKmJD_XrBY9vrcCFc6q2l6jEf-g89NQ,3095
|
@@ -46,19 +46,19 @@ pymammotion/http/http.py,sha256=XJ8_i20HwZ94BqKxCF29dRtRyP_gNOwqJ8gue4F7SOw,2491
|
|
46
46
|
pymammotion/mammotion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
47
47
|
pymammotion/mammotion/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
48
48
|
pymammotion/mammotion/commands/abstract_message.py,sha256=nw6r7694yzl7iJKqRqhLmAPRjd_TL_Xo_-JXq2_a_ug,222
|
49
|
-
pymammotion/mammotion/commands/mammotion_command.py,sha256=
|
49
|
+
pymammotion/mammotion/commands/mammotion_command.py,sha256=84XxnatnBm_5WQ_KOa2N0ltydQOhSvCme3fFqkuyEhg,1056
|
50
50
|
pymammotion/mammotion/commands/messages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
51
|
pymammotion/mammotion/commands/messages/driver.py,sha256=IFtmp9gJ3p3U2xtTgWVpKBMbnVnUht6Ioih17po6Hr4,3783
|
52
52
|
pymammotion/mammotion/commands/messages/media.py,sha256=ps0l06CXy5Ej--gTNCsyKttwo7yHLVrJUpn-wNJYecs,1150
|
53
53
|
pymammotion/mammotion/commands/messages/navigation.py,sha256=-qit4SrtMpnPr0qsub_HD0pzKMlYsyzspW5uf1Ym008,23217
|
54
|
-
pymammotion/mammotion/commands/messages/network.py,sha256=
|
54
|
+
pymammotion/mammotion/commands/messages/network.py,sha256=Hv5u7omEdffpTsOKw-uIlfhRkd_X1GyvKJT-nswHJ2w,8490
|
55
55
|
pymammotion/mammotion/commands/messages/ota.py,sha256=XkeuWBZtpYMMBze6r8UN7dJXbe2FxUNGNnjwBpXJKM0,1240
|
56
56
|
pymammotion/mammotion/commands/messages/system.py,sha256=m4Cc1zUcLgMFCu6zp5rMupwjDnMD-1PM6hqXpXuXRtw,10984
|
57
57
|
pymammotion/mammotion/commands/messages/video.py,sha256=_8lJsU4sLm2CGnc7RDkueA0A51Ysui6x7SqFnhX8O2g,1007
|
58
58
|
pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
59
|
pymammotion/mammotion/control/joystick.py,sha256=mresPubTlWCuLQBOFD9KTyYJz5BjZgqt52BaRodemhM,5557
|
60
60
|
pymammotion/mammotion/devices/__init__.py,sha256=T72jt0ejtMjo1rPmn_FeMF3pmp0LLeRRpc9WcDKEYYY,126
|
61
|
-
pymammotion/mammotion/devices/mammotion.py,sha256=
|
61
|
+
pymammotion/mammotion/devices/mammotion.py,sha256=BVbBNnZPmeybc825cPe6_jVT990XSIKngzVPPfPaRO8,49389
|
62
62
|
pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
|
63
63
|
pymammotion/mqtt/mammotion_future.py,sha256=WKnHqeHiS2Ut-SaDBNOxqh1jDLeTiyLTsJ7PNUexrjk,687
|
64
64
|
pymammotion/mqtt/mammotion_mqtt.py,sha256=X012f5RvmZI52FlgchLSWbngvPnkv9M_gTYvJHakYaM,8127
|
@@ -113,7 +113,7 @@ pymammotion/utility/map.py,sha256=aoi-Luzuph02hKynTofMoq3mnPstanx75MDAVv49CuY,22
|
|
113
113
|
pymammotion/utility/movement.py,sha256=JISPBWCOe4MqHbhmkewhV5aWykr1p6f01DzJfvOF-J8,613
|
114
114
|
pymammotion/utility/periodic.py,sha256=9wJMfwXPlx6Mbp3Fws7LLTI34ZDKphH1bva_Ggyk32g,3281
|
115
115
|
pymammotion/utility/rocker_util.py,sha256=syPL0QN4zMzHiTIkUKS7RXBBptjdbkfNlPddwUD5V3A,7171
|
116
|
-
pymammotion-0.2.
|
117
|
-
pymammotion-0.2.
|
118
|
-
pymammotion-0.2.
|
119
|
-
pymammotion-0.2.
|
116
|
+
pymammotion-0.2.26.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
117
|
+
pymammotion-0.2.26.dist-info/METADATA,sha256=jgySr-dJ6A7bczMdRHMbWc1Q9cHpvf1jM5BLNeQMgIM,3969
|
118
|
+
pymammotion-0.2.26.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
119
|
+
pymammotion-0.2.26.dist-info/RECORD,,
|
File without changes
|
File without changes
|