Skip to content

Commit

Permalink
Merge pull request #63 from pawlizio/org_master
Browse files Browse the repository at this point in the history
Disable house status monitor before disconnecting
  • Loading branch information
Julius2342 committed Mar 15, 2021
2 parents bc1d162 + 5f26a64 commit f39667e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyvlx/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Module for all KLF 200 API frames."""
# flake8: noqa

from .house_status_monitor import (house_status_monitor_enable)
from .house_status_monitor import (house_status_monitor_enable, house_status_monitor_disable)
from .command_send import (CommandSend)
from .get_local_time import (FrameGetLocalTimeRequest, FrameGetLocalTimeConfirmation)
from .get_state import (GetState)
Expand Down
4 changes: 3 additions & 1 deletion pyvlx/pyvlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import asyncio


from .api import house_status_monitor_enable
from .api import house_status_monitor_enable, house_status_monitor_disable
from .config import Config
from .connection import Connection
from .heartbeat import Heartbeat
Expand Down Expand Up @@ -68,6 +68,8 @@ async def send_frame(self, frame):

async def disconnect(self):
"""Disconnect from KLF 200."""
# If the connection will be closed while house status monitor is enabled, a reconnection will fail on SSL handshake.
await house_status_monitor_disable(pyvlx=self)
await self.heartbeat.stop()
self.connection.disconnect()

Expand Down

0 comments on commit f39667e

Please sign in to comment.