Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
Fix exception caused by endpoint abort
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelawrence committed Mar 5, 2021
1 parent ab6cf8f commit da691c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for aiosenseme library

## v0.5.4

* Fix error caused by adding timeout in v0.5.3.

## v0.5.3

* Added timeout in listener task to better detect when fans are offline.
Expand Down
4 changes: 3 additions & 1 deletion aiosenseme/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ async def receive(self) -> str:
Return None when the socket is closed.
This method is a coroutine.
"""
if not self.transport:
return None
if self.receive_queue.empty() and self.transport.is_closing():
return None
return await self.receive_queue.get()
Expand Down Expand Up @@ -900,7 +902,7 @@ async def _listener(self):
except asyncio.TimeoutError:
self._endpoint.abort()
data = None
_LOGGER.warning("%s: Device has been quiet too long.", self.name)
_LOGGER.debug("%s: Device has been quiet too long.", self.name)
if data is None:
# endpoint is closed, let task know it's time open another
_LOGGER.warning(
Expand Down
2 changes: 1 addition & 1 deletion aiosenseme/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version for aiosenseme library."""

__version__ = "0.5.3"
__version__ = "0.5.4"

0 comments on commit da691c4

Please sign in to comment.