diff --git a/aioesphomeapi/connection.py b/aioesphomeapi/connection.py index 3a083e2..2d1c726 100644 --- a/aioesphomeapi/connection.py +++ b/aioesphomeapi/connection.py @@ -5,7 +5,7 @@ import socket import time from contextlib import suppress from dataclasses import astuple, dataclass -from typing import Any, Awaitable, Callable, List, Optional +from typing import Any, Callable, Coroutine, List, Optional from google.protobuf import message @@ -77,7 +77,7 @@ class APIConnection: """ def __init__( - self, params: ConnectionParams, on_stop: Callable[[], Awaitable[None]] + self, params: ConnectionParams, on_stop: Callable[[], Coroutine[Any, Any, None]] ): self._params = params self.on_stop = on_stop diff --git a/aioesphomeapi/log_reader.py b/aioesphomeapi/log_reader.py index 8962210..8519a9a 100644 --- a/aioesphomeapi/log_reader.py +++ b/aioesphomeapi/log_reader.py @@ -57,7 +57,7 @@ async def main(argv: List[str]) -> None: ) has_connects = True except APIConnectionError: - cli.disconnect() + await cli.disconnect() async def on_disconnect() -> None: _LOGGER.warning("Disconnected from API") diff --git a/requirements_test.txt b/requirements_test.txt index f48cbfc..6a2d183 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -2,7 +2,7 @@ pylint==2.13.9 black==22.3.0 flake8==4.0.1 isort==5.10.1 -mypy==0.942 +mypy==0.950 types-protobuf==3.19.20 pytest>=6.2.4,<8 pytest-asyncio>=0.15.1,<1