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.
@@ -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: Optional[str] = None,
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: Optional[Callable[[], Awaitable[None]]] = None
44
- self.on_ready: Optional[Callable[[], Awaitable[None]]] = None
45
- self.on_error: Optional[Callable[[str], Awaitable[None]]] = None
46
- self.on_disconnected: Optional[Callable[[], Awaitable[None]]] = None
47
- self.on_message: Optional[Callable[[str, str, str], Awaitable[None]]] = None
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"):