pymammotion 0.5.12__py3-none-any.whl → 0.5.14__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.

@@ -139,11 +139,13 @@ class MammotionDeviceManager:
139
139
  if mammotion_device.has_ble():
140
140
  exists.replace_ble(mammotion_device.ble())
141
141
 
142
+ def has_device(self, mammotion_device_name: str) -> bool:
143
+ if self.devices.get(mammotion_device_name, None) is not None:
144
+ return True
145
+ return False
146
+
142
147
  def get_device(self, mammotion_device_name: str) -> MammotionMixedDeviceManager:
143
- if device := self.devices[mammotion_device_name]:
144
- return device
145
- else:
146
- raise KeyError
148
+ return self.devices[mammotion_device_name]
147
149
 
148
150
  async def remove_device(self, name: str) -> None:
149
151
  """Remove a device."""
@@ -231,8 +233,8 @@ class Mammotion:
231
233
  def add_cloud_devices(self, mqtt_client: MammotionCloud) -> None:
232
234
  """Add devices from cloud."""
233
235
  for device in mqtt_client.cloud_client.devices_by_account_response.data.data:
234
- mower_device = self.device_manager.get_device(device.deviceName)
235
- if device.deviceName.startswith(("Luba-", "Yuka-")) and mower_device is None:
236
+ has_device = self.device_manager.has_device(device.deviceName)
237
+ if device.deviceName.startswith(("Luba-", "Yuka-")) and not has_device:
236
238
  mixed_device = MammotionMixedDeviceManager(
237
239
  name=device.deviceName,
238
240
  iot_id=device.iotId,
@@ -246,7 +248,8 @@ class Mammotion:
246
248
  device.productName if device.productModel is None else device.productModel
247
249
  )
248
250
  self.device_manager.add_device(mixed_device)
249
- elif device.deviceName.startswith(("Luba-", "Yuka-")) and mower_device:
251
+ elif device.deviceName.startswith(("Luba-", "Yuka-")) and has_device:
252
+ mower_device = self.device_manager.get_device(device.deviceName)
250
253
  if mower_device.cloud() is None:
251
254
  mower_device.add_cloud(mqtt=mqtt_client)
252
255
  else:
@@ -284,8 +287,8 @@ class Mammotion:
284
287
  return self.device_manager.get_device(name)
285
288
 
286
289
  def get_or_create_device_by_name(self, device: Device, mqtt_client: MammotionCloud) -> MammotionMixedDeviceManager:
287
- if mow_device := self.device_manager.get_device(device.deviceName):
288
- return mow_device
290
+ if self.device_manager.has_device(device.deviceName):
291
+ return self.device_manager.get_device(device.deviceName)
289
292
  mow_device = MammotionMixedDeviceManager(
290
293
  name=device.deviceName,
291
294
  iot_id=device.iotId,
@@ -2,8 +2,8 @@ syntax = "proto3";
2
2
 
3
3
  enum CutterWorkMode {
4
4
  CUTTER_STANDARD = 0;
5
- CUTTER_PERFORMANCE = 1;
6
- CUTTER_ECONOMIC = 2;
5
+ CUTTER_ECONOMIC = 1;
6
+ CUTTER_PERFORMANCE = 2;
7
7
  }
8
8
 
9
9
  enum CollectMotorState {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymammotion
3
- Version: 0.5.12
3
+ Version: 0.5.14
4
4
  Summary:
5
5
  License: GPL-3.0
6
6
  Author: Michael Arthur
@@ -73,7 +73,7 @@ pymammotion/mammotion/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
73
73
  pymammotion/mammotion/control/joystick.py,sha256=QfBVxM_gxpWsZAGO90whtgxCI2tIZ3TTad9wHIPsU9s,5640
74
74
  pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_Ar_JEAAMD4fsE,102
75
75
  pymammotion/mammotion/devices/base.py,sha256=qDh7P7fnakDKgxTqjNLcQg8eE-6gHJaXAV0ONjhy_IU,12038
76
- pymammotion/mammotion/devices/mammotion.py,sha256=BJtlukiRqi5GLO4cQ5QgMxQRKtMO0bBmpHWM_27hyYI,15601
76
+ pymammotion/mammotion/devices/mammotion.py,sha256=uk0mM6JSOzr84qkf8lECvlmTLX0UEQDXyowSeHZydek,15801
77
77
  pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=mbZlbm3lAx5uLtHOR7rZ_hp4l9XPb2DnSzz4v8tdmKg,19352
78
78
  pymammotion/mammotion/devices/mammotion_cloud.py,sha256=USYgv3ENplzy0dWu0JttBy9Ldl06yUkuhxI2dW0GfTQ,16527
79
79
  pymammotion/mqtt/__init__.py,sha256=Ocs5e-HLJvTuDpVXyECEsWIvwsUaxzj7lZ9mSYutNDY,105
@@ -98,7 +98,7 @@ pymammotion/proto/luba_msg_pb2.pyi,sha256=_pTiOzssrVbEty_yIjHpnQWbTNtFfKfqSC_wvp
98
98
  pymammotion/proto/luba_mul.proto,sha256=jAJN9Sts0PfqmLYDdte5NIY36oOrMP0bbqat6RuigYI,2135
99
99
  pymammotion/proto/luba_mul_pb2.py,sha256=MDZotppPPglKfTuBuWNjw6iHXbUVAH_PXPyl9VVF7sc,5724
100
100
  pymammotion/proto/luba_mul_pb2.pyi,sha256=KsTOSGRTvcO1qO7wxuu827zRT7Eb7xnUN-KRd7dgm6s,7713
101
- pymammotion/proto/mctrl_driver.proto,sha256=jbsPcPjbAc28TPQgTZWsR-AWi6eJ5iKXMk03aa7Hs5s,2181
101
+ pymammotion/proto/mctrl_driver.proto,sha256=zu_9xKSPV3O1B1aB2tN1QwtDLiInpsKaa8xaDXl0Inc,2181
102
102
  pymammotion/proto/mctrl_driver_pb2.py,sha256=stUvD3hzZALsdmTJVl7giD2O4nded60zKbew-d1eFrI,5512
103
103
  pymammotion/proto/mctrl_driver_pb2.pyi,sha256=z8UgWQxXT1GLVRCrI6wuV6coerMvPbVCAGSskL5QLAU,8494
104
104
  pymammotion/proto/mctrl_nav.proto,sha256=sPAVCyIn5MZiQbp0wFk5KKJacSRUOy3zEiExa4ebikQ,12806
@@ -125,7 +125,7 @@ pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tp
125
125
  pymammotion/utility/mur_mur_hash.py,sha256=xEfOZVbqRawJj66eLgtnZ85OauDR47oIPr29OHelzPI,4468
126
126
  pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
127
127
  pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
128
- pymammotion-0.5.12.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
129
- pymammotion-0.5.12.dist-info/METADATA,sha256=s4Bqz8X821VmOlMZ3XdeyHRwuZwg4qVsqy5zD2McPLo,3871
130
- pymammotion-0.5.12.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
131
- pymammotion-0.5.12.dist-info/RECORD,,
128
+ pymammotion-0.5.14.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
129
+ pymammotion-0.5.14.dist-info/METADATA,sha256=weuRuWkfNiqMtabHEayET8buw26T_jewaEvmowc1Axc,3871
130
+ pymammotion-0.5.14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
131
+ pymammotion-0.5.14.dist-info/RECORD,,