Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions openevsehttp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__(self, host: str, user: str = "", pwd: str = "") -> None:
self.websocket: OpenEVSEWebsocket | None = None
self.callback: Callable | None = None
self._loop = None
self.tasks = None

async def process_request(
self,
Expand Down Expand Up @@ -295,6 +296,11 @@ async def ws_disconnect(self) -> None:
self._ws_listening = False
assert self.websocket
await self.websocket.close()
if self._loop:
try:
self._loop.cancel()
except AttributeError:
pass

def is_coroutine_function(self, callback):
"""Check if a callback is a coroutine function."""
Expand Down
1 change: 1 addition & 0 deletions openevsehttp/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ async def listen(self):
async def close(self):
"""Close the listening websocket."""
await OpenEVSEWebsocket.state.fset(self, STATE_STOPPED)
await self.session.close()

async def keepalive(self):
"""Send ping requests to websocket."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

PROJECT_DIR = Path(__file__).parent.resolve()
README_FILE = PROJECT_DIR / "README.md"
VERSION = "0.1.75"
VERSION = "0.1.76"

setup(
name="python_openevse_http",
Expand Down