Skip to content

Commit

Permalink
Add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
RobBie1221 authored Jan 31, 2024
1 parent 0bcc0e3 commit 5e67c86
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions custom_components/nefiteasy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ async def connect(self) -> None:
"""Connect to nefit easy."""
_LOGGER.debug("Start connecting.")
if not self.is_connecting:
_LOGGER.debug("Set is connecting to true")
self.is_connecting = True

await self.nefit.connect()
Expand All @@ -150,9 +151,14 @@ async def connect(self) -> None:
self.nefit.get("/gateway/brandID")
except slixmpp.xmlstream.xmlstream.NotConnectedError:
self.connected_state == STATE_INIT
_LOGGER.debug("Set is connecting to false")
self.is_connecting = False
return

try:
_LOGGER.debug(
"Wait for message event"
)
await asyncio.wait_for(
self.nefit.xmppclient.message_event.wait(), timeout=29.0
)
Expand All @@ -163,6 +169,9 @@ async def connect(self) -> None:
except: # noqa: E722 pylint: disable=bare-except
_LOGGER.debug("No connection while testing connection.")
else:
_LOGGER.debug(
"Message event received"
)
self.nefit.xmppclient.message_event.clear()

# No exception and no auth error
Expand All @@ -172,6 +181,7 @@ async def connect(self) -> None:
if self.connected_state != STATE_CONNECTION_VERIFIED:
_LOGGER.debug("Successfully verified connection.")

_LOGGER.debug("Set is connecting to false")
self.is_connecting = False
else:
_LOGGER.debug("Connection procedure is already running.")
Expand Down

0 comments on commit 5e67c86

Please sign in to comment.