Skip to content

Commit

Permalink
Merge pull request #293 from RobBie1221/improve_init
Browse files Browse the repository at this point in the history
Add additional try except block around init
  • Loading branch information
RobBie1221 authored Jan 12, 2024
2 parents 444776d + f503ed9 commit ad8aae6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/nefiteasy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
import slixmpp

from .const import (
CONF_ACCESSKEY,
Expand Down Expand Up @@ -145,7 +146,11 @@ async def connect(self) -> None:
self.connected_state = STATE_CONNECTED

if self.connected_state == STATE_CONNECTED:
self.nefit.get("/gateway/brandID")
try:
self.nefit.get("/gateway/brandID")
except slixmpp.xmlstream.xmlstream.NotConnectedError:
self.connected_state == STATE_INIT
return
try:
await asyncio.wait_for(
self.nefit.xmppclient.message_event.wait(), timeout=29.0
Expand Down

0 comments on commit ad8aae6

Please sign in to comment.