Skip to content

Commit

Permalink
add possibility to check if the gateway is connected. also, only let …
Browse files Browse the repository at this point in the history
…klf reboot if it is currently connected
  • Loading branch information
Christopher Hoch committed Dec 19, 2023
1 parent cfc2016 commit a986977
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pyvlx/pyvlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ async def connect(self) -> None:

async def reboot_gateway(self) -> None:
"""For Compatibility: Reboot the KLF 200."""
PYVLXLOG.warning("KLF 200 reboot initiated")
await self.klf200.reboot()
if not self.is_connected():
PYVLXLOG.warning("KLF 200 reboot initiated, but gateway is not connected")
else:
PYVLXLOG.warning("KLF 200 reboot initiated")
await self.klf200.reboot()

def is_connected(self) -> bool:
"""Returns whether or not the gateway is currently connected."""
return self.connection.connected

async def check_connected(self) -> None:
"""Check we're connected, and if not, connect."""
Expand Down

0 comments on commit a986977

Please sign in to comment.