Skip to content

Commit

Permalink
fix await disconnect (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus authored Dec 10, 2021
1 parent f703479 commit 9118d7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deebot_client/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def on_credentials_changed(credentials: Credentials) -> None:
async def initialize(self) -> None:
"""Initialize MQTT."""
if self._client:
self.disconnect()
await self.disconnect()

credentials = await self._authenticator.authenticate()
client_id = f"{credentials.user_id}@ecouser/{self._config.device_id}"
Expand Down Expand Up @@ -113,10 +113,10 @@ def unsubscribe(self, vacuum_bot: VacuumBot) -> None:
for subscription in _get_subscriptions(device_info):
self._client.unsubscribe(subscription.topic)

def disconnect(self) -> None:
async def disconnect(self) -> None:
"""Disconnect from MQTT."""
if self._client:
self._client.disconnect()
await self._client.disconnect()
self._subscribers.clear()

async def _handle_atr(self, topic_split: List[str], payload: bytes) -> None:
Expand Down

0 comments on commit 9118d7b

Please sign in to comment.