pymammotion 0.2.85__py3-none-any.whl → 0.2.86__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.
@@ -66,4 +66,7 @@ class DataEvent:
66
66
  self.on_data_event += obj_method
67
67
 
68
68
  def remove_subscribers(self, obj_method) -> None:
69
- self.on_data_event -= obj_method
69
+ try:
70
+ self.on_data_event -= obj_method
71
+ except ValueError:
72
+ """Subscription object no longer there."""
@@ -173,6 +173,15 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
173
173
  if self._mqtt.is_ready:
174
174
  self.run_periodic_sync_task()
175
175
 
176
+ def __del__(self):
177
+ self._mqtt.on_ready_event.remove_subscribers(self.on_ready)
178
+ self._mqtt.on_disconnected_event.remove_subscribers(self.on_disconnect)
179
+ self._mqtt.on_connected_event.remove_subscribers(self.on_connect)
180
+ self._mqtt.mqtt_message_event.remove_subscribers(self._parse_message_for_device)
181
+ if self._ble_sync_task:
182
+ self._ble_sync_task.cancel()
183
+
184
+
176
185
  async def on_ready(self) -> None:
177
186
  """Callback for when MQTT is subscribed to events."""
178
187
  if self.stopped:
@@ -197,7 +206,6 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
197
206
  """Stop all tasks and disconnect."""
198
207
  if self._ble_sync_task:
199
208
  self._ble_sync_task.cancel()
200
- self._mqtt.on_ready_event.remove_subscribers(self.on_ready)
201
209
  self.stopped = True
202
210
 
203
211
  async def start(self) -> None:
@@ -205,7 +213,6 @@ class MammotionBaseCloudDevice(MammotionBaseDevice):
205
213
  if self._ble_sync_task is None or self._ble_sync_task.cancelled():
206
214
  await self.run_periodic_sync_task()
207
215
  self.stopped = False
208
- self._mqtt.on_ready_event.add_subscribers(self.on_ready)
209
216
  if not self.mqtt.is_connected():
210
217
  self.mqtt.connect_async()
211
218
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymammotion
3
- Version: 0.2.85
3
+ Version: 0.2.86
4
4
  Summary:
5
5
  License: GNU-3.0
6
6
  Author: Michael Arthur
@@ -42,7 +42,7 @@ pymammotion/data/mqtt/properties.py,sha256=kvphcjrDuJHuX8Az98-wKeFv_rSmu2Fz9YKLG
42
42
  pymammotion/data/mqtt/status.py,sha256=zqnlo-MzejEQZszl0i0Wucoc3E76x6UtI9JLxoBnu54,1067
43
43
  pymammotion/data/state_manager.py,sha256=vtBT28-5DY58hJMi_kqOUKnOq6rJ4fx1zX8yU7N96A8,5357
44
44
  pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
45
- pymammotion/event/event.py,sha256=UzYnxV5DfvMDK3E06UvSzvzuBbaXOOUwO6xYt_zn9To,2034
45
+ pymammotion/event/event.py,sha256=m7gDAxVcgQAWQBe7AZd3w59eMf9mlcEv27eRT-zz2c0,2133
46
46
  pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  pymammotion/http/http.py,sha256=9TnVah-R8nkjlb6oCMk78IZ0Y-2iAcMyIdjcQ54GEPk,3562
48
48
  pymammotion/http/model/http.py,sha256=_hHqe9IfKDukUYKQDrZb_Tt_9rd5BNN1WKsaGIjsexM,1876
@@ -64,7 +64,7 @@ pymammotion/mammotion/devices/__init__.py,sha256=f2qQFPgLGmV85W2hSlMUh5BYuht9o_A
64
64
  pymammotion/mammotion/devices/base.py,sha256=F_L5aDtY6rgRkk7Q4CwilLenTANW6cBe9zIU3a9HRmA,10020
65
65
  pymammotion/mammotion/devices/mammotion.py,sha256=hSO184o1q4ftfLPx9froFPIXk428wGg8Ayw160W3z7c,12482
66
66
  pymammotion/mammotion/devices/mammotion_bluetooth.py,sha256=KjcIta1VcJ8eNJvPFeOtwxV2jl3nrk7PldMmPv_Caqw,18939
67
- pymammotion/mammotion/devices/mammotion_cloud.py,sha256=ghNR1av4GJjrHPFWWTCnhNCA6MDmZq0lR7-ZfqweE7I,12337
67
+ pymammotion/mammotion/devices/mammotion_cloud.py,sha256=-l4LRgI4J9_4AJFirocfzlzOMclGl6rliRdD75lbJfo,12613
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.85.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
123
- pymammotion-0.2.85.dist-info/METADATA,sha256=HJQ0Tzx-L-_zoBerxpjSCkTo42-dFPBfkIrK81y7FQg,3896
124
- pymammotion-0.2.85.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
- pymammotion-0.2.85.dist-info/RECORD,,
122
+ pymammotion-0.2.86.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
123
+ pymammotion-0.2.86.dist-info/METADATA,sha256=Nfv6FrCX_R_mkWXgtUsVNwRTrKeTgVaRIp6tiHSgojQ,3896
124
+ pymammotion-0.2.86.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
+ pymammotion-0.2.86.dist-info/RECORD,,