pymammotion 0.2.86__py3-none-any.whl → 0.2.88__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/mammotion/devices/base.py +2 -5
- pymammotion/mammotion/devices/mammotion.py +8 -11
- pymammotion/mammotion/devices/mammotion_bluetooth.py +3 -2
- pymammotion/mammotion/devices/mammotion_cloud.py +3 -2
- {pymammotion-0.2.86.dist-info → pymammotion-0.2.88.dist-info}/METADATA +1 -1
- {pymammotion-0.2.86.dist-info → pymammotion-0.2.88.dist-info}/RECORD +8 -8
- {pymammotion-0.2.86.dist-info → pymammotion-0.2.88.dist-info}/LICENSE +0 -0
- {pymammotion-0.2.86.dist-info → pymammotion-0.2.88.dist-info}/WHEEL +0 -0
@@ -33,14 +33,11 @@ def find_next_integer(lst: list[int], current_hash: int) -> int | None:
|
|
33
33
|
class MammotionBaseDevice:
|
34
34
|
"""Base class for Mammotion devices."""
|
35
35
|
|
36
|
-
|
37
|
-
_cloud_device: Device | None = None
|
38
|
-
|
39
|
-
def __init__(self, device: MowingDevice, cloud_device: Device | None = None) -> None:
|
36
|
+
def __init__(self, state_manager: StateManager, cloud_device: Device | None = None) -> None:
|
40
37
|
"""Initialize MammotionBaseDevice."""
|
41
38
|
self.loop = asyncio.get_event_loop()
|
42
39
|
self._raw_data = LubaMsg().to_dict(casing=betterproto.Casing.SNAKE)
|
43
|
-
self._state_manager =
|
40
|
+
self._state_manager = state_manager
|
44
41
|
self._state_manager.gethash_ack_callback = self.datahash_response
|
45
42
|
self._state_manager.get_commondata_ack_callback = self.commdata_response
|
46
43
|
self._notify_future: asyncio.Future[bytes] | None = None
|
@@ -13,6 +13,7 @@ from pymammotion.aliyun.cloud_gateway import CloudIOTGateway
|
|
13
13
|
from pymammotion.aliyun.model.dev_by_account_response import Device
|
14
14
|
from pymammotion.data.model.account import Credentials
|
15
15
|
from pymammotion.data.model.device import MowingDevice
|
16
|
+
from pymammotion.data.state_manager import StateManager
|
16
17
|
from pymammotion.http.http import connect_http
|
17
18
|
from pymammotion.mammotion.devices.mammotion_bluetooth import MammotionBaseBLEDevice
|
18
19
|
from pymammotion.mammotion.devices.mammotion_cloud import MammotionBaseCloudDevice, MammotionCloud
|
@@ -32,8 +33,6 @@ class ConnectionPreference(Enum):
|
|
32
33
|
|
33
34
|
|
34
35
|
class MammotionMixedDeviceManager:
|
35
|
-
_ble_device: MammotionBaseBLEDevice | None = None
|
36
|
-
_cloud_device: MammotionBaseCloudDevice | None = None
|
37
36
|
preference: ConnectionPreference
|
38
37
|
|
39
38
|
def __init__(
|
@@ -45,22 +44,20 @@ class MammotionMixedDeviceManager:
|
|
45
44
|
preference: ConnectionPreference = ConnectionPreference.BLUETOOTH,
|
46
45
|
) -> None:
|
47
46
|
self.name = name
|
48
|
-
self.
|
47
|
+
self._state_manager = StateManager(MowingDevice())
|
48
|
+
self._ble_device: MammotionBaseBLEDevice | None = None
|
49
|
+
self._cloud_device: MammotionBaseCloudDevice | None = None
|
49
50
|
self.add_ble(ble_device)
|
50
51
|
self.add_cloud(cloud_device, mqtt)
|
51
52
|
self.preference = preference
|
52
53
|
|
53
54
|
@property
|
54
55
|
def mower_state(self):
|
55
|
-
return self.
|
56
|
+
return self._state_manager.get_device()
|
56
57
|
|
57
58
|
@mower_state.setter
|
58
59
|
def mower_state(self, value: MowingDevice) -> None:
|
59
|
-
|
60
|
-
self._cloud_device.state_manager.set_device(value)
|
61
|
-
if self._ble_device:
|
62
|
-
self._ble_device.state_manager.set_device(value)
|
63
|
-
self._mower_state = value
|
60
|
+
self._state_manager.set_device(value)
|
64
61
|
|
65
62
|
def ble(self) -> MammotionBaseBLEDevice | None:
|
66
63
|
return self._ble_device
|
@@ -76,12 +73,12 @@ class MammotionMixedDeviceManager:
|
|
76
73
|
|
77
74
|
def add_ble(self, ble_device: BLEDevice) -> None:
|
78
75
|
if ble_device is not None:
|
79
|
-
self._ble_device = MammotionBaseBLEDevice(self.
|
76
|
+
self._ble_device = MammotionBaseBLEDevice(state_manager=self._state_manager, ble_device=ble_device)
|
80
77
|
|
81
78
|
def add_cloud(self, cloud_device: Device | None = None, mqtt: MammotionCloud | None = None) -> None:
|
82
79
|
if cloud_device is not None:
|
83
80
|
self._cloud_device = MammotionBaseCloudDevice(
|
84
|
-
mqtt, cloud_device=cloud_device,
|
81
|
+
mqtt, cloud_device=cloud_device, state_manager=self._state_manager
|
85
82
|
)
|
86
83
|
|
87
84
|
def replace_cloud(self, cloud_device: MammotionBaseCloudDevice) -> None:
|
@@ -15,6 +15,7 @@ from bleak_retry_connector import (
|
|
15
15
|
|
16
16
|
from pymammotion.bluetooth import BleMessage
|
17
17
|
from pymammotion.data.model.device import MowingDevice
|
18
|
+
from pymammotion.data.state_manager import StateManager
|
18
19
|
from pymammotion.mammotion.commands.mammotion_command import MammotionCommand
|
19
20
|
from pymammotion.mammotion.devices.base import MammotionBaseDevice
|
20
21
|
from pymammotion.proto import has_field
|
@@ -69,9 +70,9 @@ async def _handle_retry(fut: asyncio.Future[None], func, command: bytes) -> None
|
|
69
70
|
class MammotionBaseBLEDevice(MammotionBaseDevice):
|
70
71
|
"""Base class for Mammotion BLE devices."""
|
71
72
|
|
72
|
-
def __init__(self,
|
73
|
+
def __init__(self, state_manager: StateManager, device: BLEDevice, interface: int = 0, **kwargs: Any) -> None:
|
73
74
|
"""Initialize MammotionBaseBLEDevice."""
|
74
|
-
super().__init__(
|
75
|
+
super().__init__(state_manager)
|
75
76
|
self._disconnect_strategy = True
|
76
77
|
self._ble_sync_task = None
|
77
78
|
self._prev_notification = None
|
@@ -14,6 +14,7 @@ from pymammotion.aliyun.model.dev_by_account_response import Device
|
|
14
14
|
from pymammotion.data.model.device import MowingDevice
|
15
15
|
from pymammotion.data.mqtt.event import ThingEventMessage
|
16
16
|
from pymammotion.data.mqtt.properties import ThingPropertiesMessage
|
17
|
+
from pymammotion.data.state_manager import StateManager
|
17
18
|
from pymammotion.event.event import DataEvent
|
18
19
|
from pymammotion.mammotion.commands.mammotion_command import MammotionCommand
|
19
20
|
from pymammotion.mammotion.devices.base import MammotionBaseDevice
|
@@ -150,9 +151,9 @@ class MammotionCloud:
|
|
150
151
|
class MammotionBaseCloudDevice(MammotionBaseDevice):
|
151
152
|
"""Base class for Mammotion Cloud devices."""
|
152
153
|
|
153
|
-
def __init__(self, mqtt: MammotionCloud, cloud_device: Device,
|
154
|
+
def __init__(self, mqtt: MammotionCloud, cloud_device: Device, state_manager: StateManager) -> None:
|
154
155
|
"""Initialize MammotionBaseCloudDevice."""
|
155
|
-
super().__init__(
|
156
|
+
super().__init__(state_manager, cloud_device)
|
156
157
|
self._ble_sync_task: TimerHandle | None = None
|
157
158
|
self.stopped = False
|
158
159
|
self.on_ready_callback: Optional[Callable[[], Awaitable[None]]] = None
|
@@ -61,10 +61,10 @@ pymammotion/mammotion/commands/messages/video.py,sha256=ne1YSuQChaDFfmHgMO5Jc9_O
|
|
61
61
|
pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
62
62
|
pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
|
63
63
|
pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
|
64
|
-
pymammotion/mammotion/devices/base.py,sha256=
|
65
|
-
pymammotion/mammotion/devices/mammotion.py,sha256=
|
66
|
-
pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=
|
67
|
-
pymammotion/mammotion/devices/mammotion_cloud.py,sha256
|
64
|
+
pymammotion/mammotion/devices/base.py,sha256=WRRDJsIftlvJ56C7uDbwx2nvb60MORHMGSBWbwlN9g8,9946
|
65
|
+
pymammotion/mammotion/devices/mammotion.py,sha256=qYH1Yg_XZ9PrdKoYlksudAe04VjcvBc5jzz4zlxB3xM,12447
|
66
|
+
pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=BqvYJhuK-fFx-0cuoi0zPFL3Hg2ZwSNsPlE_I2DTXos,18997
|
67
|
+
pymammotion/mammotion/devices/mammotion_cloud.py,sha256=W50O7m6IRwsVoE5PZS9dWTGtH9Xh37J5Abb4honzNf4,12671
|
68
68
|
pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
|
69
69
|
pymammotion/mqtt/mammotion_future.py,sha256=_OWqKOlUGl2yT1xOsXFQYpGd-1zQ63OxqXgy7KRQgYc,710
|
70
70
|
pymammotion/mqtt/mammotion_mqtt.py,sha256=LaySave_hf0gU3crUTLqzpdQtxIwK8vu5DM8F8fbU2Y,8748
|
@@ -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.2.
|
123
|
-
pymammotion-0.2.
|
124
|
-
pymammotion-0.2.
|
125
|
-
pymammotion-0.2.
|
122
|
+
pymammotion-0.2.88.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
123
|
+
pymammotion-0.2.88.dist-info/METADATA,sha256=r9dZivAE2dGD73ICzaKfwiTE5YWd6IXDCXqh1wckQC8,3896
|
124
|
+
pymammotion-0.2.88.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
125
|
+
pymammotion-0.2.88.dist-info/RECORD,,
|
File without changes
|
File without changes
|