pymammotion 0.4.0a5__py3-none-any.whl → 0.4.0a7__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/aliyun/cloud_gateway.py +9 -1
- pymammotion/data/model/device.py +7 -4
- pymammotion/data/model/device_info.py +2 -1
- pymammotion/data/mqtt/event.py +18 -14
- pymammotion/data/mqtt/status.py +1 -1
- pymammotion/data/state_manager.py +23 -11
- pymammotion/mammotion/devices/mammotion_cloud.py +15 -7
- pymammotion/mqtt/linkkit/__init__.py +1 -1
- pymammotion/mqtt/linkkit/h2client.py +171 -135
- pymammotion/mqtt/linkkit/linkkit.py +448 -451
- pymammotion/mqtt/mammotion_mqtt.py +11 -7
- pymammotion/utility/device_config.py +657 -25
- pymammotion/utility/device_type.py +13 -1
- {pymammotion-0.4.0a5.dist-info → pymammotion-0.4.0a7.dist-info}/METADATA +3 -1
- {pymammotion-0.4.0a5.dist-info → pymammotion-0.4.0a7.dist-info}/RECORD +17 -17
- {pymammotion-0.4.0a5.dist-info → pymammotion-0.4.0a7.dist-info}/LICENSE +0 -0
- {pymammotion-0.4.0a5.dist-info → pymammotion-0.4.0a7.dist-info}/WHEEL +0 -0
@@ -6,8 +6,8 @@ import hashlib
|
|
6
6
|
import hmac
|
7
7
|
import json
|
8
8
|
import logging
|
9
|
+
from collections.abc import Awaitable, Callable
|
9
10
|
from logging import getLogger
|
10
|
-
from typing import Awaitable, Callable, Optional
|
11
11
|
|
12
12
|
import betterproto
|
13
13
|
from paho.mqtt.client import MQTTMessage
|
@@ -33,18 +33,18 @@ class MammotionMQTT:
|
|
33
33
|
device_secret: str,
|
34
34
|
iot_token: str,
|
35
35
|
cloud_client: CloudIOTGateway,
|
36
|
-
client_id:
|
36
|
+
client_id: str | None = None,
|
37
37
|
) -> None:
|
38
38
|
"""Create instance of MammotionMQTT."""
|
39
39
|
super().__init__()
|
40
40
|
self._cloud_client = cloud_client
|
41
41
|
self.is_connected = False
|
42
42
|
self.is_ready = False
|
43
|
-
self.on_connected:
|
44
|
-
self.on_ready:
|
45
|
-
self.on_error:
|
46
|
-
self.on_disconnected:
|
47
|
-
self.on_message:
|
43
|
+
self.on_connected: Callable[[], Awaitable[None]] | None = None
|
44
|
+
self.on_ready: Callable[[], Awaitable[None]] | None = None
|
45
|
+
self.on_error: Callable[[str], Awaitable[None]] | None = None
|
46
|
+
self.on_disconnected: Callable[[], Awaitable[None]] | None = None
|
47
|
+
self.on_message: Callable[[str, str, str], Awaitable[None]] | None = None
|
48
48
|
|
49
49
|
self._product_key = product_key
|
50
50
|
self._device_name = device_name
|
@@ -193,6 +193,10 @@ class MammotionMQTT:
|
|
193
193
|
else:
|
194
194
|
logger.info("Unhandled event: %s", params.identifier)
|
195
195
|
elif message.topic.endswith("/app/down/thing/status"):
|
196
|
+
# the tell if a device has come back online
|
197
|
+
# lastStatus
|
198
|
+
# 1 online?
|
199
|
+
# 3 offline?
|
196
200
|
status = ThingStatusMessage(**payload)
|
197
201
|
logger.debug(status.params.status.value)
|
198
202
|
elif message.topic.endswith("/app/down/thing/properties"):
|