diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f9ce843..a0ae5f0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,7 +6,7 @@ env: on: push: branches: - - master + - main pull_request: diff --git a/roombapy/remote_client.py b/roombapy/remote_client.py index 9527f89..5d56a96 100644 --- a/roombapy/remote_client.py +++ b/roombapy/remote_client.py @@ -98,7 +98,10 @@ def _open_mqtt_connection(self): self.mqtt_client.loop_start() def _get_mqtt_client(self): - mqtt_client = mqtt.Client(client_id=self.blid) + mqtt_client = mqtt.Client( + client_id=self.blid, + callback_api_version=mqtt.CallbackAPIVersion.VERSION1, + ) mqtt_client.username_pw_set(username=self.blid, password=self.password) mqtt_client.on_connect = self._internal_on_connect mqtt_client.on_disconnect = self._internal_on_disconnect diff --git a/tests/test_roomba_integration.py b/tests/test_roomba_integration.py index dc6a794..86e9ec6 100644 --- a/tests/test_roomba_integration.py +++ b/tests/test_roomba_integration.py @@ -2,7 +2,7 @@ import os import pytest -from hbmqtt.broker import Broker +from amqtt.broker import Broker from tests import abstract_test_roomba @@ -39,10 +39,10 @@ async def test_roomba_connect(self, broker, event_loop): roomba = self.get_default_roomba() # when - await self.start_broker(broker, event_loop) + await self.start_broker(broker) is_connected = await self.roomba_connect(roomba, event_loop) await self.roomba_disconnect(roomba, event_loop) - await self.stop_broker(broker, event_loop) + await self.stop_broker(broker) # then assert is_connected @@ -53,29 +53,30 @@ async def test_roomba_connect_error(self, broker, event_loop): roomba = self.get_default_roomba(blid="wrong") # when - await self.start_broker(broker, event_loop) + await self.start_broker(broker) is_connected = await self.roomba_connect(roomba, event_loop) - await self.stop_broker(broker, event_loop) + + await self.stop_broker(broker) # then assert not is_connected async def roomba_connect(self, roomba, loop): await loop.run_in_executor(None, roomba.connect) - await asyncio.sleep(1, loop=loop) + await asyncio.sleep(1) return roomba.roomba_connected async def roomba_disconnect(self, roomba, loop): await loop.run_in_executor(None, roomba.disconnect) - async def start_broker(self, broker, loop): + async def start_broker(self, broker): await broker.start() - await asyncio.sleep(1, loop=loop) + await asyncio.sleep(1) - async def stop_broker(self, broker, loop): + async def stop_broker(self, broker): await broker.shutdown() - await asyncio.sleep(1, loop=loop) + await asyncio.sleep(1) @pytest.fixture - def broker(self, event_loop): - return Broker(BROKER_CONFIG, loop=event_loop) + def broker(self): + return Broker(BROKER_CONFIG)