pymammotion 0.2.16__tar.gz → 0.2.18__tar.gz

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.

Files changed (117) hide show
  1. {pymammotion-0.2.16 → pymammotion-0.2.18}/PKG-INFO +1 -1
  2. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/cloud_gateway.py +13 -7
  3. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/dataclass/login_by_oauth_response.py +1 -1
  4. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/const.py +2 -2
  5. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/mqtt/event.py +17 -5
  6. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/state_manager.py +4 -0
  7. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/http/http.py +1 -1
  8. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/devices/mammotion.py +6 -4
  9. {pymammotion-0.2.16 → pymammotion-0.2.18}/pyproject.toml +3 -3
  10. {pymammotion-0.2.16 → pymammotion-0.2.18}/LICENSE +0 -0
  11. {pymammotion-0.2.16 → pymammotion-0.2.18}/README.md +0 -0
  12. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/__init__.py +0 -0
  13. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/__init__.py +0 -0
  14. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/cloud_service.py +0 -0
  15. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/dataclass/aep_response.py +0 -0
  16. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/dataclass/connect_response.py +0 -0
  17. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/dataclass/dev_by_account_response.py +0 -0
  18. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/dataclass/regions_response.py +0 -0
  19. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/dataclass/session_by_authcode_response.py +0 -0
  20. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/aliyun/tmp_constant.py +0 -0
  21. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/__init__.py +0 -0
  22. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/ble.py +0 -0
  23. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/ble_message.py +0 -0
  24. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/const.py +0 -0
  25. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/data/__init__.py +0 -0
  26. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/data/convert.py +0 -0
  27. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/data/framectrldata.py +0 -0
  28. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/bluetooth/data/notifydata.py +0 -0
  29. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/__init__.py +0 -0
  30. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/__init__.py +0 -0
  31. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/account.py +0 -0
  32. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/device.py +0 -0
  33. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/device_config.py +0 -0
  34. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/enums.py +0 -0
  35. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/excute_boarder_params.py +0 -0
  36. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/execute_boarder.py +0 -0
  37. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/generate_route_information.py +0 -0
  38. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/hash_list.py +0 -0
  39. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/location.py +0 -0
  40. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/mowing_modes.py +0 -0
  41. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/plan.py +0 -0
  42. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/rapid_state.py +0 -0
  43. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/region_data.py +0 -0
  44. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/model/report_info.py +0 -0
  45. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/mqtt/__init__.py +0 -0
  46. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/mqtt/properties.py +0 -0
  47. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/data/mqtt/status.py +0 -0
  48. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/event/__init__.py +0 -0
  49. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/event/event.py +0 -0
  50. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/http/_init_.py +0 -0
  51. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/__init__.py +0 -0
  52. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/__init__.py +0 -0
  53. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/abstract_message.py +0 -0
  54. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/mammotion_command.py +0 -0
  55. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/__init__.py +0 -0
  56. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/driver.py +0 -0
  57. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/media.py +0 -0
  58. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/navigation.py +0 -0
  59. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/network.py +0 -0
  60. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/ota.py +0 -0
  61. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/system.py +0 -0
  62. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/commands/messages/video.py +0 -0
  63. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/control/__init__.py +0 -0
  64. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/control/joystick.py +0 -0
  65. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mammotion/devices/__init__.py +0 -0
  66. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mqtt/__init__.py +0 -0
  67. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mqtt/mammotion_future.py +0 -0
  68. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/mqtt/mammotion_mqtt.py +0 -0
  69. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/__init__.py +0 -0
  70. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/basestation.proto +0 -0
  71. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/basestation.py +0 -0
  72. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/basestation_pb2.py +0 -0
  73. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/basestation_pb2.pyi +0 -0
  74. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/common.proto +0 -0
  75. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/common.py +0 -0
  76. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/common_pb2.py +0 -0
  77. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/common_pb2.pyi +0 -0
  78. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/dev_net.proto +0 -0
  79. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/dev_net.py +0 -0
  80. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/dev_net_pb2.py +0 -0
  81. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/dev_net_pb2.pyi +0 -0
  82. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_msg.proto +0 -0
  83. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_msg.py +0 -0
  84. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_msg_pb2.py +0 -0
  85. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_msg_pb2.pyi +0 -0
  86. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_mul.proto +0 -0
  87. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_mul.py +0 -0
  88. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_mul_pb2.py +0 -0
  89. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/luba_mul_pb2.pyi +0 -0
  90. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_driver.proto +0 -0
  91. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_driver.py +0 -0
  92. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_driver_pb2.py +0 -0
  93. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_driver_pb2.pyi +0 -0
  94. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_nav.proto +0 -0
  95. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_nav.py +0 -0
  96. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_nav_pb2.py +0 -0
  97. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_nav_pb2.pyi +0 -0
  98. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_ota.proto +0 -0
  99. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_ota.py +0 -0
  100. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_ota_pb2.py +0 -0
  101. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_ota_pb2.pyi +0 -0
  102. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_pept.proto +0 -0
  103. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_pept.py +0 -0
  104. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_pept_pb2.py +0 -0
  105. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_pept_pb2.pyi +0 -0
  106. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_sys.proto +0 -0
  107. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_sys.py +0 -0
  108. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_sys_pb2.py +0 -0
  109. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/proto/mctrl_sys_pb2.pyi +0 -0
  110. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/py.typed +0 -0
  111. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/utility/constant/__init__.py +0 -0
  112. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/utility/constant/device_constant.py +0 -0
  113. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/utility/datatype_converter.py +0 -0
  114. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/utility/device_type.py +0 -0
  115. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/utility/map.py +0 -0
  116. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/utility/periodic.py +0 -0
  117. {pymammotion-0.2.16 → pymammotion-0.2.18}/pymammotion/utility/rocker_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymammotion
3
- Version: 0.2.16
3
+ Version: 0.2.18
4
4
  Summary:
5
5
  License: GNU-3.0
6
6
  Author: Michael Arthur
@@ -11,6 +11,7 @@ import time
11
11
  import uuid
12
12
  from logging import getLogger, exception
13
13
  from datetime import datetime
14
+ from urllib.parse import urlencode
14
15
 
15
16
  from aiohttp import ClientSession
16
17
  from alibabacloud_iot_api_gateway.client import Client
@@ -241,6 +242,7 @@ class CloudIOTGateway:
241
242
  async def connect(self):
242
243
  """Connect to the Aliyun Cloud IoT Gateway."""
243
244
  region_url = "sdk.openaccount.aliyun.com"
245
+ time_now = time.time()
244
246
  async with ClientSession() as session:
245
247
  headers = {
246
248
  "host": region_url,
@@ -323,7 +325,7 @@ class CloudIOTGateway:
323
325
  "x-ca-key": self._app_key,
324
326
  "x-ca-signaturemethod": "HmacSHA256",
325
327
  "accept": "application/json",
326
- "content-type": "application/x-www-form-urlencoded",
328
+ "content-type": "application/x-www-form-urlencoded; charset=utf-8",
327
329
  "user-agent": UtilClient.get_user_agent(None),
328
330
  "vid": self._connect_response.data.vid,
329
331
  }
@@ -331,14 +333,16 @@ class CloudIOTGateway:
331
333
  _bodyParam = {
332
334
  "country": country_code,
333
335
  "authCode": auth_code,
334
- "oauthPlateform": "23",
336
+ "oauthPlateform": 23,
335
337
  "oauthAppKey": self._app_key,
336
- "appAuthToken": self._device_sn,
337
338
  "riskControlInfo": {
338
339
  "appID": "com.agilexrobotics",
340
+ "appAuthToken": "",
339
341
  "signType": "RSA",
342
+ "sdkVersion": "3.4.2",
340
343
  "utdid": self._utdid,
341
344
  "umidToken": self._utdid,
345
+ "deviceId": self._connect_response.data.data.device.data.deviceId,
342
346
  "USE_OA_PWD_ENCRYPT": "true",
343
347
  "USE_H5_NC": "true",
344
348
  },
@@ -354,12 +358,12 @@ class CloudIOTGateway:
354
358
  header = "".join(f"{k}:{dic[k]}\n" for k in keys).strip()
355
359
 
356
360
  headers["x-ca-signature-headers"] = sign_headers
357
- string_to_sign = "POST\n{}\n\n{}\n{}\n{}\n/api/prd/loginbyoauth.json?loginByOauthRequest={}".format(
361
+ string_to_sign = "POST\n{}\n\n{}\n{}\n{}\n/api/prd/loginbyoauth.json?{}".format(
358
362
  headers["accept"],
359
363
  headers["content-type"],
360
364
  headers["date"],
361
365
  header,
362
- json.dumps(_bodyParam, separators=(",", ":")),
366
+ f"loginByOauthRequest={json.dumps(_bodyParam, separators=(",", ":"))}",
363
367
  )
364
368
 
365
369
  hash_val = hmac.new(
@@ -369,12 +373,14 @@ class CloudIOTGateway:
369
373
  ).digest()
370
374
  signature = base64.b64encode(hash_val).decode("utf-8")
371
375
  headers["x-ca-signature"] = signature
372
-
373
376
  async with session.post(
374
377
  f"https://{region_url}/api/prd/loginbyoauth.json",
375
378
  headers=headers,
376
- params={"loginByOauthRequest": json.dumps(_bodyParam, separators=(",", ":"))},
379
+ data={
380
+ 'loginByOauthRequest': json.dumps(_bodyParam, separators=(",", ":"))
381
+ }
377
382
  ) as resp:
383
+
378
384
  data = await resp.json()
379
385
  logger.debug(data)
380
386
  if resp.status == 200:
@@ -53,8 +53,8 @@ class InnerData(DataClassORJSONMixin):
53
53
  data: InnerDataContent
54
54
  subCode: int
55
55
  message: str
56
- deviceId: str
57
56
  successful: str
57
+ deviceId: Optional[str] = None
58
58
 
59
59
 
60
60
  @dataclass
@@ -2,8 +2,8 @@
2
2
 
3
3
  APP_KEY = "34231230"
4
4
  APP_SECRET = "1ba85698bb10e19c6437413b61ba3445"
5
- APP_VERSION = "1.11.1220"
5
+ APP_VERSION = "1.11.130"
6
6
  ALIYUN_DOMAIN = "api.link.aliyun.com"
7
- MAMMOTION_DOMAIN = "https://domestic.mammotion.com"
7
+ MAMMOTION_DOMAIN = "https://id.mammotion.com"
8
8
  MAMMOTION_CLIENT_ID = "MADKALUBAS"
9
9
  MAMMOTION_CLIENT_SECRET = "GshzGRZJjuMUgd2sYHM7"
@@ -45,10 +45,15 @@ class DeviceWarningEventValue(DataClassORJSONMixin):
45
45
  # (see resources/res/values-en-rUS/strings.xml in APK)
46
46
  code: int
47
47
 
48
+ @dataclass
49
+ class DeviceConfigurationRequestValue(DataClassORJSONMixin):
50
+ code: int
51
+ bizId: str
52
+ params: str
53
+
48
54
 
49
55
  @dataclass
50
56
  class GeneralParams(DataClassORJSONMixin):
51
- identifier: str
52
57
  groupIdList: list[str]
53
58
  groupId: str
54
59
  categoryKey: Literal["LawnMower"]
@@ -67,7 +72,7 @@ class GeneralParams(DataClassORJSONMixin):
67
72
  tenantInstanceId: str
68
73
  value: Any
69
74
 
70
- # Campi opzionali
75
+ identifier: Optional[str] = None
71
76
  checkFailedData: Optional[dict] = None
72
77
  _tenantId: Optional[str] = None
73
78
  generateTime: Optional[int] = None
@@ -92,6 +97,11 @@ class DeviceWarningEventParams(GeneralParams):
92
97
  type: Literal["alert"]
93
98
  value: DeviceWarningEventValue
94
99
 
100
+ @dataclass
101
+ class DeviceConfigurationRequestEvent(GeneralParams):
102
+ type: Literal["info"]
103
+ value: DeviceConfigurationRequestValue
104
+
95
105
 
96
106
  @dataclass
97
107
  class ThingEventMessage(DataClassORJSONMixin):
@@ -102,7 +112,7 @@ class ThingEventMessage(DataClassORJSONMixin):
102
112
 
103
113
  @classmethod
104
114
  def from_dicts(cls, payload: dict) -> "ThingEventMessage":
105
- """Deserializza il payload JSON in un'istanza di ThingEventMessage."""
115
+ """Deserialize payload JSON ThingEventMessage."""
106
116
  method = payload.get("method")
107
117
  event_id = payload.get("id")
108
118
  params_dict = payload.get("params", {})
@@ -110,7 +120,10 @@ class ThingEventMessage(DataClassORJSONMixin):
110
120
 
111
121
  # Determina quale classe usare per i parametri
112
122
  identifier = params_dict.get("identifier")
113
- if identifier == "device_protobuf_msg_event":
123
+ if identifier is None:
124
+ """Request configuration event."""
125
+ params_obj = DeviceConfigurationRequestEvent(**params_dict)
126
+ elif identifier == "device_protobuf_msg_event":
114
127
  params_obj = DeviceProtobufMsgEventParams(**params_dict)
115
128
  elif identifier == "device_warning_event":
116
129
  params_obj = DeviceWarningEventParams(**params_dict)
@@ -119,5 +132,4 @@ class ThingEventMessage(DataClassORJSONMixin):
119
132
  else:
120
133
  raise ValueError(f"Unknown identifier: {identifier}")
121
134
 
122
- # Crea e restituisce l'istanza di ThingEventMessage
123
135
  return cls(method=method, id=event_id, params=params_obj, version=version)
@@ -17,6 +17,7 @@ class StateManager:
17
17
  self._device = device
18
18
  self.gethash_ack_callback: Optional[Callable[[NavGetHashListAck],Awaitable[None]]] = None
19
19
  self.get_commondata_ack_callback: Optional[Callable[[NavGetCommDataAck],Awaitable[None]]] = None
20
+ self.on_notification_callback: Optional[Callable[[],Awaitable[None]]] = None
20
21
 
21
22
  def get_device(self) -> MowingDevice:
22
23
  """Get device."""
@@ -44,6 +45,9 @@ class StateManager:
44
45
  case "ota":
45
46
  self._update_ota_data(message)
46
47
 
48
+ if self.on_notification_callback:
49
+ await self.on_notification_callback()
50
+
47
51
  async def _update_nav_data(self, message):
48
52
  """Update nav data."""
49
53
  nav_msg = betterproto.which_one_of(message.nav, "SubNavMsg")
@@ -55,7 +55,7 @@ class MammotionHTTP:
55
55
  @classmethod
56
56
  async def login(cls, session: ClientSession, username: str, password: str) -> Response[LoginResponseData]:
57
57
  async with session.post(
58
- "/user-server/v1/user/oauth/token",
58
+ "/oauth/token",
59
59
  params=dict(
60
60
  username=username,
61
61
  password=password,
@@ -346,6 +346,9 @@ class MammotionBaseDevice:
346
346
  self._notify_future: asyncio.Future[bytes] | None = None
347
347
  self._cloud_device = cloud_device
348
348
 
349
+ def set_notifiction_callback(self, func: Callable[[],Awaitable[None]]):
350
+ self._state_manager.on_notification_callback = func
351
+
349
352
  async def datahash_response(self, hash_ack: NavGetHashListAck):
350
353
  """Handle datahash responses."""
351
354
  result_hash = 0
@@ -1147,10 +1150,9 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
1147
1150
  _LOGGER.debug("Thing event received")
1148
1151
  event = ThingEventMessage.from_dicts(payload)
1149
1152
  params = event.params
1150
- if isinstance(params, str):
1151
- _LOGGER.debug("config event %s", str)
1153
+ if params.identifier is None:
1152
1154
  return
1153
- if params.identifier == "device_protobuf_msg_event" and params.thingType == "thing.events":
1155
+ if params.identifier == "device_protobuf_msg_event" and event.method == "thing.events":
1154
1156
  _LOGGER.debug("Protobuf event")
1155
1157
  binary_data = base64.b64decode(params.value.get("content", ""))
1156
1158
  self._update_raw_data(cast(bytes, binary_data))
@@ -1171,7 +1173,7 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
1171
1173
  if not fut.fut.cancelled():
1172
1174
  fut.resolve(cast(bytes, binary_data))
1173
1175
  await self._state_manager.notification(new_msg)
1174
- if params.thingType == "thing.properties":
1176
+ if event.method == "thing.properties":
1175
1177
  _LOGGER.debug(event)
1176
1178
 
1177
1179
  async def _handle_mqtt_message(self, topic: str, payload: dict) -> None:
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "pymammotion"
3
- version = "0.2.16"
3
+ version = "0.2.18"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "pymammotion"
7
- version = "0.2.16"
7
+ version = "0.2.18"
8
8
  license = "GNU-3.0"
9
9
  description = ""
10
10
  readme = "README.md"
@@ -53,7 +53,7 @@ mypy = "^1.10.0"
53
53
  pre-commit = "^3.7.1"
54
54
 
55
55
  [tool.bumpver]
56
- current_version = "0.2.16"
56
+ current_version = "0.2.17"
57
57
  version_pattern = "MAJOR.MINOR.PATCH"
58
58
  commit_message = "Bump version {old_version} -> {new_version}"
59
59
  commit = true
File without changes
File without changes