pymammotion 0.2.0__py3-none-any.whl → 0.2.2__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.

@@ -1,6 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Optional
3
3
 
4
+ from mashumaro.config import BaseConfig
4
5
  from mashumaro.mixins.orjson import DataClassORJSONMixin
5
6
 
6
7
 
@@ -16,3 +17,6 @@ class AepResponse(DataClassORJSONMixin):
16
17
  code: int
17
18
  data: DeviceData
18
19
  id: Optional[str] = None
20
+
21
+ class Config(BaseConfig):
22
+ omit_default = True
@@ -1,6 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import List, Optional
3
3
 
4
+ from mashumaro.config import BaseConfig
4
5
  from mashumaro.mixins.orjson import DataClassORJSONMixin
5
6
 
6
7
 
@@ -27,6 +28,9 @@ class Device(DataClassORJSONMixin):
27
28
  categoryImage: Optional[str] = None
28
29
  productModel: Optional[str] = None
29
30
 
31
+ class Config(BaseConfig):
32
+ omit_default = True
33
+
30
34
 
31
35
  @dataclass
32
36
  class Data(DataClassORJSONMixin):
@@ -2,6 +2,7 @@ from dataclasses import dataclass
2
2
  from typing import Optional, TypeVar
3
3
 
4
4
  from mashumaro import DataClassDictMixin
5
+ from mashumaro.config import BaseConfig
5
6
  from mashumaro.mixins.orjson import DataClassORJSONMixin
6
7
 
7
8
  DataT = TypeVar("DataT")
@@ -24,3 +25,6 @@ class RegionResponse(DataClassDictMixin):
24
25
  code: int
25
26
  id: Optional[str] = None
26
27
  msg: Optional[str] = None
28
+
29
+ class Config(BaseConfig):
30
+ omit_default = True
pymammotion/http/http.py CHANGED
@@ -50,7 +50,7 @@ class MammotionHTTP:
50
50
  def __init__(self, login: LoginResponseData):
51
51
  self._headers = dict()
52
52
  self._headers["Authorization"] = f"Bearer {login.access_token}"
53
- self.login = login
53
+ self.login_info = login
54
54
 
55
55
  @classmethod
56
56
  async def login(cls, session: ClientSession, username: str, password: str) -> Response[LoginResponseData]:
@@ -177,12 +177,12 @@ class MammotionDevice:
177
177
  cloud_client = CloudIOTGateway()
178
178
  async with ClientSession(MAMMOTION_DOMAIN) as session:
179
179
  mammotion_http = await connect_http(account, password)
180
- country_code = mammotion_http.login.userInformation.domainAbbreviation
180
+ country_code = mammotion_http.login_info.userInformation.domainAbbreviation
181
181
  _LOGGER.debug("CountryCode: " + country_code)
182
- _LOGGER.debug("AuthCode: " + mammotion_http.login.authorization_code)
183
- cloud_client.get_region(country_code, mammotion_http.login.authorization_code)
182
+ _LOGGER.debug("AuthCode: " + mammotion_http.login_info.authorization_code)
183
+ cloud_client.get_region(country_code, mammotion_http.login_info.authorization_code)
184
184
  await cloud_client.connect()
185
- await cloud_client.login_by_oauth(country_code, mammotion_http.login.authorization_code)
185
+ await cloud_client.login_by_oauth(country_code, mammotion_http.login_info.authorization_code)
186
186
  cloud_client.aep_handle()
187
187
  cloud_client.session_by_auth_code()
188
188
 
@@ -206,8 +206,19 @@ class MammotionDevice:
206
206
  return await self._cloud_device.command(key, **kwargs)
207
207
  # TODO work with both with EITHER
208
208
 
209
+ async def start_sync(self, retry: int):
210
+ if self._preference is ConnectionPreference.BLUETOOTH:
211
+ return await self._ble_device.start_sync(retry)
212
+ if self._preference is ConnectionPreference.WIFI:
213
+ return await self._cloud_device.start_sync(retry)
214
+ # TODO work with both with EITHER
209
215
 
210
-
216
+ async def start_map_sync(self):
217
+ if self._preference is ConnectionPreference.BLUETOOTH:
218
+ return await self._ble_device.start_map_sync()
219
+ if self._preference is ConnectionPreference.WIFI:
220
+ return await self._cloud_device.start_map_sync()
221
+ # TODO work with both with EITHER
211
222
 
212
223
  def has_field(message: betterproto.Message) -> bool:
213
224
  """Check if the message has any fields serialized on wire."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymammotion
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary:
5
5
  License: GNU-3.0
6
6
  Author: Michael Arthur
@@ -2,11 +2,11 @@ pymammotion/__init__.py,sha256=kmnjdt3AEMejIz5JK7h1tTJj5ZriAgKwZBa3ScA4-Ao,1516
2
2
  pymammotion/aliyun/__init__.py,sha256=T1lkX7TRYiL4nqYanG4l4MImV-SlavSbuooC-W-uUGw,29
3
3
  pymammotion/aliyun/cloud_gateway.py,sha256=7cU-40s70H8q5D53Qxnul9FenzIgzXZZXN9BEEDKMoo,18308
4
4
  pymammotion/aliyun/cloud_service.py,sha256=YWcKuKK6iRWy5mTnBYgHxcCusiRGGzQt3spSf7dGDss,2183
5
- pymammotion/aliyun/dataclass/aep_response.py,sha256=EPuTU8uN0vkbPY_8MdBKAxASSBI9r021kODeOqrcdtw,353
5
+ pymammotion/aliyun/dataclass/aep_response.py,sha256=8f6GIP58ve8gd6AL3HBoXxsy0n2q4ygWvjELGnoOnVc,452
6
6
  pymammotion/aliyun/dataclass/connect_response.py,sha256=Yz-fEbDzgGPTo5Of2oAjmFkSv08T7ze80pQU4k-gKIU,824
7
- pymammotion/aliyun/dataclass/dev_by_account_response.py,sha256=qU29Jdpjvxv6mfp4tC3V6UCCkjBwdwttuGfV2C6ELo4,878
7
+ pymammotion/aliyun/dataclass/dev_by_account_response.py,sha256=DtGeMCzoiFrfSniHoL6db9xcheQgmcTvGySkGBjKdKE,977
8
8
  pymammotion/aliyun/dataclass/login_by_oauth_response.py,sha256=6TQYAMyQ1jf_trsnTST007qlNXve3BqsvpV0Dwp7CFA,1245
9
- pymammotion/aliyun/dataclass/regions_response.py,sha256=0Kcly3OPMIEGK36O0OGFvZrHl6nJfnKzNeC4RPXvFhU,591
9
+ pymammotion/aliyun/dataclass/regions_response.py,sha256=CVPpdFhDD6_emWHyLRzOdp2j3HLPtP8tlNyzGnr8AcI,690
10
10
  pymammotion/aliyun/dataclass/session_by_authcode_response.py,sha256=wLGSX2nHkA7crmyYeE_dYly_lDtoYWAiIZjQ0C6m44o,358
11
11
  pymammotion/aliyun/tmp_constant.py,sha256=M4Hq_lrGB3LZdX6R2XohRPFoK1NDnNV-pTJwJcJ9838,6650
12
12
  pymammotion/bluetooth/__init__.py,sha256=LAl8jqZ1fPh-3mLmViNQsP3s814C1vsocYUa6oSaXt0,36
@@ -42,7 +42,7 @@ pymammotion/data/state_manager.py,sha256=ItihtkmJCeIdXOYD3YRBp241cP29oMABbSISyC5
42
42
  pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
43
43
  pymammotion/event/event.py,sha256=Fy5-I1p92AO_D67VW4eHQqA4pOt7MZsrP--tVfIVUz8,1820
44
44
  pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- pymammotion/http/http.py,sha256=VoAuDTciiueo8JRjqoZHf8wa0cfvIsFizOp8ISVHRs4,2361
45
+ pymammotion/http/http.py,sha256=9vuI8P-ClVIuXMlagMNkXzfGoNEMC3vg3qMUlZrjRS4,2366
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
@@ -58,7 +58,7 @@ pymammotion/mammotion/commands/messages/video.py,sha256=_8lJsU4sLm2CGnc7RDkueA0A
58
58
  pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  pymammotion/mammotion/control/joystick.py,sha256=EWV20MMzQuhbLlNlXbsyZKSEpeM7x1CQL7saU4Pn0-g,6165
60
60
  pymammotion/mammotion/devices/__init__.py,sha256=T72jt0ejtMjo1rPmn_FeMF3pmp0LLeRRpc9WcDKEYYY,126
61
- pymammotion/mammotion/devices/mammotion.py,sha256=HooHk3GFCwIdZ79Fb4isMR2u_B1qCWpziSzC2nuTpFU,38641
61
+ pymammotion/mammotion/devices/mammotion.py,sha256=HbPA1lqabFLLnDWcY77yXZLiGB4IkBqBXk81C-QekzQ,39308
62
62
  pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
63
63
  pymammotion/mqtt/mammotion_mqtt.py,sha256=VU0c8X1DrZSZDLCVAsCaEbLX2zcyrUbEAYaPzOXALNo,7523
64
64
  pymammotion/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -110,7 +110,7 @@ pymammotion/utility/device_type.py,sha256=KYawu2glZMVlPmxRbA4kVFujXz3miHp3rJiOWR
110
110
  pymammotion/utility/map.py,sha256=aoi-Luzuph02hKynTofMoq3mnPstanx75MDAVv49CuY,2211
111
111
  pymammotion/utility/periodic.py,sha256=9wJMfwXPlx6Mbp3Fws7LLTI34ZDKphH1bva_Ggyk32g,3281
112
112
  pymammotion/utility/rocker_util.py,sha256=syPL0QN4zMzHiTIkUKS7RXBBptjdbkfNlPddwUD5V3A,7171
113
- pymammotion-0.2.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
114
- pymammotion-0.2.0.dist-info/METADATA,sha256=Rhb3BsXkrf-fHqvTLQkqnRS1ldAsccbkc6ZhsuZpLR4,3922
115
- pymammotion-0.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
116
- pymammotion-0.2.0.dist-info/RECORD,,
113
+ pymammotion-0.2.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
114
+ pymammotion-0.2.2.dist-info/METADATA,sha256=_QE8v08z8fhxnO1R_HVdHhTV16XQuQRlDBbJh7Cbi6s,3922
115
+ pymammotion-0.2.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
116
+ pymammotion-0.2.2.dist-info/RECORD,,