pymammotion 0.4.20__py3-none-any.whl → 0.4.22__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/http/http.py CHANGED
@@ -108,8 +108,12 @@ class MammotionHTTP:
108
108
  # Assuming the data format matches the expected structure
109
109
  return Response[StreamSubscriptionResponse].from_dict(data)
110
110
 
111
- async def refresh_login(self) -> Response[LoginResponseData]:
112
- return await self.login(self.account, self._password)
111
+ async def refresh_login(self, account: str, password: str | None = None) -> Response[LoginResponseData]:
112
+ if self._password is None and password is not None:
113
+ self._password = password
114
+ if self._password is None:
115
+ raise ValueError("Password is required for refresh login")
116
+ return await self.login(account, self._password)
113
117
 
114
118
  async def login(self, account: str, password: str) -> Response[LoginResponseData]:
115
119
  self.account = account
@@ -187,14 +187,15 @@ class Mammotion:
187
187
  cloud_client = await self.login(account, password)
188
188
  await self.initiate_cloud_connection(account, cloud_client)
189
189
 
190
- async def refresh_login(self, account: str) -> None:
190
+ async def refresh_login(self, account: str, password: str | None = None) -> None:
191
191
  async with self._login_lock:
192
192
  exists: MammotionCloud | None = self.mqtt_list.get(account)
193
193
  if not exists:
194
194
  return
195
195
  mammotion_http = exists.cloud_client.mammotion_http
196
- await mammotion_http.refresh_login()
196
+ await mammotion_http.refresh_login(account, password)
197
197
  await self.connect_iot(mammotion_http, exists.cloud_client)
198
+
198
199
  if not exists.is_connected():
199
200
  loop = asyncio.get_running_loop()
200
201
  await loop.run_in_executor(None, exists.connect_async)
@@ -227,6 +227,9 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
227
227
  # self.mqtt._mqtt_client.thing_on_thing_enable(None)
228
228
 
229
229
  async def _ble_sync(self) -> None:
230
+ if self.stopped or self._mqtt.is_connected is False:
231
+ return
232
+
230
233
  command_bytes = self._commands.send_todev_ble_sync(3)
231
234
  try:
232
235
  await self._mqtt.send_command(self.iot_id, command_bytes)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymammotion
3
- Version: 0.4.20
3
+ Version: 0.4.22
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: Michael Arthur
@@ -50,7 +50,7 @@ pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8
50
50
  pymammotion/event/event.py,sha256=bj2RirSIRyBs0QvkcrOtwZWUX_8F3m1sySuHVyKmZLs,2143
51
51
  pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  pymammotion/http/encryption.py,sha256=lzXu3WwBdQlzjXxWnlJuRgkCrKdPbxx5drhMitVKIEk,8287
53
- pymammotion/http/http.py,sha256=vNjdteOz7aDQBzTg406EUNP247nKrMBIepf2_Q-oRUI,7121
53
+ pymammotion/http/http.py,sha256=doncq4jXGQt6jXzt2ZL6n8pne45jPFAVJKhGabi5LMw,7363
54
54
  pymammotion/http/model/http.py,sha256=tM5ikwVkWhRdXc2xi1NOLmWPH2mQEQelpaVgMlAEmlI,2333
55
55
  pymammotion/mammotion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
56
  pymammotion/mammotion/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -68,9 +68,9 @@ pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
68
68
  pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
69
69
  pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
70
70
  pymammotion/mammotion/devices/base.py,sha256=w7ZucgZkOBdpPajrJs-W4oZpoDRpTDYgCCdVlwOP-uo,11901
71
- pymammotion/mammotion/devices/mammotion.py,sha256=BgbXT4afkOyDAX1E52vuHNkOpqrDLKlqt9TA0gPwRTo,13624
71
+ pymammotion/mammotion/devices/mammotion.py,sha256=ffzwsQqO9zDwMElWYMsxi-J5_rGaOOOHdAm5D3DXprc,13671
72
72
  pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=B1tpnC8vrbXGKhFq-l5LR86EcCvd6iHuW5kOkhpjwgY,19541
73
- pymammotion/mammotion/devices/mammotion_cloud.py,sha256=vh35qIT5hC6h6TwwejGa_GusU_oD7_dsX9b8b526irI,13720
73
+ pymammotion/mammotion/devices/mammotion_cloud.py,sha256=_huNqjEmQr6zHtMK4j4Gep_f-jPCcufXe_vfs8F55dk,13809
74
74
  pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
75
75
  pymammotion/mqtt/linkkit/__init__.py,sha256=ENgc3ynd2kd9gMQR3-kgmCu6Ed9Y6XCIzU0zFReUlkk,80
76
76
  pymammotion/mqtt/linkkit/h2client.py,sha256=w9Nvi_nY4CLD_fw-pHtYChwQf7e2TiAGeqkY_sF4cf0,19659
@@ -119,7 +119,7 @@ pymammotion/utility/map.py,sha256=GYscVMg2cX3IPlNpCBNHDW0S55yS1WGRf1iHnNZ7TfQ,22
119
119
  pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tpfI,615
120
120
  pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
121
121
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
122
- pymammotion-0.4.20.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
123
- pymammotion-0.4.20.dist-info/METADATA,sha256=7RsPDBnwDZdAVrsW2xewSLl85Avfd5gK_w6RatBxOto,3834
124
- pymammotion-0.4.20.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
125
- pymammotion-0.4.20.dist-info/RECORD,,
122
+ pymammotion-0.4.22.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
123
+ pymammotion-0.4.22.dist-info/METADATA,sha256=nyYzsPUltG7Qm3TLQ4EryiDU7BJmUjnt5jhW4COfrFc,3834
124
+ pymammotion-0.4.22.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
125
+ pymammotion-0.4.22.dist-info/RECORD,,