pymammotion 0.5.14__py3-none-any.whl → 0.5.15__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.
Potentially problematic release.
This version of pymammotion might be problematic. Click here for more details.
- pymammotion/aliyun/cloud_gateway.py +45 -1
- pymammotion/aliyun/model/thing_response.py +12 -0
- pymammotion/data/model/device.py +17 -0
- pymammotion/data/mqtt/status.py +1 -1
- pymammotion/http/http.py +24 -7
- pymammotion/http/model/rtk.py +16 -0
- {pymammotion-0.5.14.dist-info → pymammotion-0.5.15.dist-info}/METADATA +1 -1
- {pymammotion-0.5.14.dist-info → pymammotion-0.5.15.dist-info}/RECORD +10 -8
- {pymammotion-0.5.14.dist-info → pymammotion-0.5.15.dist-info}/LICENSE +0 -0
- {pymammotion-0.5.14.dist-info → pymammotion-0.5.15.dist-info}/WHEEL +0 -0
|
@@ -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
|
pymammotion/data/model/device.py
CHANGED
|
@@ -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)
|
pymammotion/data/mqtt/status.py
CHANGED
|
@@ -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
|
pymammotion/http/http.py
CHANGED
|
@@ -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=
|
|
233
|
-
username
|
|
234
|
-
password
|
|
235
|
-
client_id
|
|
236
|
-
client_secret
|
|
237
|
-
grant_type
|
|
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
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
pymammotion/__init__.py,sha256=H-U94bNLp0LPC6hkRopVEUlUsZSR97n7WfKGPjK1GMg,1638
|
|
2
2
|
pymammotion/aliyun/__init__.py,sha256=T1lkX7TRYiL4nqYanG4l4MImV-SlavSbuooC-W-uUGw,29
|
|
3
3
|
pymammotion/aliyun/client.py,sha256=GCpAnLOVWW_W0c8UvdRpWVzZH5oLto8JZnb82stJi-8,9662
|
|
4
|
-
pymammotion/aliyun/cloud_gateway.py,sha256=
|
|
4
|
+
pymammotion/aliyun/cloud_gateway.py,sha256=Qhzs3UtkAnVQljf4qtFiOdd4bz04oHzJT-ZPvnM2CdQ,31250
|
|
5
5
|
pymammotion/aliyun/model/aep_response.py,sha256=EY4uMTJ4F9rvbcXnAOc5YKi7q__9kIVgfDwfyr65Gk0,421
|
|
6
6
|
pymammotion/aliyun/model/connect_response.py,sha256=Yz-fEbDzgGPTo5Of2oAjmFkSv08T7ze80pQU4k-gKIU,824
|
|
7
7
|
pymammotion/aliyun/model/dev_by_account_response.py,sha256=P9yYy4Z2tLkJSqXA_5XGaCUliSSVa5ILl7VoMtL_tCA,977
|
|
8
8
|
pymammotion/aliyun/model/login_by_oauth_response.py,sha256=g7JnvEjoa3SplHd-UqCuK6x0qtODpHlDyJCHRz7tfDI,1228
|
|
9
9
|
pymammotion/aliyun/model/regions_response.py,sha256=HSnpPcgpjr6VNXBQHw__gn-xWCkQ-MZ-Tmus9_va9mI,635
|
|
10
10
|
pymammotion/aliyun/model/session_by_authcode_response.py,sha256=0owdNcGFIP7rsVqLIf9rT-iOtvWmKCt2AW0cUUXwFiQ,427
|
|
11
|
+
pymammotion/aliyun/model/thing_response.py,sha256=23gUpB8EX3jNICp-p4Gytxs4qAfzKVr8anUA9JCl4XM,273
|
|
11
12
|
pymammotion/aliyun/regions.py,sha256=ctlRGrmdE4-xgItl9slCANYOV502qVN5lkAU4lj92sk,2518
|
|
12
13
|
pymammotion/aliyun/tea/core.py,sha256=4SjhRkbPMbw-uI0lQnCN0SBNAHAgVFrpHeaauuu6nZY,10200
|
|
13
14
|
pymammotion/aliyun/tmp_constant.py,sha256=M4Hq_lrGB3LZdX6R2XohRPFoK1NDnNV-pTJwJcJ9838,6650
|
|
@@ -25,7 +26,7 @@ pymammotion/const.py,sha256=lWRxvTVdXnNHuxqvRkjO5ziK0Ic-fZMM6J2dbe5M6Nc,385
|
|
|
25
26
|
pymammotion/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
27
|
pymammotion/data/model/__init__.py,sha256=UVRbSXGOjYnWv30ZEvzT5QRpdVqAbyeToo-t0QBWyi4,292
|
|
27
28
|
pymammotion/data/model/account.py,sha256=vJM-KTf2q6eBfVC-UlNHBSmJvqHiCawZ40vnuhXhaz8,140
|
|
28
|
-
pymammotion/data/model/device.py,sha256=
|
|
29
|
+
pymammotion/data/model/device.py,sha256=4e5q3slI7fjpizr0DsZIFcJoiCnQtRv0ty_dliDScH8,8288
|
|
29
30
|
pymammotion/data/model/device_config.py,sha256=DTnoePsMwJrKVXqGeKvbZQjs8Zab61U5T3b-c-w0WlM,2654
|
|
30
31
|
pymammotion/data/model/device_info.py,sha256=Q5PbPdTfd948ZWc8EHjN5zwU6pha5MCr47ZEXzCYKNY,1148
|
|
31
32
|
pymammotion/data/model/device_limits.py,sha256=m8HdxD-RaAkPm7jHYb9GLxMEH9IfzBPz0ZypmsLnId4,1946
|
|
@@ -45,18 +46,19 @@ pymammotion/data/model/work.py,sha256=AfKMItFqnRtAlVHzKCfYY-BQy-WFDYZBzdj-9Yc03b
|
|
|
45
46
|
pymammotion/data/mqtt/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
46
47
|
pymammotion/data/mqtt/event.py,sha256=pj65y93ACcTzUIJkHZC6s_pRFBYaNMSU1wyYRhiGvw4,5571
|
|
47
48
|
pymammotion/data/mqtt/properties.py,sha256=laud9rE-JqBHWKZ44Dov2yMkp3Ld8ghpBwlZ4_3g9uQ,4321
|
|
48
|
-
pymammotion/data/mqtt/status.py,sha256=
|
|
49
|
+
pymammotion/data/mqtt/status.py,sha256=qwZPevIzScePA_25nbRWMN7IhU-MhhtIl7fcZKAJfIc,1102
|
|
49
50
|
pymammotion/data/state_manager.py,sha256=AyrXwcU7SxliQ1r8b_QqFMkMoS6l0VE-XfxLq7NZ5go,12107
|
|
50
51
|
pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
|
|
51
52
|
pymammotion/event/event.py,sha256=Z8WYxv_-5khEqKjL1w4c_Et24G1Kdm8QFuIBylD3h3U,3021
|
|
52
53
|
pymammotion/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
54
|
pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
55
|
pymammotion/http/encryption.py,sha256=lzXu3WwBdQlzjXxWnlJuRgkCrKdPbxx5drhMitVKIEk,8287
|
|
55
|
-
pymammotion/http/http.py,sha256
|
|
56
|
+
pymammotion/http/http.py,sha256=a-EGTagL2wAdTYbDpQSoRciCdGoWky6Qbrl2U5XOXVg,13157
|
|
56
57
|
pymammotion/http/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
58
|
pymammotion/http/model/camera_stream.py,sha256=ilxQNny_w9Frwt-m8kbHinvyjDv4Bx8C2swfZ2lTEDE,600
|
|
58
59
|
pymammotion/http/model/http.py,sha256=VDBmi9nyY5Y2ns_HYvKIyzbkKRxhZ5elpq0lWXWzbGw,4123
|
|
59
60
|
pymammotion/http/model/response_factory.py,sha256=f5_ZR0-4sLOU-q28BVy5sQOReSoND2A8UvpOOwnwrzA,1936
|
|
61
|
+
pymammotion/http/model/rtk.py,sha256=pR2mi6_Y8oTPlqDXWLk7oaUqmcgcrBQ0f3MJdC0_CUg,491
|
|
60
62
|
pymammotion/mammotion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
63
|
pymammotion/mammotion/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
64
|
pymammotion/mammotion/commands/abstract_message.py,sha256=M4qL-Yw5g3fTgS9jB9LUSgJSAqpUf7MME-2mfv471Sk,808
|
|
@@ -125,7 +127,7 @@ pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tp
|
|
|
125
127
|
pymammotion/utility/mur_mur_hash.py,sha256=xEfOZVbqRawJj66eLgtnZ85OauDR47oIPr29OHelzPI,4468
|
|
126
128
|
pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
|
|
127
129
|
pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
|
|
128
|
-
pymammotion-0.5.
|
|
129
|
-
pymammotion-0.5.
|
|
130
|
-
pymammotion-0.5.
|
|
131
|
-
pymammotion-0.5.
|
|
130
|
+
pymammotion-0.5.15.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
131
|
+
pymammotion-0.5.15.dist-info/METADATA,sha256=LsO3ACCgRJjuuc8XSeSKCvphDUOilr5f9jCjKoAeuro,3871
|
|
132
|
+
pymammotion-0.5.15.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
133
|
+
pymammotion-0.5.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|