pymammotion 0.4.55__py3-none-any.whl → 0.4.56__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,3 +1,4 @@
1
+ from datetime import UTC, datetime
1
2
  import time
2
3
 
3
4
  from Tea.exceptions import UnretryableException
@@ -103,7 +104,7 @@ class Client:
103
104
  _request.headers = TeaCore.merge(
104
105
  {
105
106
  "host": self._domain,
106
- "date": UtilClient.get_date_utcstring(),
107
+ "date": datetime.now(UTC).strftime("%a, %d %b %Y %H:%M:%S GMT"),
107
108
  "x-ca-nonce": UtilClient.get_nonce(),
108
109
  "x-ca-key": self._app_key,
109
110
  "x-ca-signaturemethod": "HmacSHA256",
@@ -1,7 +1,7 @@
1
1
  """Manage state from notifications into MowingDevice."""
2
2
 
3
3
  from collections.abc import Awaitable, Callable
4
- from datetime import datetime
4
+ from datetime import UTC, datetime
5
5
  import logging
6
6
  from typing import Any
7
7
 
@@ -41,7 +41,7 @@ class StateManager:
41
41
 
42
42
  def __init__(self, device: MowingDevice) -> None:
43
43
  self._device: MowingDevice = device
44
- self.last_updated_at = datetime.now()
44
+ self.last_updated_at = datetime.now(UTC)
45
45
  self.preference = ConnectionPreference.WIFI
46
46
  self.cloud_gethash_ack_callback: Callable[[NavGetHashListAck], Awaitable[None]] | None = None
47
47
  self.cloud_get_commondata_ack_callback: (
@@ -115,7 +115,7 @@ class StateManager:
115
115
  async def notification(self, message: LubaMsg) -> None:
116
116
  """Handle protobuf notifications."""
117
117
  res = betterproto.which_one_of(message, "LubaSubMsg")
118
- self.last_updated_at = datetime.now()
118
+ self.last_updated_at = datetime.now(UTC)
119
119
  # additional catch all if we don't get a status update
120
120
  if not self._device.online:
121
121
  self._device.online = True
pymammotion/http/http.py CHANGED
@@ -107,7 +107,9 @@ class MammotionHTTP:
107
107
  # TODO catch errors from mismatch like token expire etc
108
108
  # Assuming the data format matches the expected structure
109
109
  response = Response[StreamSubscriptionResponse].from_dict(data)
110
- response.data = StreamSubscriptionResponse.from_dict(data["data"])
110
+ if response.code != 0:
111
+ return response
112
+ response.data = StreamSubscriptionResponse.from_dict(data.get("data", {}))
111
113
  return response
112
114
 
113
115
  async def get_stream_subscription_mini_or_x_series(
@@ -138,7 +140,9 @@ class MammotionHTTP:
138
140
  # TODO catch errors from mismatch like token expire etc
139
141
  # Assuming the data format matches the expected structure
140
142
  response = Response[StreamSubscriptionResponse].from_dict(data)
141
- response.data = StreamSubscriptionResponse.from_dict(data["data"])
143
+ if response.code != 0:
144
+ return response
145
+ response.data = StreamSubscriptionResponse.from_dict(data.get("data", {}))
142
146
  return response
143
147
 
144
148
  async def get_video_resource(self, iot_id: str) -> Response[VideoResourceResponse]:
@@ -155,7 +159,11 @@ class MammotionHTTP:
155
159
  data = await resp.json()
156
160
  # TODO catch errors from mismatch like token expire etc
157
161
  # Assuming the data format matches the expected structure
158
- return Response[VideoResourceResponse].from_dict(data)
162
+ response = Response[VideoResourceResponse].from_dict(data)
163
+ if response.code != 0:
164
+ return response
165
+ response.data = VideoResourceResponse.from_dict(data.get("data", {}))
166
+ return response
159
167
 
160
168
  async def refresh_login(self, account: str, password: str | None = None) -> Response[LoginResponseData]:
161
169
  if self._password is None and password is not None:
@@ -202,6 +202,7 @@ class MessageSystem(AbstractMessage, ABC):
202
202
  # return self.send_order_msg_sys(build2)
203
203
 
204
204
  def send_sys_set_date_time(self) -> bytes:
205
+ # TODO get HA timezone
205
206
  calendar = datetime.datetime.now()
206
207
  i = calendar.year
207
208
  i2 = calendar.month
@@ -345,7 +345,8 @@ class MammotionBaseBLEDevice(MammotionBaseDevice):
345
345
  return
346
346
 
347
347
  new_msg = LubaMsg().parse(data)
348
- if betterproto.serialized_on_wire(new_msg.net):
348
+ res = betterproto.which_one_of(new_msg, "LubaSubMsg")
349
+ if res[0] == "net":
349
350
  if new_msg.net.todev_ble_sync != 0 or has_field(new_msg.net.toapp_wifi_iot_status):
350
351
  if has_field(new_msg.net.toapp_wifi_iot_status) and self._commands.get_device_product_key() == "":
351
352
  self._commands.set_device_product_key(new_msg.net.toapp_wifi_iot_status.productkey)
@@ -326,7 +326,8 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
326
326
  ):
327
327
  self._commands.set_device_product_key(event.params.productKey)
328
328
 
329
- if betterproto.serialized_on_wire(new_msg.net):
329
+ res = betterproto.which_one_of(new_msg, "LubaSubMsg")
330
+ if res[0] == "net":
330
331
  if new_msg.net.todev_ble_sync != 0 or has_field(new_msg.net.toapp_wifi_iot_status):
331
332
  return
332
333
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymammotion
3
- Version: 0.4.55
3
+ Version: 0.4.56
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: Michael Arthur
@@ -1,6 +1,6 @@
1
1
  pymammotion/__init__.py,sha256=H-U94bNLp0LPC6hkRopVEUlUsZSR97n7WfKGPjK1GMg,1638
2
2
  pymammotion/aliyun/__init__.py,sha256=T1lkX7TRYiL4nqYanG4l4MImV-SlavSbuooC-W-uUGw,29
3
- pymammotion/aliyun/client.py,sha256=44YqBt0advxbYYXs25Jpq438lhEXrP6xaBWWMGBLdp4,9603
3
+ pymammotion/aliyun/client.py,sha256=GCpAnLOVWW_W0c8UvdRpWVzZH5oLto8JZnb82stJi-8,9662
4
4
  pymammotion/aliyun/cloud_gateway.py,sha256=DAawjvmlrdYrxzA-C4aXPN0hTx9FIXoIn5I4JSn2adw,28712
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
@@ -45,13 +45,13 @@ pymammotion/data/mqtt/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdr
45
45
  pymammotion/data/mqtt/event.py,sha256=C8TGRJs9wNxwg9FFmr9qcsweDnl5v5kcVcwiHxtYzJw,5384
46
46
  pymammotion/data/mqtt/properties.py,sha256=pX5JRVmmpVO04CSPm5xAGcSWA_OeLd0JnBagLsfiSEc,3755
47
47
  pymammotion/data/mqtt/status.py,sha256=SgdrpE1Uldb01hybO6hYhgU1Sp1eILghC0UhMZMHrdQ,1091
48
- pymammotion/data/state_manager.py,sha256=aRpxgIxWwlMV-36YCbnIUwdcQbTrWM7p0YrQFem0wCs,10842
48
+ pymammotion/data/state_manager.py,sha256=wgTCt4fDtxx0YwwB30tXsHf5L-hRRUV1fpAEGcWpnsY,10853
49
49
  pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
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/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  pymammotion/http/encryption.py,sha256=lzXu3WwBdQlzjXxWnlJuRgkCrKdPbxx5drhMitVKIEk,8287
54
- pymammotion/http/http.py,sha256=ODG6VXGEn73WQVeH0llhw7vC1UA6lJ5p7dKJlSnx_FM,9787
54
+ pymammotion/http/http.py,sha256=MTktxlOluwE2gjsLWoQLYimiACyl1F5Joc1mosBLJpk,10150
55
55
  pymammotion/http/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
56
  pymammotion/http/model/camera_stream.py,sha256=ilxQNny_w9Frwt-m8kbHinvyjDv4Bx8C2swfZ2lTEDE,600
57
57
  pymammotion/http/model/http.py,sha256=tM5ikwVkWhRdXc2xi1NOLmWPH2mQEQelpaVgMlAEmlI,2333
@@ -65,15 +65,15 @@ pymammotion/mammotion/commands/messages/media.py,sha256=a6CY_1wEpepH9zg6-HfH1lt-
65
65
  pymammotion/mammotion/commands/messages/navigation.py,sha256=aEEpvDW5QukJ0QiWMhPjjz0eTTF1ndQuvv8a6hJlUg0,23257
66
66
  pymammotion/mammotion/commands/messages/network.py,sha256=OrmW4-BP_o3piBjwXZ12WY0HqbXHQqeDXC0YaDPeBM8,7409
67
67
  pymammotion/mammotion/commands/messages/ota.py,sha256=ZHLQRE5ETvLEIu2Vbj3m2XidIWT8uorYSHxkZd3pkRc,1376
68
- pymammotion/mammotion/commands/messages/system.py,sha256=XOEeyUAz1iNtPk37dzCbLrxx1pljUlGy1IKuof_Pko0,14244
68
+ pymammotion/mammotion/commands/messages/system.py,sha256=P_J6ikTXGuVEsekOKGEV6o-wfrFDf8ChF4Tzxz6uDtY,14275
69
69
  pymammotion/mammotion/commands/messages/video.py,sha256=KN9Zj8h7EnVipVBOzHxWF4RXhU3MpueYe1GNErGHapg,1248
70
70
  pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
71
  pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
72
72
  pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
73
73
  pymammotion/mammotion/devices/base.py,sha256=qDh7P7fnakDKgxTqjNLcQg8eE-6gHJaXAV0ONjhy_IU,12038
74
74
  pymammotion/mammotion/devices/mammotion.py,sha256=SBisZ7zbLQmo8WpLQze5lI2gDawZpzLWZ9ANTkiLV8s,14451
75
- pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=MWoaiHqNRh_bHlvjmVPRjYVauVNIVgDpOIsC-UDvYMc,18949
76
- pymammotion/mammotion/devices/mammotion_cloud.py,sha256=P352E-pcbG6wA-RXubI51EUJ3UUQcqJkxRDIqh3g-58,14217
75
+ pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=tHG4oqX5vQsEGEHNX5xbT9hfH8MFROeGsFksXFTD7QQ,18983
76
+ pymammotion/mammotion/devices/mammotion_cloud.py,sha256=PJpGFQKTdPafarh5zA1z1zU0Wr6M6tBa_YiYqi_Kd3E,14251
77
77
  pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
78
78
  pymammotion/mqtt/linkkit/__init__.py,sha256=ENgc3ynd2kd9gMQR3-kgmCu6Ed9Y6XCIzU0zFReUlkk,80
79
79
  pymammotion/mqtt/linkkit/h2client.py,sha256=w9Nvi_nY4CLD_fw-pHtYChwQf7e2TiAGeqkY_sF4cf0,19659
@@ -123,7 +123,7 @@ pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tp
123
123
  pymammotion/utility/mur_mur_hash.py,sha256=xEfOZVbqRawJj66eLgtnZ85OauDR47oIPr29OHelzPI,4468
124
124
  pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
125
125
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
126
- pymammotion-0.4.55.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
127
- pymammotion-0.4.55.dist-info/METADATA,sha256=4jYgGWTc7IL4ReWqPIUKdejtwmi78Syo_DL7jlrTY14,3878
128
- pymammotion-0.4.55.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
129
- pymammotion-0.4.55.dist-info/RECORD,,
126
+ pymammotion-0.4.56.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
127
+ pymammotion-0.4.56.dist-info/METADATA,sha256=cHeXrfxMupBNbv-44bLW-5SKV46qpME4xGq9Ctn5w3Y,3878
128
+ pymammotion-0.4.56.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
129
+ pymammotion-0.4.56.dist-info/RECORD,,